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:
__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:
__idiv__(divider)
__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:
__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: