Geometry3D.geometry package

Submodules

Geometry3D.geometry.body module

Geobody module

class Geometry3D.geometry.body.GeoBody[source]

Bases: object

A base class for geometric objects that provides some common methods to work with. In the end, everything is dispatched to Geometry3D.calc.calc.* anyway, but it sometimes feels nicer to write it like L1.intersection(L2) instead of intersection(L1, L2)

angle(other)[source]

return the angle between self and other

distance(other)[source]

return the distance between self and other

intersection(other)[source]

return the intersection between self and other

orthogonal(other)[source]

return if self and other are orthogonal to each other

parallel(other)[source]

return if self and other are parallel to each other

Geometry3D.geometry.line module

Line Module

class Geometry3D.geometry.line.Line(a, b)[source]

Bases: Geometry3D.geometry.body.GeoBody

  • Line(Point, Point):

A Line going through both given points.

  • Line(Point, Vector):

A Line going through the given point, in the direction pointed by the given Vector.

  • Line(Vector, Vector):

The same as Line(Point, Vector), but with instead of the point only the position vector of the point is given.

class_level = 1
move(v)[source]

Return the line that you get when you move self by vector v, self is also moved

parametric()[source]
Returns (s, u) so that you can build the equation for the line

_ _ _

g: x = s + ru ; r e R

classmethod x_axis()[source]

return x axis which is a Line

classmethod y_axis()[source]

return y axis which is a Line

classmethod z_axis()[source]

return z axis which is a Line

Geometry3D.geometry.line.x_axis()

return x axis which is a Line

Geometry3D.geometry.line.y_axis()

return y axis which is a Line

Geometry3D.geometry.line.z_axis()

return z axis which is a Line

Geometry3D.geometry.plane module

Plane module

class Geometry3D.geometry.plane.Plane(*args)[source]

Bases: Geometry3D.geometry.body.GeoBody

  • Plane(Point, Point, Point):

Initialise a plane going through the three given points.

  • Plane(Point, Vector, Vector):

Initialise a plane given by a point and two vectors lying on the plane.

  • Plane(Point, Vector):

Initialise a plane given by a point and a normal vector (point normal form)

  • Plane(a, b, c, d):

Initialise a plane given by the equation ax1 + bx2 + cx3 = d (general form).

class_level = 2
general_form()[source]

Returns (a, b, c, d) so that you can build the equation

E: ax1 + bx2 + cx3 = d

to describe the plane.

move(v)[source]

Return the plane that you get when you move self by vector v, self is also moved

parametric()[source]
Returns (u, v, w) so that you can build the equation

_ _ _ _

E: x = u + rv + sw ; (r, s) e R

to describe the plane (a point and two vectors).

point_normal()[source]
Returns (p, n) so that you can build the equation

_ _

E: (x - p) n = 0

to describe the plane.

classmethod xy_plane()[source]

return xy plane which is a Plane

classmethod xz_plane()[source]

return xz plane which is a Plane

classmethod yz_plane()[source]

return yz plane which is a Plane

Geometry3D.geometry.plane.xy_plane()

return xy plane which is a Plane

Geometry3D.geometry.plane.yz_plane()

return yz plane which is a Plane

Geometry3D.geometry.plane.xz_plane()

return xz plane which is a Plane

Geometry3D.geometry.point module

Point Module

class Geometry3D.geometry.point.Point(*args)[source]

Bases: object

  • Point(a, b, c)

  • Point([a, b, c]):

The point with coordinates (a | b | c)

  • Point(Vector):

The point that you get when you move the origin by the given vector. If the vector has coordinates (a | b | c), the point will have the coordinates (a | b | c) (as easy as pi).

class_level = 0
distance(other)[source]

Return the distance between self and other

move(v)[source]

Return the point that you get when you move self by vector v, self is also moved

classmethod origin()[source]

Returns the Point (0 | 0 | 0)

pv()[source]

Return the position vector of the point.

Geometry3D.geometry.point.origin()

Returns the Point (0 | 0 | 0)

Geometry3D.geometry.polygen module

Polygen Module

class Geometry3D.geometry.polygen.ConvexPolygen(pts, reverse=False, check_convex=False)[source]

Bases: Geometry3D.geometry.body.GeoBody

  • ConvexPolygens(points)

points: a tuple of points.

The points needn’t to be in order.

The convexity should be guaranteed. This function will not check the convexity. If the Polygen is not convex, there might be errors.

classmethod Parallelogram(base_point, v1, v2)[source]

A special function for creating Parallelogram

Input:

  • base_point: a Point

  • v1, v2: two Vectors

Output:

  • A parallelogram which is a ConvexPolygen instance.

area()[source]

Input:

  • self

