Geometric Objects¶
Geometrical Objects in Two Dimensions¶

class
Line2
¶ 
class
Line2
(from, to) 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.

At
(t)¶ Returns the point on the line at (signed) distance t from origin.
Parameters: t (float) – free parameter Return type: Vec2

GetDirection
()¶ Returns the normalized direction vector. Also available as
direction
.Return type: Vec2

direction
¶

origin
¶


class
Rectangle2
¶ 
class
Rectangle2
(top_left, bottom_right) Axis aligned rectangle. The first signature creates a rectangle with topleft corner (1, 1) and bottomright corner (1, 1), wheras the second method allows to set the topleft and bottomright corners directly.
Parameters: 
width
¶ Type: float

height
¶ Type: float

SetStart
(top_left)¶ Set topleft corner, leaving the bottomright corner untouched.

SetEnd
(bottom_right)¶ Set the bottomright corner, leaving the topleft corner untouched.


class
Circle2
¶ 
class
Circle2
(circle) 
class
Circle2
(center, radius) 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.

SetRadius
(radius)¶ Set radius of circle
Parameters: center – The new radius

GetCenter
()¶ Returns the center of the circle

GetRadius
()¶ Returns the radius of the circle

GetArea
()¶ Returns the area of the circle

GetCircumference
()¶ Returns the circumference of the circle


class
Ellipse2
¶ 
class
Ellipse2
(center, a, b, gamma) An ellipse is defined by a center, two principal axis and gamma that defines the angle between the first principal axis an the xaxis.

At
(t)¶ ?

AtAngle
(angle)¶ ?

GetBoundingBox
()¶ Returns the bounding rectangle (axisaligned) of the ellipse
Return type: Rectangle2

GetA
()¶ Returns the first principalaxis

GetB
()¶ Returns the second principalaxis

GetGamma
()¶ Returns the angle of the first principal axis to the xaxis

GetArea
()¶ Returns the area of the ellipse

GetOrigin
()¶ Returns the center of the ellipse

SetA
(a)¶ Set the length of the first principal axis

SetB
(b)¶ Set the length of the second principal axis

SetGamma
(gamma)¶ Set the angle of the first principal axis to the xaxis

SetOrigin
(ori)¶ Set the center of the ellipse

Geometrical Objects in Three Dimensions¶

class
Line3
¶ 
class
Line3
(from, to) 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.

At
(t)¶ Returns the point on the line at (signed) distance t from origin.
Parameters: t (float) – free parameter Return type: Vec3


class
Plane
¶ 
class
Plane
(p1, p2, p3) 
class
Plane
(x, y, z, p) 
class
Plane
(line, point) 
class
Plane
(point, normal) A plane in 3dspace. 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.

GetP
()¶ Returns the plane offset, i.e. the projection of any point on the plane onto the normal. Also available as
p
.Return type: float

p
¶ Type: float


class
Sphere
¶ 
class
Sphere
(center, radius) 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.
Parameters:  center (
Vec3
) – The center  radius (float) – The radius

radius
¶ The radius of the sphere. Readwrite. Also available as
GetRadius()
,SetRadius()
.Type: float

origin
¶ The center of the sphere. Readwrite. Also available as
GetOrigin()
,SetOrigin()
.Type: Vec3
 center (

class
AlignedCuboid
(min, max)¶ 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
Cuboid
.

class
CuboidAxis
¶ 
class
CuboidAxis
(dir, half_extent) A cuboid axis is defined by a halfextent, and a direction vector. This class is used in together with the
Cuboid
class.Parameters:  dir (
Vec3
) – Direction vector, will be normalized  half_extent (float) – The half extent

vector
¶ The normalized direction vector of the cuboid axis. Also available as
GetVector()
Type: Vec3

half_extent
¶ The half extent of the cuboid axis is the magnitude of the cuboid axis measured from the center to the corner. Also available as
GetHalfExtent()
Type: float

extent
¶ The extent of the cuboid axis. This value is always twice the
half_extent
. Readonly. Also available asGetExtent()
.Type: float

GetHalfExtent
()¶ See
half_extent
 dir (

class
Cuboid
(center, axis_a, axis_b, axis_c)¶ 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 righthanded coordinate system. If a righthanded 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)
Parameters:  center (
Vec3
) – The center  axis_a (
CuboidAxis
) – The first axis  axis_b (
CuboidAxis
) – The second axis  axis_c (
CuboidAxis
) – The third axis

axis_a
¶ The first cuboid axis
Type: CuboidAxis

axis_b
¶ The second cuboid axis
Type: CuboidAxis

axis_c
¶ The third cuboid axis
Type: CuboidAxis
 center (
Operations on Geometrical Objects¶

Angle
(lhs, rhs)¶ Calculate the angle (in radians) between lhs and rhs.
Parameters: Return type: float

IntersectionPoint
(lhs, rhs)¶ Calculates and returns the intersection point between lhs and rhs
Parameters: Raises: GeomException
when the two objects do not intersectReturn type:

IntersectionLine
(plane2, plane2)¶ Returns the intersection line between plane1 and plane2.
Parameters: Raises: :exc:GeomException if the two planes are parallel.

Distance
(lhs, rhs)¶ Returns the minimal distance between lhs and rhs.
Parameters: Return type: float

IsOnLine
(line, point, epsilon=geom.EPSILON)¶ Check whether point lies on line and returns true if point i no further away than epsilon.
Return type: bool

IsInPlane
(plane, object, epsilon=geom.EPSILON)¶ Check whether object lies in plane and returns true if the difference is no bigger than epsilon.
Parameters: Return type: bool

AreParallel
(lhs, rhs, epsilon=geom.EPSILON)¶ Check whether lhs and rhs are parallel and returns true, if the difference is below the given treshold epsilon.
Parameters: Return type: bool

AreIntersecting
(line1, line2, epsilon=geom.EPSILON)¶ Check whether line1 and line2 are intersecting and returns true, if they intersect below the given threshold epsilon.
Parameters: Return type: bool

IsInSphere
(sphere, point)¶ Check whether the sphere contains point.
Return type: bool

MinDistance
(list1, list2)¶ Calculate the minimal distance between two sets of points
Parameters:  list1 (
Vec3List
) – the first set of points  list2 (
Vec3List
) – the second set of points
 list1 (