paralleldomain.model.geometry

class BoundingBox2DBaseGeometry(x, y, width, height)

Represents a 2D Bounding Box geometry with a generic coordinate precision of either int or float.

Parameters
  • xx

  • yy

  • widthwidth

  • heightheight

  • class_idclass_id

  • instance_idinstance_id

  • attributesattributes

x

Top-Left corner in image pixels coordinates along x-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

y

Top-Left corner in image pixels coordinates along y-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

width

Width of box in pixel along x-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

height

Height of box in pixel along y-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

class_id

Class ID of annotated object. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D.

attributes

Dictionary of arbitrary object attributes.

property area

Returns area of 2D Bounding Box in square pixel.

property vertices: numpy.ndarray

Returns the 2D vertices of a bounding box.

Vertices are returned in the following order:

0--------1
|        |
|        | right
|        |
3--------2
  bottom
Return type

ndarray

property edges: numpy.ndarray

Returns the 2D edges of a bounding box.

Edges are returned in order of connecting the vertices in the following order:

  • [0, 1]

  • [1, 2]

  • [2, 3]

  • [3, 0]

0--------1
|        |
|        | right
|        |
3--------2
  bottom
Return type

ndarray

include_points(points, inline=False)

Extends the dimensions of the box to include the specified point.

Parameters
  • points (List[paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.bounding_box_2d.T]]) – List of Point2DGeometry which need to be included in updated bounding box.

  • inline (bool) – When set, do not return a copy of the object but update the current object. Default: False.

Returns

A copy of the current object with extended dimensions, if inline is set. Otherwise, returns None.

Return type

Optional[BoundingBox2DBaseGeometry[TypeVar(T, int, float)]]

include_point(point, inline=False)

Extends the dimensions of the box to include the specified point.

Parameters
  • point (paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.bounding_box_2d.T]) – Instance of Point2DGeometry which needs to be included in updated bounding box.

  • inline (bool) – When set, do not return a copy of the object but update the current object. Default: False.

Returns

A copy of the current object with extended dimensions, if inline is set. Otherwise, returns None.

Return type

Optional[BoundingBox2DBaseGeometry[TypeVar(T, int, float)]]

classmethod merge_boxes(target_box, source_box)

Takes two 2D box geometries as input and merges both into a new box geometry. The resulting box geometry has dimensions from target_box and source_box merged into it.

Return type

BoundingBox2DBaseGeometry[TypeVar(T, int, float)]

Parameters
class BoundingBox2DGeometry(x, y, width, height)
property area

Returns area of 2D Bounding Box in square pixel.

property edges: numpy.ndarray

Returns the 2D edges of a bounding box.

Edges are returned in order of connecting the vertices in the following order:

  • [0, 1]

  • [1, 2]

  • [2, 3]

  • [3, 0]

0--------1
|        |
|        | right
|        |
3--------2
  bottom
Return type

ndarray

include_point(point, inline=False)

Extends the dimensions of the box to include the specified point.

Parameters
  • point (paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.bounding_box_2d.T]) – Instance of Point2DGeometry which needs to be included in updated bounding box.

  • inline (bool) – When set, do not return a copy of the object but update the current object. Default: False.

Returns

A copy of the current object with extended dimensions, if inline is set. Otherwise, returns None.

Return type

Optional[BoundingBox2DBaseGeometry[TypeVar(T, int, float)]]

include_points(points, inline=False)

Extends the dimensions of the box to include the specified point.

Parameters
  • points (List[paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.bounding_box_2d.T]]) – List of Point2DGeometry which need to be included in updated bounding box.

  • inline (bool) – When set, do not return a copy of the object but update the current object. Default: False.

Returns

A copy of the current object with extended dimensions, if inline is set. Otherwise, returns None.

Return type

Optional[BoundingBox2DBaseGeometry[TypeVar(T, int, float)]]

classmethod merge_boxes(target_box, source_box)

Takes two 2D box geometries as input and merges both into a new box geometry. The resulting box geometry has dimensions from target_box and source_box merged into it.

Return type

BoundingBox2DBaseGeometry[TypeVar(T, int, float)]

Parameters
property vertices: numpy.ndarray

Returns the 2D vertices of a bounding box.

Vertices are returned in the following order:

0--------1
|        |
|        | right
|        |
3--------2
  bottom
Return type

ndarray

class BoundingBox3DBaseGeometry(pose, width, height, length)

