ZLayout EDA Library v1.0.0
Advanced Electronic Design Automation Layout Library with Bilingual Documentation
Loading...
Searching...
No Matches
zlayout::geometry::Point Class Reference

2D point with high-precision coordinates and utility methods More...

#include <point.hpp>

Public Member Functions

 Point ()
 Default constructor - creates point at origin.
 Point (double x, double y)
 Constructor with coordinates.
 Point (const Point &other)=default
 Copy constructor.
Pointoperator= (const Point &other)=default
 Assignment operator.
bool operator== (const Point &other) const
 Equality operator with tolerance.
bool operator!= (const Point &other) const
 Inequality operator.
Point operator+ (const Point &other) const
 Addition operator.
Point operator- (const Point &other) const
 Subtraction operator.
Point operator* (double scalar) const
 Scalar multiplication.
Point operator/ (double scalar) const
 Scalar division.
Pointoperator+= (const Point &other)
 Addition assignment.
Pointoperator-= (const Point &other)
 Subtraction assignment.
double distance_to (const Point &other) const
 Calculate Euclidean distance to another point.
double distance_squared_to (const Point &other) const
 Calculate squared distance (faster, avoids sqrt)
double distance_to_line (const Point &line_start, const Point &line_end) const
 Calculate distance from this point to a line segment.
double dot (const Point &other) const
 Calculate dot product with another point (as vector)
double cross (const Point &other) const
 Calculate cross product magnitude (2D cross product)
double magnitude () const
 Calculate vector magnitude (length)
double magnitude_squared () const
 Calculate squared magnitude (faster, avoids sqrt)
Point normalize () const
 Normalize vector to unit length.
Point rotate (double angle) const
 Rotate point around origin by angle (radians)
Point rotate_around (const Point &center, double angle) const
 Rotate point around another point by angle (radians)
double angle_to (const Point &other) const
 Calculate angle from this point to another (radians)
bool is_zero () const
 Check if point is approximately zero.
std::string to_string () const
 Get string representation.
 __init__ (self, float x, float y)
str __repr__ (self)
bool __eq__ (self, other)
int __hash__ (self)
float distance_to (self, 'Point' other)
float distance_to_line (self, 'Point' line_start, 'Point' line_end)
 to_numpy (self)

Public Attributes

double x
 X coordinate.
double y
 Y coordinate.
 x = float(x)
 y = float(y)

Static Public Attributes

static constexpr double TOLERANCE = 1e-10
 Default precision tolerance for floating point comparisons.

Friends

std::ostream & operator<< (std::ostream &os, const Point &point)
 Stream output operator.

Detailed Description

2D point with high-precision coordinates and utility methods

2D point with coordinates and utility methods.

Represents a point in 2D space with double precision coordinates. Provides distance calculations, geometric operations, and tolerance-based equality comparisons suitable for EDA applications.

Definition at line 23 of file point.hpp.

Constructor & Destructor Documentation

◆ Point() [1/3]

zlayout::geometry::Point::Point ( )
inline

Default constructor - creates point at origin.

Definition at line 34 of file point.hpp.

Here is the caller graph for this function:

◆ Point() [2/3]

zlayout::geometry::Point::Point ( double x,
double y )
inline

Constructor with coordinates.

Parameters
xX coordinate
yY coordinate

Definition at line 41 of file point.hpp.

◆ Point() [3/3]

zlayout::geometry::Point::Point ( const Point & other)
default

Copy constructor.

Here is the call graph for this function:

◆ __init__()

zlayout.geometry.Point.__init__ ( self,
float x,
float y )

Definition at line 19 of file geometry.py.

Member Function Documentation

◆ __eq__()

bool zlayout.geometry.Point.__eq__ ( self,
other )

Definition at line 29 of file geometry.py.

◆ __hash__()

int zlayout.geometry.Point.__hash__ ( self)

Definition at line 34 of file geometry.py.

◆ __repr__()

str zlayout.geometry.Point.__repr__ ( self)

Definition at line 23 of file geometry.py.

◆ angle_to()

double zlayout::geometry::Point::angle_to ( const Point & other) const

Calculate angle from this point to another (radians)

Parameters
otherTarget point
Returns
Angle in radians

Definition at line 129 of file point.cpp.

Here is the call graph for this function:

◆ cross()

double zlayout::geometry::Point::cross ( const Point & other) const

Calculate cross product magnitude (2D cross product)

Parameters
otherOther point/vector
Returns
Cross product magnitude

Definition at line 97 of file point.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance_squared_to()

double zlayout::geometry::Point::distance_squared_to ( const Point & other) const

Calculate squared distance (faster, avoids sqrt)

Parameters
otherTarget point
Returns
Squared distance between points

Definition at line 62 of file point.cpp.

Here is the call graph for this function:

◆ distance_to() [1/2]

float zlayout.geometry.Point.distance_to ( self,
'Point' other )
Calculate Euclidean distance to another point.

Definition at line 37 of file geometry.py.

◆ distance_to() [2/2]

double zlayout::geometry::Point::distance_to ( const Point & other) const

Calculate Euclidean distance to another point.

