Skip to content

Point2D

Canonical path: NemAll_Python_Geometry.Point2D

Representation class for 2D point

To3D property writable

To3D: Point3D

convert to 3D3

X property writable

X: float

Get the x coordinate.

Y property writable

Y: float

Get the y coordinate.

GetCoords

GetCoords() -> tuple[float, float]

Get copy of X,Y coordinates.

Returns:

  • tuple[float, float]

    tuple(X coordinate of point, Y coordinate of point)

GetDistance

GetDistance(point: Point2D) -> float

Get distance.

Formula: Result(double) = |A-B|.

Parameters:

Returns:

  • float

    double.

IsZero

IsZero() -> bool

Check the coords [0.0,0.0].

If the coords are zero, the return value is true. If the coords aren't zero, the return value is false.

Returns:

  • bool

    bool.

Set overloaded

Set(point: Point2D)

Set the coordinate.

Parameters:

Set(x: float, y: float)

Initialize from x,y coordinates.

Parameters:

  • x (float) –

    coordinate.

  • y (float) –

    coordinate.

SetX

SetX(x: float)

Set the coordinate.

Parameters:

  • x (float) –

    coordinate.

SetY

SetY(y: float)

Set the coordinate.

Parameters:

  • y (float) –

    coordinate.

Values

Values() -> list[float]

Get copy of X,Y coordinates as python list.

Returns:

  • list[float]

    X coordinate of point.,

  • list[float]

    Y coordinate of point.

__add__ overloaded

__add__(point: Point2D) -> Point2D

Point translation by point.

Formula: Point(new) = Point(this) + Point

This is not standard math operation and is implemented only as practical use case for point moving in %Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Service::Move method with Vector2D operand.

Parameters:

Returns:

__add__(vec: Vector2D) -> Point2D

Move the point by vector

Parameters:

Returns:

__eq__

__eq__(point: Point2D) -> bool

Comparison of points without tolerance.

Be careful, this method work without tolerance!

Parameters:

  • point (Point2D) –

    Compared point.

Returns:

  • bool

    True when points are equal, otherwise false.

__iadd__

__iadd__(point: Point2D) -> Point2D

Point translation by point.

Formula: Point(this) = Point(this) + Point

This is not standard math operation and is implemented only as practical use case for point moving in %Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Service::Move method with Vector2D operand.

Parameters:

Returns:

__idiv__

__idiv__(divider: float) -> Point2D

Divide operator.

Formula

Point(this).X = Point(this).X / divider Point(this).Y = Point(this).Y / divider

This method is checked and throwing Geometry::Exception when divider is zero.

Parameters:

  • divider (float) –

    Divider.

Returns:

__init__ overloaded

__init__()

Initialize

__init__(point: Point2D)

Copy constructor.

Parameters:

  • point (Point2D) –

    Point which will be copied.

__init__(point: Point3D)

Explicit copy constructor.

Copy only X_COORD and Y_COORD from point

Parameters:

  • point (Point3D) –

    3D Point which will be copied to the 2D point.

__init__(refPoint: Point2D, point: Point2D)

Constructor.

Initialize point from point in local coordinate system. Formula: Result = refPoint + point

Parameters:

  • refPoint (Point2D) –

    Reference point.

  • point (Point2D) –

    Relative point.

__init__(x: float, y: float)

Constructor.

Initialize point from single coordinates in world coordinate system.

Parameters:

  • x (float) –

    X coordinate of point.

  • y (float) –

    Y coordinate of point.

__isub__

__isub__(point: Point2D) -> Point2D

Point translation by negative point

Formula: Point(this) = Point(this) - Point

This is not standard math operation and is implemented only as practical use case for point moving in %Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Service::Move method with Vector2D operand.

Parameters:

Returns:

__mul__

__mul__(matrix: Matrix2D) -> Point2D

Matrix transformation.

Result = Point * matrix

Parameters:

  • matrix (Matrix2D) –

    Transformation Matrix.

Returns:

__ne__

__ne__(point: Point2D) -> bool

Comparison of points without tolerance.

Be careful, this method works without tolerance!

Parameters:

  • point (Point2D) –

    Compared point.

Returns:

  • bool

    True when points are not equal, otherwise false.

__repr__

__repr__() -> str

Convert to string

__sub__ overloaded

__sub__(vec: Vector2D) -> Point2D

Move the point by reversed vector

Parameters:

Returns:

__sub__(point: Point2D) -> Point2D

Point translation by negative point

Formula: Point(new) = Point(this) - Point

This is not standard math operation and is implemented only as practical use case for point moving in %Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Service::Move method with Vector2D operand.

Parameters:

Returns:

__truediv__

__truediv__(divider: float) -> Point2D

Divide operator.

Formula

Point(new).X = Point(this).X / divider Point(new).Y = Point(this).Y / divider

Parameters:

  • divider (float) –

    Divider.

Returns:

Placeholder