Represents a 3D Bounding Box geometry with a generic coordinate precision of either int or float.

Parameters
pose

6D Pose for box in 3D sensor space.

Type

paralleldomain.utilities.transformation.Transformation

length

Length of box in meter along x-axis.

Type

paralleldomain.model.geometry.bounding_box_3d.T

width

Width of box in meter along y-axis.

Type

paralleldomain.model.geometry.bounding_box_3d.T

height

Height of box in meter along z-axis.

Type

paralleldomain.model.geometry.bounding_box_3d.T

class_id

Class ID of annotated object. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D.

num_points

Number of LiDAR points of related Sensor.

attributes

Dictionary of arbitrary object attributes.

property volume: paralleldomain.model.geometry.bounding_box_3d.T

Returns volume of 3D Bounding Box in cubic meter.

Return type

TypeVar(T, int, float)

property vertices: numpy.ndarray

Returns the 3D vertices of a bounding box.

Vertices are returned in the following order:

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

property edges: numpy.ndarray

Returns the 3D edges of a bounding box.

Edges are returned in order of connecting the vertices in the following order:

  • [0, 1]

  • [1, 2]

  • [2, 3]

  • [3, 0]

  • [4, 5]

  • [5, 6]

  • [6, 7]

  • [7, 4]

  • [2, 6]

  • [7, 3]

  • [1, 5]

  • [4, 0]

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

property faces: numpy.ndarray

Returns the 3D faces of a bounding box.

Faces are returned in order of connecting the vertices in the following order:

  • [0, 1, 2, 3] (front)

  • [4, 5, 6, 7] (back)

  • [3, 2, 6, 7] (left)

  • [0, 1, 5, 4] (right)

  • [6, 2, 1, 5] (top)

  • [7, 3, 0, 4] (bottom)

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

classmethod merge_boxes(target_box, source_box)

Takes two 3D box geometries as input and merges both into a new box geometry. The resulting box geometry has dimensions from target_box and source_box merged into it.

Return type

BoundingBox3DBaseGeometry[TypeVar(T, int, float)]

Parameters
class BoundingBox3DGeometry(pose, width, height, length)
property edges: numpy.ndarray

Returns the 3D edges of a bounding box.

Edges are returned in order of connecting the vertices in the following order:

  • [0, 1]

  • [1, 2]

  • [2, 3]

  • [3, 0]

  • [4, 5]

  • [5, 6]

  • [6, 7]

  • [7, 4]

  • [2, 6]

  • [7, 3]

  • [1, 5]

  • [4, 0]

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

property faces: numpy.ndarray

Returns the 3D faces of a bounding box.

Faces are returned in order of connecting the vertices in the following order:

  • [0, 1, 2, 3] (front)

  • [4, 5, 6, 7] (back)

  • [3, 2, 6, 7] (left)

  • [0, 1, 5, 4] (right)

  • [6, 2, 1, 5] (top)

  • [7, 3, 0, 4] (bottom)

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

classmethod merge_boxes(target_box, source_box)

Takes two 3D box geometries as input and merges both into a new box geometry. The resulting box geometry has dimensions from target_box and source_box merged into it.

Return type

BoundingBox3DBaseGeometry[TypeVar(T, int, float)]

Parameters
property vertices: numpy.ndarray

Returns the 3D vertices of a bounding box.

Vertices are returned in the following order:

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

property volume: paralleldomain.model.geometry.bounding_box_3d.T

Returns volume of 3D Bounding Box in cubic meter.

Return type

TypeVar(T, int, float)

class Point2DBaseGeometry(x, y)

Represents a 2D Point.

Parameters
x

coordinate along x-axis in image pixels

Type

paralleldomain.model.geometry.point_2d.T

y

coordinate along y-axis in image pixels

Type

paralleldomain.model.geometry.point_2d.T

class_id

Class ID of the point. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

attributes

Dictionary of arbitrary object attributes.

to_numpy()

Returns the coordinates as a numpy array with shape (1 x 2).

class Point2DGeometry(x, y)
to_numpy()

Returns the coordinates as a numpy array with shape (1 x 2).

class Point3DBaseGeometry(x, y, z)

Represents a 3D Point.

Parameters
x

coordinate along x-axis in sensor coordinates

Type

paralleldomain.model.geometry.point_3d.T

y

coordinate along y-axis in sensor coordinates

Type

paralleldomain.model.geometry.point_3d.T

z

coordinate along z-axis in sensor coordinates

Type

