Line2D
Canonical path: NemAll_Python_Geometry.Line2D
Representation class for 2D line.
Methods:
-
EqualRef–Test for equal points
-
Extend–Extend the line
-
GetAngle–Get angle of line
-
GetCenterPoint–Get the center point in world coordinate system
-
GetCoords–Get coordinates in world coordinate.
-
GetEndPoint–Get the end point in world coordinate system
-
GetEndRelPoint–Get the end point in relative coordinate system.
-
GetRefPoint–Get the point.
-
GetStartPoint–Get the start point in world coordinate system.
-
GetStartRelPoint–Get the start point in relative coordinate system
-
GetVector–Get the vector.
-
IsPoint–Check, whether the line is a point (start point equal end point)
-
Reverse–Reverse orientation of the line
-
Set–Overloaded function. See individual overloads.
-
SetEndPoint–Set end point in world coordinate system.
-
SetEndRelPoint–Set end point in local coordinate system.
-
SetRefPoint–Set point in world coordinate system.
-
SetStartPoint–Set start point in world coordinate system.
-
SetStartRelPoint–Set start point in local coordinate system.
-
TrimEnd–Trim the line at the end
-
TrimStart–Trim the line at the start
-
__eq__–Comparison of lines without tolerance.
-
__init__–Overloaded function. See individual overloads.
-
__mul__–Matrix transformation.
-
__repr__–Convert to string
Attributes:
-
EndPoint(Point2D) –Get the end point in world coordinate system
-
EndRelPoint(Point2D) –Get the end point in relative coordinate system.
-
RefPoint(Point2D) –Get the point.
-
StartPoint(Point2D) –Get the start point in world coordinate system.
-
StartRelPoint(Point2D) –Get the start point in relative coordinate system
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.