Line2D
Canonical path: NemAll_Python_Geometry.Line2D
Representation class for 2D line.
RefPoint
property
writable
RefPoint: Point2D
Get the point.
Coordinates of points will be recalculated with new point. Formula: m_Points[i] = m_RefPoint + m_Points[i] - refPoint
StartRelPoint
property
writable
StartRelPoint: Point2D
Get the start point in relative coordinate system
EqualRef
EqualRef(line: Line2D) -> bool
Test for equal points
Parameters:
-
line
(Line2D
) –line for comparision
Returns:
-
bool
–True if points are equal else return false.
GetCenterPoint
GetCenterPoint() -> Point2D
Get the center point in world coordinate system
Returns:
-
Point2D
–Center point in world coordinate system
GetCoords
GetCoords() -> tuple[float, float, float, float]
Get coordinates in world coordinate.
Returns:
-
tuple[float, float, float, float]
–tuple(X coordinate of start point, Y coordinate of start point, X coordinate of end point, Y coordinate of end point)
GetEndPoint
GetEndPoint() -> Point2D
GetEndRelPoint
GetEndRelPoint() -> Point2D
GetStartPoint
GetStartPoint() -> Point2D
GetStartRelPoint
GetStartRelPoint() -> Point2D
IsPoint
Check, whether the line is a point (start point equal end point)
Returns:
-
bool
–Line is a point: true/false
Set
overloaded
Set(line: Line2D)
Set line points in world coordinate system.
Used world coordinates.
Parameters:
-
x1
(float
) –X coordinate of start point.
-
y1
(float
) –Y coordinate of start point.
-
x2
(float
) –X coordinate of end point.
-
y2
(float
) –Y coordinate of end point.
SetEndPoint
SetEndPoint(endPoint: Point2D)
SetEndRelPoint
SetEndRelPoint(endPoint: Point2D)
SetRefPoint
SetRefPoint(refPoint: Point2D)
Set point in world coordinate system.
Coordinates of points will be recalculated with new point. Formula: m_Points[i] = m_RefPoint + m_Points[i] - refPoint
Parameters:
-
refPoint
(Point2D
) –new point.
SetStartPoint
SetStartPoint(startPoint: Point2D)
SetStartRelPoint
SetStartRelPoint(startPoint: Point2D)
TrimEnd
Trim the line at the end
Parameters:
-
ds
(float
) –The length by which the line will be trimmed. Negative value extends the line.
Raises:
-
ValueError
–When the ds length is larger than the line's length.
TrimStart
Trim the line at the start
Parameters:
-
ds
(float
) –The length by which the line will be trimmed. Negative value extends the line.
Raises:
-
ValueError
–When the ds length is larger than the line's length.
__eq__
__eq__(line: Line2D) -> object
Comparison of lines without tolerance.
Be careful, this method work without tolerance!
Parameters:
-
line
(Line2D
) –Compared line.
Returns:
-
object
–True when lines are equal, otherwise false.
__init__
overloaded
Initialize
__init__(line: Line2D)
__init__(line3D: Line3D)
Constructor.
Reference point is initialized to [0.0, 0.0]. Used world coordinates.
Parameters:
-
x1
(float
) –X coordinate of start point.
-
y1
(float
) –Y coordinate of start point.
-
x2
(float
) –X coordinate of end point.
-
y2
(float
) –Y coordinate of end point.