Output:

  • The area of the convex polygen

class_level = 4
eq_with_normal(other)[source]

return whether self equals with other considering the normal

hash_with_normal()[source]

return the hash value considering the normal

in_(other)[source]

Input:

  • self: ConvexPolygen

  • other: Plane

Output:

  • whether self in other

length()[source]

return the total length of ConvexPolygen

move(v)[source]

Return the ConvexPolygen that you get when you move self by vector v, self is also moved

segments()[source]

Input:

  • self

Output:

  • iterator of segments

Geometry3D.geometry.polygen.Parallelogram(base_point, v1, v2)

A special function for creating Parallelogram

Input:

  • base_point: a Point

  • v1, v2: two Vectors

Output:

  • A parallelogram which is a ConvexPolygen instance.

Geometry3D.geometry.polyhedron module

Polyhedron Module

class Geometry3D.geometry.polyhedron.ConvexPolyhedron(convex_polygens)[source]

Bases: Geometry3D.geometry.body.GeoBody

classmethod Parallelepiped(base_point, v1, v2, v3)[source]

A special function for creating Parallelepiped

Input:

  • base_point: a Point

  • v1, v2, v3: three Vectors

Output:

  • A parallelepiped which is a ConvexPolyhedron instance.

area()[source]

return the total area of the polyhedron

class_level = 5

Input:

  • convex_polygens: tuple of ConvexPolygens

Output:

  • ConvexPolyhedron

  • The correctness of convex_polygens are checked According to Euler’s formula.

  • The normal of the convex polygens are checked and corrected which should be toward the outer direction

length()[source]

return the total length of the polyhedron

move(v)[source]

Return the ConvexPolyhedron that you get when you move self by vector v, self is also moved

volume()[source]

return the total volume of the polyhedron

Geometry3D.geometry.polyhedron.Parallelepiped(base_point, v1, v2, v3)

A special function for creating Parallelepiped

Input:

  • base_point: a Point

  • v1, v2, v3: three Vectors

Output:

  • A parallelepiped which is a ConvexPolyhedron instance.

Geometry3D.geometry.pyramid module

Pyramid Module

class Geometry3D.geometry.pyramid.Pyramid(cp, p, direct_call=True)[source]

Bases: Geometry3D.geometry.body.GeoBody

Input:

  • cp: a ConvexPolygen

  • p: a Point

height()[source]

return the height of the pyramid

volume()[source]

return the volume of the pryamid

Geometry3D.geometry.segment module

Segment Module

class Geometry3D.geometry.segment.Segment(a, b)[source]

Bases: Geometry3D.geometry.body.GeoBody

Input:

  • Segment(Point,Point)

  • Segment(Point,Vector)

class_level = 3
in_(other)[source]

other can be plane or line

length()[source]

retutn the length of the segment

move(v)[source]

Return the Segment that you get when you move self by vector v, self is also moved

parametric()[source]

Returns (start_point, end_point) so that you can build the information for the segment

Module contents

class Geometry3D.geometry.ConvexPolyhedron(convex_polygens)[source]

Bases: Geometry3D.geometry.body.GeoBody

classmethod Parallelepiped(base_point, v1, v2, v3)[source]

A special function for creating Parallelepiped

Input:

  • base_point: a Point

  • v1, v2, v3: three Vectors

Output:

  • A parallelepiped which is a ConvexPolyhedron instance.

area()[source]

return the total area of the polyhedron

class_level = 5

Input:

  • convex_polygens: tuple of ConvexPolygens

Output:

  • ConvexPolyhedron

  • The correctness of convex_polygens are checked According to Euler’s formula.

  • The normal of the convex polygens are checked and corrected which should be toward the outer direction

length()[source]

return the total length of the polyhedron

move(v)[source]

Return the ConvexPolyhedron that you get when you move self by vector v, self is also moved

volume()[source]

return the total volume of the polyhedron

Geometry3D.geometry.Parallelepiped(base_point, v1, v2, v3)

A special function for creating Parallelepiped

Input:

  • base_point: a Point

  • v1, v2, v3: three Vectors

Output:

  • A parallelepiped which is a ConvexPolyhedron instance.

class Geometry3D.geometry.ConvexPolygen(pts, reverse=False, check_convex=False)[source]

Bases: Geometry3D.geometry.body.GeoBody

  • ConvexPolygens(points)

points: a tuple of points.

The points needn’t to be in order.

The convexity should be guaranteed. This function will not check the convexity. If the Polygen is not convex, there might be errors.

classmethod Parallelogram(base_point, v1, v2)[source]

A special function for creating Parallelogram

Input:

  • base_point: a Point

  • v1, v2: two Vectors

Output:

  • A parallelogram which is a ConvexPolygen instance.

