mapteksdk.geometry module

Geometry types used in the Python SDK.

This does not cover the common geometry types of points, vectors and facets which are represented with numpy arrays rather than distinct types/classes.

class Plane(a, b, c, d)

Bases: object

A plane in 3D defined by the equation Ax + By + Cz + D = 0.

Parameters:
property normal: npt.ArrayLike

The normal of the plane.

This is not normalised (i.e. its length is not guaranteed to be 1).

translated(vector)

Return a new Plane translated by the given vector.

Parameters:

vector (npt.ArrayLike) – The vector by which the plane will be translated.

Returns:

A new plane that has been translated from the current plane by vector.

Return type:

Plane

Warning

Vector must not contain NaNs. Vector must be a 3D vector (consist of 3 components).

classmethod from_normal_and_point(normal, point)

Construct a plane using a normal vector and point on the plane.

Parameters:
  • normal (npt.ArrayLike) – The normal vector of the plane. The magnitude (also known as length) of this vector must be non-zero.

  • point (npt.ArrayLike) – A point on the plane.

Warning

The length of the normal vector must not be zero. The normal or point must not contain NaNs. The point must be 3D point (consist of 3 components).

classmethod from_three_points(point1, point2, point3)

Construct a plane using three points and the right-hand rule.

The plane normal is in the direction of Cross(point2 - point1, point3 - point1) and normal’s magnitude (also known as length) must be non-zero.

Parameters:
  • point1 (npt.ArrayLike) – The first point.

  • point2 (npt.ArrayLike) – The second point.

  • point3 (npt.ArrayLike) – The third point.

Warning

The given points must be 3D points (consist of 3 components). The given points must not contain NaNs. The given points must not all be colinear. The length of the normal vector produced from the points must not be zero.

classmethod xy(z=0)

Return a plane whose normal lines along the axis Z.

The plane passes through (0, 0, z).

Parameters:

z (float) – The z-coordinate of the plane.

Warning

The z should not be NaN.

classmethod yz(x=0)

Return a plane whose normal lines along the axis X.

The plane passes through (0, 0, 0).

Parameters:

x (float) – The x-coordinate of the plane.

Warning

The x should not be NaN.

classmethod xz(y=0)

Return a plane whose normal lines along the axis Y.

The plane passes through (0, 0, 0).

Parameters:

y (float) – The y-coordinate of the plane.

Warning

The y should not be NaN.

class Extent(minimum, maximum)

Bases: object

A multidimensional, axially-aligned “intervals” or “extents”.

This extent is bound to a volume in 3D space.

This is also known as a Axis-Aligned Bounding Box (AABB).

Parameters:
minimum

Point representing minimum values in the form [x, y, z].

maximum

Point representing maximum values in the form [x, y, z].

property centre: tuple[float, float, float]

Returns the center of the extent.

Returns:

Point representing the center of the extent.

Return type:

point

property length: float

The length is the maximum of the X, Y or Z dimension.

Returns:

Maximum width of the extent.

Return type:

float

property span: tuple[float, float, float]

The span of the extent in each direction.

as_numpy()

Returns the extent as a numpy array.

Returns:

The extent representing as a numpy array.

Return type:

np.array

overlaps(other)

Return True if this extent and the other overlap.

The extents overlap if they share space which includes if:

  • They extend over each other and partially cover the same space.

  • One extent overlaps another by being inside of the other.

  • The two extents come into contact with one another at a single point.

  • The two extents come into contact with one another along a line.

  • The two extents come into contact in a two dimensional rectangular area, similar to two boxes placed next to each other. No part of either extent is inside of the other extent, but both extents are touching.

Parameters:

other (Extent) – The extent to check if it overlaps with this extent.

Return type:

bool