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:
  • a (float) –

  • b (float) –

  • c (float) –

  • d (float) –

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.