area()[source]

Input:

  • self

Output:

  • The area of the convex polygen

class_level = 4
eq_with_normal(other)[source]

return whether self equals with other considering the normal

hash_with_normal()[source]

return the hash value considering the normal

in_(other)[source]

Input:

  • self: ConvexPolygen

  • other: Plane

Output:

  • whether self in other

length()[source]

return the total length of ConvexPolygen

move(v)[source]

Return the ConvexPolygen that you get when you move self by vector v, self is also moved

segments()[source]

Input:

  • self

Output:

  • iterator of segments

Geometry3D.geometry.Parallelogram(base_point, v1, v2)

A special function for creating Parallelogram

Input:

  • base_point: a Point

  • v1, v2: two Vectors

Output:

  • A parallelogram which is a ConvexPolygen instance.

class Geometry3D.geometry.Pyramid(cp, p, direct_call=True)[source]

Bases: Geometry3D.geometry.body.GeoBody

Input:

  • cp: a ConvexPolygen

  • p: a Point

height()[source]

return the height of the pyramid

volume()[source]

return the volume of the pryamid

class Geometry3D.geometry.Segment(a, b)[source]

Bases: Geometry3D.geometry.body.GeoBody

Input:

  • Segment(Point,Point)

  • Segment(Point,Vector)

class_level = 3
in_(other)[source]

other can be plane or line

length()[source]

retutn the length of the segment

move(v)[source]

Return the Segment that you get when you move self by vector v, self is also moved

parametric()[source]

Returns (start_point, end_point) so that you can build the information for the segment

class Geometry3D.geometry.Line(a, b)[source]

Bases: Geometry3D.geometry.body.GeoBody

  • Line(Point, Point):

A Line going through both given points.

  • Line(Point, Vector):

A Line going through the given point, in the direction pointed by the given Vector.

  • Line(Vector, Vector):

The same as Line(Point, Vector), but with instead of the point only the position vector of the point is given.

class_level = 1
move(v)[source]

Return the line that you get when you move self by vector v, self is also moved

parametric()[source]
Returns (s, u) so that you can build the equation for the line

_ _ _

g: x = s + ru ; r e R

classmethod x_axis()[source]

return x axis which is a Line

classmethod y_axis()[source]

return y axis which is a Line

classmethod z_axis()[source]

return z axis which is a Line

class Geometry3D.geometry.Plane(*args)[source]

Bases: Geometry3D.geometry.body.GeoBody

  • Plane(Point, Point, Point):

Initialise a plane going through the three given points.

  • Plane(Point, Vector, Vector):

Initialise a plane given by a point and two vectors lying on the plane.

  • Plane(Point, Vector):

Initialise a plane given by a point and a normal vector (point normal form)

  • Plane(a, b, c, d):

Initialise a plane given by the equation ax1 + bx2 + cx3 = d (general form).

class_level = 2
general_form()[source]

Returns (a, b, c, d) so that you can build the equation

E: ax1 + bx2 + cx3 = d

to describe the plane.

move(v)[source]

Return the plane that you get when you move self by vector v, self is also moved

parametric()[source]
Returns (u, v, w) so that you can build the equation

_ _ _ _

E: x = u + rv + sw ; (r, s) e R

to describe the plane (a point and two vectors).

point_normal()[source]
Returns (p, n) so that you can build the equation

_ _

E: (x - p) n = 0

to describe the plane.

classmethod xy_plane()[source]

return xy plane which is a Plane

classmethod xz_plane()[source]

return xz plane which is a Plane

classmethod yz_plane()[source]

return yz plane which is a Plane

class Geometry3D.geometry.Point(*args)[source]

Bases: object

  • Point(a, b, c)

  • Point([a, b, c]):

The point with coordinates (a | b | c)

  • Point(Vector):

The point that you get when you move the origin by the given vector. If the vector has coordinates (a | b | c), the point will have the coordinates (a | b | c) (as easy as pi).

class_level = 0
distance(other)[source]

Return the distance between self and other

move(v)[source]

Return the point that you get when you move self by vector v, self is also moved

classmethod origin()[source]

Returns the Point (0 | 0 | 0)

pv()[source]

Return the position vector of the point.

Geometry3D.geometry.origin()

Returns the Point (0 | 0 | 0)

Geometry3D.geometry.x_axis()

return x axis which is a Line

Geometry3D.geometry.y_axis()

return y axis which is a Line

Geometry3D.geometry.z_axis()

return z axis which is a Line

Geometry3D.geometry.xy_plane()

return xy plane which is a Plane

Geometry3D.geometry.yz_plane()

return yz plane which is a Plane

Geometry3D.geometry.xz_plane()

return xz plane which is a Plane