paralleldomain.model.geometry.point_3d.T

class_id

Class ID of the point. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation3D or InstanceSegmentation3D. If unknown defaults to -1.

attributes

Dictionary of arbitrary object attributes.

to_numpy()

Returns the coordinates as a numpy array with shape (1 x 3).

class Point3DGeometry(x, y, z)
to_numpy()

Returns the coordinates as a numpy array with shape (1 x 3).

class Polygon2DBaseGeometry(lines)

A closed polygon made a collection of 2D Lines.

Parameters
lines

Ordered list of Line2DBaseGeometry instances

Type

List[paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]]

class_id

Class ID of the polygon. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

attributes

Dictionary of arbitrary object attributes.

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 2).

class Polygon2DGeometry(lines)
property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 2).

class Polygon3DBaseGeometry(lines)

A closed polygon made a collection of 3D Lines.

Parameters
lines

Ordered list of Line3DBaseGeometry instances

Type

List[paralleldomain.model.geometry.polyline_3d.Line3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]]

class_id

Class ID of the polygon. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation3D or InstanceSegmentation3D. If unknown defaults to -1.

attributes

Dictionary of arbitrary object attributes.

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 3).

class Polygon3DGeometry(lines)
property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 3).

exception CollinearLinesException
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class Line2DBaseGeometry(start, end)

Represents a 2D Line.

Parameters
start

the 2D start point of the line in image coordinates

Type

paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

end

the 2D end point of the line in image coordinates

Type

paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

directed

whether the line is directed from start to end (if False the line is bi-directional)

class_id

Class ID of the line. Can be used to lookup more details in ClassMap.

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

attributes

Dictionary of arbitrary object attributes.

property direction: paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

Returns the directional vector of the line.

Return type

Point2DBaseGeometry[TypeVar(T, int, float)]

property length: float

Returns the length of the line.

Return type

float

property slope: float

Returns the slope of the line. Returns np.inf for vertical lines.

Return type

float

to_numpy()

Returns the start and end coordinates as a numpy array with shape (2 x 2).

intersects_at(other)

Returns the point at which the two lines intersect and a bool value that indicated if the intersection point is within the line segments. Returns None if the lines are parallel. See: https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect

Return type

Tuple[Optional[Point2DBaseGeometry[TypeVar(T, int, float)]], bool, bool]

Parameters

other (paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]) –

class Line2DGeometry(start, end)
property direction: paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

Returns the directional vector of the line.

Return type

Point2DBaseGeometry[TypeVar(T, int, float)]

intersects_at(other)

Returns the point at which the two lines intersect and a bool value that indicated if the intersection point is within the line segments. Returns None if the lines are parallel. See: https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect

Return type

Tuple[Optional[Point2DBaseGeometry[TypeVar(T, int, float)]], bool, bool]

Parameters

other (paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]) –

property length: float

Returns the length of the line.

Return type

float

property slope: float

Returns the slope of the line. Returns np.inf for vertical lines.

Return type

float

to_numpy()

Returns the start and end coordinates as a numpy array with shape (2 x 2).

class Polyline2DBaseGeometry(lines)

A polyline made of a collection of 2D Lines

Parameters

lineslines

lines

Ordered list of Line2D instances

Type

List[paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]]

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 2).

class Polyline2DGeometry(lines)
property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 2).

class Line3DBaseGeometry(start, end)

Represents a 3D Line.

Parameters
start

the 3D start point of the line in image coordinates

Type

paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

end

the 3D end point of the line in image coordinates

Type

paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

property direction: paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

Returns the directional vector of the line.

Return type

Point3DBaseGeometry[TypeVar(T, int, float)]

property length: float

Returns the length of the line.

Return type

float

to_numpy()

Returns the start and end coordinates as a numpy array with shape (2 x 3).

class Line3DGeometry(start, end)
property direction: paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

Returns the directional vector of the line.

Return type

Point3DBaseGeometry[TypeVar(T, int, float)]

property length: float

Returns the length of the line.

Return type

float

to_numpy()

Returns the start and end coordinates as a numpy array with shape (2 x 3).

class Polyline3DBaseGeometry(lines)

A polyline made of a collection of 3D Lines

Parameters

lineslines

lines

Ordered list of Line3DBaseGeometry instances

Type

List[paralleldomain.model.geometry.polyline_3d.Line3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]]

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 3).

class Polyline3DGeometry(lines)
property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 3).