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 ArcBSplineCurveWithKnots(degree, control_points, knot_multiplicities, knots, start, end, n=5)[source]

Bases: pylib.geometry.Polyline

B-spline curve with knots, an open wireframe object in local coordinate system

class ArcCircle(radius=1, ang1=0, ang2=1.5707963267948966, n=None)[source]

Bases: pylib.geometry.Polyline

Arc of a circle, an open wireframe object in local coordinate system

class ArcEllipse(a=1, b=1, ang1=0, ang2=1.5707963267948966, n=None)[source]

Bases: pylib.geometry.Polyline

Arc of an ellipse, an open wireframe object in local coordinate system

class B_spline_curve_with_knots(degree, control_points, knot_multiplicities, knots, n=5)[source]

Bases: pylib.geometry.Polyline

B-spline curve with knots, an open wireframe object in local coordinate system

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

Bases: pylib.mathematics.matrix

Coordinate system

get_coordinates()[source]

Get coordinates in 3d space

classmethod init_xyz(x=[1, 0, 0], y=[0, 1, 0], z=[0, 0, 1])[source]
classmethod x90()[source]
classmethod xm90()[source]
classmethod y90()[source]
classmethod ym90()[source]
class Circle(radius=1, n=None)[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

classmethod cross(a, b)[source]

Cross product

c is orthogonal to both a and b. The direction of c can be found with the right-hand rule.

\[\mathbf{c} = \mathbf{a} \times \mathbf{b}\]
class Ellipse(a=1, b=1, n=None)[source]

Bases: pylib.geometry.Polygon

Circle, a closed wireframe object 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.Polyline

Line, an 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.Polyline

Polygon as closed wireframe object in local coordinate system

class Polyline(*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

__repr__()[source]

Return repr(self).

__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 Properties[source]

Bases: object

circle_sectors = 12
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 World[source]

Bases: object

World-space with world-space coordinates

__iter__()[source]

Returns the Iterator object

__str__()[source]

Return str(self).

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]
sample_half_open(f, a, b, n=50, endpoint_epsilon=1e-07)[source]