Parameters
otherTarget point
Returns
Distance between points

Definition at line 56 of file point.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance_to_line() [1/2]

float zlayout.geometry.Point.distance_to_line ( self,
'Point' line_start,
'Point' line_end )
Calculate distance from this point to a line segment.

Definition at line 41 of file geometry.py.

Here is the call graph for this function:

◆ distance_to_line() [2/2]

double zlayout::geometry::Point::distance_to_line ( const Point & line_start,
const Point & line_end ) const

Calculate distance from this point to a line segment.

Parameters
line_startStart point of line segment
line_endEnd point of line segment
Returns
Minimum distance to line segment

Definition at line 68 of file point.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dot()

double zlayout::geometry::Point::dot ( const Point & other) const

Calculate dot product with another point (as vector)

Parameters
otherOther point/vector
Returns
Dot product

Definition at line 93 of file point.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_zero()

bool zlayout::geometry::Point::is_zero ( ) const

Check if point is approximately zero.

Returns
true if point is within tolerance of origin

Definition at line 134 of file point.cpp.

Here is the call graph for this function:

◆ magnitude()

double zlayout::geometry::Point::magnitude ( ) const

Calculate vector magnitude (length)

Returns
Length of vector from origin to this point

Definition at line 101 of file point.cpp.

Here is the caller graph for this function:

◆ magnitude_squared()

double zlayout::geometry::Point::magnitude_squared ( ) const

Calculate squared magnitude (faster, avoids sqrt)

Returns
Squared length of vector

Definition at line 105 of file point.cpp.

Here is the caller graph for this function:

◆ normalize()

Point zlayout::geometry::Point::normalize ( ) const

Normalize vector to unit length.

Returns
Normalized point/vector

Definition at line 109 of file point.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool zlayout::geometry::Point::operator!= ( const Point & other) const

Inequality operator.

Definition at line 21 of file point.cpp.

Here is the call graph for this function:

◆ operator*()

Point zlayout::geometry::Point::operator* ( double scalar) const

Scalar multiplication.

Definition at line 33 of file point.cpp.

Here is the call graph for this function:

◆ operator+()

Point zlayout::geometry::Point::operator+ ( const Point & other) const

Addition operator.

Definition at line 25 of file point.cpp.

Here is the call graph for this function:

◆ operator+=()

Point & zlayout::geometry::Point::operator+= ( const Point & other)

Addition assignment.

Definition at line 44 of file point.cpp.

Here is the call graph for this function:

◆ operator-()

Point zlayout::geometry::Point::operator- ( const Point & other) const

Subtraction operator.

Definition at line 29 of file point.cpp.

Here is the call graph for this function:

◆ operator-=()

Point & zlayout::geometry::Point::operator-= ( const Point & other)

Subtraction assignment.

Definition at line 50 of file point.cpp.

Here is the call graph for this function:

◆ operator/()

Point zlayout::geometry::Point::operator/ ( double scalar) const

Scalar division.

Definition at line 37 of file point.cpp.

Here is the call graph for this function:

◆ operator=()

Point & zlayout::geometry::Point::operator= ( const Point & other)
default

Assignment operator.

Here is the call graph for this function:

◆ operator==()

bool zlayout::geometry::Point::operator== ( const Point & other) const

Equality operator with tolerance.

Parameters
otherPoint to compare with
Returns
true if points are equal within tolerance

Definition at line 16 of file point.cpp.

Here is the call graph for this function:

◆ rotate()

Point zlayout::geometry::Point::rotate ( double angle) const

Rotate point around origin by angle (radians)

Parameters
angleRotation angle in radians
Returns
Rotated point

Definition at line 117 of file point.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate_around()

Point zlayout::geometry::Point::rotate_around ( const Point & center,
double angle ) const

Rotate point around another point by angle (radians)

Parameters
centerCenter of rotation
angleRotation angle in radians
Returns
Rotated point

Definition at line 123 of file point.cpp.

Here is the call graph for this function:

◆ to_numpy()

zlayout.geometry.Point.to_numpy ( self)
Convert to numpy array (if numpy is available).

Definition at line 61 of file geometry.py.

◆ to_string()

std::string zlayout::geometry::Point::to_string ( ) const

Get string representation.

Returns
String representation of point

Definition at line 138 of file point.cpp.

Here is the caller graph for this function:

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Point & point )
friend

Stream output operator.

Definition at line 144 of file point.cpp.

Member Data Documentation

◆ TOLERANCE

double zlayout::geometry::Point::TOLERANCE = 1e-10
staticconstexpr

Default precision tolerance for floating point comparisons.

Definition at line 29 of file point.hpp.

◆ x [1/2]

zlayout.geometry.Point.x = float(x)

Definition at line 20 of file geometry.py.

◆ x [2/2]

double zlayout::geometry::Point::x

X coordinate.

Definition at line 25 of file point.hpp.

◆ y [1/2]

zlayout.geometry.Point.y = float(y)

Definition at line 21 of file geometry.py.

◆ y [2/2]

double zlayout::geometry::Point::y

Y coordinate.

Definition at line 26 of file point.hpp.


The documentation for this class was generated from the following files: