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

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 if the coords are [0.0,0.0].

Returns:

Type Description
bool

True If the coords are zero, False otherwise.

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 Move method with Vector2D operand.

Parameters:

Name Type Description Default
point Point2D

Point.

required

Returns:

Type Description
Point2D

New point

Examples:

>>> Point2D(10, 10) + Point2D(1, 2)
    Point2D(11, 12)
__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

Moved point

Examples:

>>> point = Point2D(10, 10)
>>> point += Point2D(1, 2)
    point = Point2D(11, 12)

__idiv__(divider)

Divide operator.

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

Examples:

>>> point = Point2D(10, 10)
>>> point //= 2
    point = Point2D(5, 5)

__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 Move method with Vector2D operand.

Parameters:

Name Type Description Default
point Point2D

Point.

required

Returns:

Type Description
Point2D

Moved point

Examples:

>>> point = Point2D(10, 10)
>>> point -= Point2D(1, 2)
    point = Point2D(9, 8)

__mul__(matrix)

Matrix transformation.

Result = Point * matrix

Parameters:

Name Type Description Default
matrix Matrix2D

Transformation Matrix.

required

Returns:

Type Description
Point2D

Transformed 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

New point

Examples:

>>> Point2D(10, 10) - Point2D(1, 2)
    Point2D(9, 8)

__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.

Examples:

>>> Point2D(10, 10) / 2
    Point2D(5, 5)