pylib.geometry module

Geometry objects.

Date

2019-12-21

Affine transforms

Functions in augmented space, in homogenous coordinates. Points are augment to 4 dimensions, by adding a dummy coordinate. For points the dummy coordinate is always normalized to 1. With homogenous coordinates translation of points is repesentable as a linear transformation.

class CS(x=[1, 0, 0], y=[0, 1, 0], z=[0, 0, 1])[source]

Bases: pylib.mathematics.matrix

Coordinate system

get_coordinates()[source]

Get coordinates in 3d space

static x90()[source]
static xm90()[source]
static y90()[source]
static ym90()[source]
class Circle(radius=1, n=10)[source]

Bases: pylib.geometry.Polygon

Circle a closed wireframe object in local coordinate system

class Direction(x=1, y=0, z=0)[source]

Bases: pylib.mathematics.vector

Direction in local coordinate system

class Hexahedron(point1=vector([-1, -1, -1, 1]), point2=vector([1, -1, -1, 1]), point3=vector([1, 1, -1, 1]), point4=vector([-1, 1, -1, 1]), point5=vector([-1, -1, 1, 1]), point6=vector([1, -1, 1, 1]), point7=vector([1, 1, 1, 1]), point8=vector([-1, 1, 1, 1]))[source]

Bases: pylib.geometry.Solid

Line a open wireframe object in local coordinate system

class Line(point1=vector([-1, 0, 0, 1]), point2=vector([1, 0, 0, 1]))[source]

Bases: pylib.geometry.Wireframe

Line a open wireframe object in local coordinate system

class Point(x=0, y=0, z=0)[source]

Bases: pylib.mathematics.vector

Point in local coordinate system

projection()[source]

Orthographic projection to the xy-plane

class Polygon(*points)[source]

Bases: pylib.geometry.Wireframe

Polygon as closed wireframe object in local coordinate system

class Solid(*wireframes)[source]

Bases: object

Solid object in local coordinate system

This class lists Wireframe objects. The Wireframe class create its own points (copy).

ch_cs(cs)[source]
scale(sx, sy=None, sz=None)[source]
translate(tx, ty, tz)[source]
wireframes()[source]
class Wireframe(*points, closed=False)[source]

Bases: object

Open and closed wireframe object in local coordinate system

This class create its own points (copy).

__iter__()[source]

Returns the Iterator object

__str__()[source]

Return str(self).

ch_cs(cs)[source]
points()[source]

Get coordinates in 3d space

rotate_x(theta)[source]
rotate_y(theta)[source]
rotate_z(theta)[source]
scale(sx, sy=None, sz=None)[source]
translate(tx, ty, tz)[source]
xy()[source]

Get coordinates in 3d space

xyz()[source]

Get coordinates in 3d space

class World[source]

Bases: object

World-space with world-space coordinates

__iter__()[source]

Returns the Iterator object

add(*objects)[source]
bounding_box()[source]
center()[source]
ch_cs(cs)[source]
cs(cs=None)[source]
objects()[source]
rotate_x(theta)[source]
rotate_y(theta)[source]
rotate_z(theta)[source]
scale(sx, sy=None, sz=None)[source]
space_diagonal()[source]
translate(tx, ty, tz)[source]
wireframes()[source]
wireframes_xy()[source]
wireframes_xyz()[source]