Skip to content

Point2D

Class full path: NemAll_Python_Geometry.Point2D

Representation class for 2D point

Attributes

X: float property writable

Get the x coordinate.

Y: float property writable

Get the y coordinate.

Functions

GetCoords()

Get copy of X,Y coordinates.

Returns:

Type Description
float

tuple(X coordinate of point,

float

Y coordinate of point)

GetDistance(point)

Get distance.

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

Parameters:

Name Type Description Default
point Point2D

Point2D.

required

Returns:

Type Description
float

double.

IsZero()

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:

Type Description
bool

bool.

Set overload

Set(point)

Set the coordinate.

Parameters:

Name Type Description Default
point Point2D

Point.

required
Set(x, y)

Initialize from x,y coordinates.

Parameters:

Name Type Description Default
x float

coordinate.

required
y float

coordinate.

required

SetX(x)

Set the coordinate.

Parameters:

Name Type Description Default
x float

coordinate.

required

SetY(y)

Set the coordinate.

Parameters:

Name Type Description Default
y float

coordinate.

required

Values()

Get copy of X,Y coordinates as python list.

Returns:

Type Description
list[float]

X coordinate of point.,

list[float]

Y coordinate of point.

__add__ overload

__add__(point)

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:

Name Type Description Default
point Point2D

Point.

required

Returns:

Type Description
Point2D

Point.

__add__(vec)

Move the point by vector

Parameters:

Name Type Description Default
vec Vector2D

Vector

required

Returns:

Type Description
Point2D

New point

__eq__(point)

Comparison of points without tolerance.

Be careful, this method work without tolerance!

Parameters:

Name Type Description Default
point Point2D

Compared point.

required

Returns:

Type Description
bool

True when points are equal, otherwise false.

__iadd__(point)

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:

Name Type Description Default
point Point2D

Point.

required

Returns:

Type Description
Point2D

Point.

__idiv__(divider)

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:

Name Type Description Default
divider float

Divider.

required

Returns:

Type Description
Point2D

Point.

__init__ overload

__init__()

Initialize

__init__(point)

Copy constructor.

Parameters:

Name Type Description Default
point Point2D

Point which will be copied.

required
__init__(point)

Explicit copy constructor.

Copy only X_COORD and Y_COORD from point

Parameters:

Name Type Description Default
point Point3D

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

required
__init__(refPoint, point)

Constructor.

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

Parameters:

Name Type Description Default
refPoint Point2D

Reference point.

required
point Point2D

Relative point.

required
__init__(x, y)

Constructor.

Initialize point from single coordinates in world coordinate system.

Parameters:

Name Type Description Default
x float

X coordinate of point.

required
y float

Y coordinate of point.

required

__isub__(point)

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:

Name Type Description Default
point Point2D

Point.

required

Returns:

Type Description
Point2D

Point.

__mul__(matrix)

Matrix transformation.

Result = Point * matrix

Parameters:

Name Type Description Default
matrix Matrix2D

Transformation Matrix.

required

Returns:

Type Description
Point2D

Point.

__ne__(point)

Comparison of points without tolerance.

Be careful, this method works without tolerance!

Parameters:

Name Type Description Default
point Point2D

Compared point.

required

Returns:

Type Description
bool

True when points are not equal, otherwise false.

__repr__()

Convert to string

__sub__ overload

__sub__(vec)

Move the point by reversed vector

Parameters:

Name Type Description Default
vec Vector2D

Vector

required

Returns:

Type Description
Point2D

New point

__sub__(point)

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:

Name Type Description Default
point Point2D

Point.

required

Returns:

Type Description
Point2D

Point.

__truediv__(divider)

Divide operator.

Formula

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

Parameters:

Name Type Description Default
divider float

Divider.

required

Returns:

Type Description
Point2D

Point.