Points

class py123d.geometry.Point2D[source]

Class presenting a 2D point.

Example

>>> from py123d.geometry import Point2D
>>> point_2d = Point2D(1.0, 2.0)
>>> point_2d.x, point_2d.y
(1.0, 2.0)
>>> point_2d.array
array([1., 2.])

Public Data Attributes:

x

The x coordinate of the point.

y

The y coordinate of the point.

array

The array representation of shape (2,), indexed by Point2DIndex.

shapely_point

The shapely point representation of the 2D point.

point_2d

Returns the Point2D instance itself.

Inherited from ArrayMixin

array

The array representation of the geometric entity.

shape

Return the shape of the array.

Public Methods:

from_array(array[, copy])

Creates a Point2D from a (2,) shaped numpy array, indexed by Point2DIndex.

Inherited from ArrayMixin

from_array(array[, copy])

Create an instance from a NumPy array.

from_list(values)

Create an instance from a list of values.

tolist()

Convert the array to a Python list.

to_list()

Convert the array to a Python list.

copy()

Return a copy of the object with a copied array.


__init__(x, y)[source]

Initializes Point2D with x, y coordinates.

Parameters:
  • x (float) – The x coordinate.

  • y (float) – The y coordinate.

classmethod from_array(array, copy=True)[source]

Creates a Point2D from a (2,) shaped numpy array, indexed by Point2DIndex.

Parameters:
  • array (ndarray[tuple[Any, ...], dtype[float64]]) – A (2,) shaped numpy array representing the point coordinates (x,y).

  • copy (bool) – Whether to copy the input array. Defaults to True.

Return type:

Point2D

Returns:

A Point2D instance.

property x: float

The x coordinate of the point.

property y: float

The y coordinate of the point.

property array: ndarray[tuple[Any, ...], dtype[float64]]

The array representation of shape (2,), indexed by Point2DIndex.

property shapely_point: Point

The shapely point representation of the 2D point.

property point_2d: Point2D

Returns the Point2D instance itself.

copy()

Return a copy of the object with a copied array.

Return type:

ArrayMixin

classmethod from_list(values)

Create an instance from a list of values.

Return type:

Self

Parameters:

values (list)

property shape: tuple

Return the shape of the array.

to_list()

Convert the array to a Python list.

Return type:

list

tolist()

Convert the array to a Python list.

Return type:

list

class py123d.geometry.Point3D[source]

Class presenting a 3D point.

Example

>>> from py123d.geometry import Point3D
>>> point_3d = Point3D(1.0, 2.0, 3.0)
>>> point_3d.x, point_3d.y, point_3d.z
(1.0, 2.0, 3.0)
>>> point_3d.array
array([1., 2., 3.])

Public Data Attributes:

x

The x coordinate of the point.

y

The y coordinate of the point.

z

The z coordinate of the point.

array

The array representation of shape (3,), indexed by Point3DIndex.

point_3d

Returns the Point3D instance itself.

point_2d

The 2D projection of the 3D point as a Point2D instance.

shapely_point

The shapely point representation of the 3D point.

Inherited from ArrayMixin

array

The array representation of the geometric entity.

shape

Return the shape of the array.

Public Methods:

from_array(array[, copy])

Creates a Point3D from a (3,) shaped numpy array, indexed by Point3DIndex.

Inherited from ArrayMixin

from_array(array[, copy])

Create an instance from a NumPy array.

from_list(values)

Create an instance from a list of values.

tolist()

Convert the array to a Python list.

to_list()

Convert the array to a Python list.

copy()

Return a copy of the object with a copied array.


__init__(x, y, z)[source]

Initializes Point3D with x, y, z coordinates.

Parameters:
  • x (float) – The x coordinate.

  • y (float) – The y coordinate.

  • z (float) – The z coordinate.

classmethod from_array(array, copy=True)[source]

Creates a Point3D from a (3,) shaped numpy array, indexed by Point3DIndex.

Parameters:
  • array (ndarray[tuple[Any, ...], dtype[float64]]) – A (3,) shaped numpy array representing the point coordinates (x,y,z).

  • copy (bool) – Whether to copy the input array. Defaults to True.

Return type:

Point3D

property x: float

The x coordinate of the point.

property y: float

The y coordinate of the point.

property z: float

The z coordinate of the point.

property array: ndarray[tuple[Any, ...], dtype[float64]]

The array representation of shape (3,), indexed by Point3DIndex.

property point_3d: Point3D

Returns the Point3D instance itself.

property point_2d: Point2D

The 2D projection of the 3D point as a Point2D instance.

property shapely_point: Point

The shapely point representation of the 3D point.

copy()

Return a copy of the object with a copied array.

Return type:

ArrayMixin

classmethod from_list(values)

Create an instance from a list of values.

Return type:

Self

Parameters:

values (list)

property shape: tuple

Return the shape of the array.

to_list()

Convert the array to a Python list.

Return type:

list

tolist()

Convert the array to a Python list.

Return type:

list