Skip to content

Line2D

Canonical path: NemAll_Python_Geometry.Line2D

Representation class for 2D line.

EndPoint property writable

EndPoint: Point2D

Get the end point in world coordinate system

EndRelPoint property writable

EndRelPoint: Point2D

Get the end 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

StartPoint property writable

StartPoint: Point2D

Get the start point in world coordinate system.

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.

Extend

Extend(delta: float)

Extend the line

Parameters:

  • delta (float) –

    size of extension

GetAngle

GetAngle() -> Angle

Get angle of line

Returns:

  • Angle

    Angle of the line

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

Get the end point in world coordinate system

Returns:

GetEndRelPoint

GetEndRelPoint() -> Point2D

Get the end point in relative coordinate system.

Returns:

GetRefPoint

GetRefPoint() -> Point2D

Get the point.

Returns:

GetStartPoint

GetStartPoint() -> Point2D

Get the start point in world coordinate system.

Returns:

GetStartRelPoint

GetStartRelPoint() -> Point2D

Get the start point in relative coordinate system

Returns:

GetVector

GetVector() -> Vector2D

Get the vector.

Returns:

IsPoint

IsPoint() -> bool

Check, whether the line is a point (start point equal end point)

Returns:

  • bool

    Line is a point: true/false

Reverse

Reverse()

Reverse orientation of the line

Set overloaded

Set(line: Line2D)

Initialize line from line.

Parameters:

Set(x1: float, y1: float, x2: float, y2: float)

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.

Set(point1: Point2D, point2: Point2D)

Set line points in world coordinate system.

Set line from two points. Used world coordinates.

Parameters:

  • point1 (Point2D) –

    Point2D start point of line.

  • point2 (Point2D) –

    Point2D end point of line.

Set(refPoint: Point2D, point1: Point2D, point2: Point2D)

Set line points.

Used local coordinate system for point1 and point2. refPoint used global coordinate system.

Parameters:

  • refPoint (Point2D) –

    refPoint point of line.

  • point1 (Point2D) –

    Point2D start point of line.

  • point2 (Point2D) –

    Point2D end point of line.

SetEndPoint

SetEndPoint(endPoint: Point2D)

Set end point in world coordinate system.

Parameters:

  • endPoint (Point2D) –

    New start point.

SetEndRelPoint

SetEndRelPoint(endPoint: Point2D)

Set end point in local coordinate system.

Parameters:

  • endPoint (Point2D) –

    New start point.

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)

Set start point in world coordinate system.

Parameters:

  • startPoint (Point2D) –

    New start point.

SetStartRelPoint

SetStartRelPoint(startPoint: Point2D)

Set start point in local coordinate system.

Parameters:

  • startPoint (Point2D) –

    New start point.

TrimEnd

TrimEnd(ds: float)

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

TrimStart(ds: float)

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

__init__()

Initialize

__init__(line: Line2D)

Copy constructor.

Parameters:

  • line (Line2D) –

    Line which will be copied.

__init__(line3D: Line3D)

Copy constructor to convert a 3D line

Parameters:

__init__(point1: Point2D, point2: Point2D)

Constructor.

Initialize line from two points. Reference point is initialized to [0.0, 0.0]. Used world coordinates.

Parameters:

  • point1 (Point2D) –

    Point2D start point of line.

  • point2 (Point2D) –

    Point2D end point of line.

__init__(startPoint: Point2D, vec: Vector2D)

Constructor.

Initialize line from point and relative vector to point. Reference point is initialized to [0.0, 0.0]. Used world coordinates.

Parameters:

  • startPoint (Point2D) –

    Point2D start point of line.

  • vec (Vector2D) –

    Vector2D vector of end point relative to the point1.

__init__(x1: float, y1: float, x2: float, y2: float)

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.

__init__(refPoint: Point2D, point1: Point2D, point2: Point2D)

Constructor.

Used local coordinate system for point1 and point2. refPoint used global coordinate system.

Parameters:

  • refPoint (Point2D) –

    point of line.

  • point1 (Point2D) –

    start point of line.

  • point2 (Point2D) –

    end point of line.

__mul__

__mul__(matrix: Matrix2D) -> object

Matrix transformation.

Parameters:

  • matrix (Matrix2D) –

    transformation matrix.

Returns:

  • object

    Line2D transformed line.

__repr__

__repr__() -> str

Convert to string

Placeholder