Skip to content
Snippets Groups Projects
composite.rst 12.93 KiB

Geometric Objects

Geometrical Objects in Two Dimensions

Parametric line in two dimensions as defined by an origin and a normalized direction vector. The first constructor creates a line with origin (0,0) and direction along the x axis. The second signature creates a line originating from from and pointing towards to.

Axis aligned rectangle. The first signature creates a rectangle with top-left corner (-1, -1) and bottom-right corner (1, 1), wheras the second method allows to set the top-left and bottom-right corners directly.

type top_left: :class:`Vec2`
param top_left: The top-left corner
param bottom_right: The bottom-right corner
type bottom_right: :class:`Vec2`

The first signature creates a circle centered at (0, 0) and radius 1.0. The second signature creates a circle with the same paramters as circle. The third signature creates a new circle with given center and radius.

An ellipse is defined by a center, two principal axis and gamma that defines the angle between the first principal axis an the x-axis.

Geometrical Objects in Three Dimensions

Parametric line in three dimensions as defined by an origin and a normalized direction vector. The first constructor creates a line with origin (0,0) and direction along the x axis. The second signature creates a line originating from from and pointing towards to.

A plane in 3d-space. The plane can be constructed by either passing in 3 points (p1, p2, p3), a normal and a point, the four parameters that define the implicit plane equation (x, y, z, p) or a line and a point.

Represents a sphere in 3d space. The first constructor creates a sphere with radius 1, centered at (0, 0, 0), the second allows you to set the radius and center directly.

param center: The center
type center: :class:`Vec3`
param radius: The radius
type radius: float

Axis aligned cuboid is a cuboid whose axes are aligned to the x-, y-, and z- axes of the coordinate system. For arbitrarily oriented bounding cuboid class, see :class:`Cuboid`.

A cuboid axis is defined by a half-extent, and a direction vector. This class is used in together with the :class:`Cuboid` class.

param dir: Direction vector, will be normalized
type dir: :class:`Vec3`
param half_extent: The half extent
type half_extent: float

An arbitrarily oriented cuboid defined by a center and 3 axis. The 3 cuboid axis are stored in the order they are passed to the constructor. This means, that there is no guarantee that the 3 axes form a right-handed coordinate system. If a right-handed coordinate system is a requirement, you have to ensure this on your own:

center=...
axis_a=geom.CuboidAxis(...)
axis_b=geom.CuboidAxis(...)
axis_c=geom.CuboidAxis(geom.Cross(axis_a.vector, axis_b.vector), ...)

cuboid=geom.Cuboid(center, axis_a, axis_b, axis_c)
param center: The center
type center: :class:`Vec3`
param axis_a: The first axis
type axis_a: :class:`CuboidAxis`
param axis_b: The second axis
type axis_b: :class:`CuboidAxis`
param axis_c: The third axis
type axis_c: :class:`CuboidAxis`

Operations on Geometrical Objects