You are reading the documentation for version 1.0 of OpenStructure. You may also want to read the documentation for:
1.1
devel
Geometric Objects
Geometrical Objects in Two Dimensions
-
class ost.geom.Line2
-
class ost.geom.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
|
-
GetOrigin()
Returns the origin of the line: Also available as origin.
-
GetDirection()
Returns the normalized direction vector. Also available as
direction.
-
direction
-
origin
-
class ost.geom.Rectangle2
-
class ost.geom.Rectangle2(top_left, bottom_right)
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.
| Parameters: |
- top_left (Vec2) – The top-left corner
- bottom_right (Vec2) – The bottom-right corner
|
-
GetWidth()
Returns the width of the rectangle. Also available as width.
-
GetHeight()
Returns the height of the rectangle. Also available as height.
-
width
-
-
height
-
-
GetStart()
Get top-left corner
-
GetEnd()
Get bottom-right corner
-
SetStart(top_left)
Set top-left corner, leaving the bottom-right corner untouched.
-
SetEnd(bottom_right)
Set the bottom-right corner, leaving the top-left corner untouched.
-
class ost.geom.Circle2
-
class ost.geom.Circle2(circle)
-
class ost.geom.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.
-
SetCenter(center)
Set center of circle
| Parameters: |
- center (Vec2) – The new center
|
-
SetRadius(radius)
Set radius of circle
-
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 ost.geom.Ellipse2
-
class ost.geom.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 x-axis.
-
At(t)
?
-
AtAngle(angle)
?
-
GetBoundingBox()
Returns the bounding rectangle (axis-aligned) of the ellipse
-
GetA()
Returns the first principal-axis
-
GetB()
Returns the second principal-axis
-
GetGamma()
Returns the angle of the first principal axis to the x-axis
-
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 x-axis
-
SetOrigin(ori)
Set the center of the ellipse
Geometrical Objects in Three Dimensions
-
class ost.geom.Line3
-
class ost.geom.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
|
-
GetOrigin()
Returns the origin of the line: Also available as origin.
-
GetDirection()
Returns the normalized direction vector. Also available as
direction.
-
direction
-
-
origin
-
-
class ost.geom.Plane
-
class ost.geom.Plane(p1, p2, p3)
-
class ost.geom.Plane(x, y, z, p)
-
class ost.geom.Plane(line, point)
-
class ost.geom.Plane(point, normal)
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.
-
GetNormal()
Returns the normal of the plane. Also available as normal
-
GetP()
Returns the plane offset, i.e. the projection of any point on the plane onto
the normal. Also available as p.
-
GetOrigin()
Get the origin of the plane. Also available as origin.
-
origin
-
-
normal
-
-
p
-
-
class ost.geom.Sphere
-
class ost.geom.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. Read-write. Also available as GetRadius(),
SetRadius().
-
origin
The center of the sphere. Read-write. Also available as GetOrigin(),
SetOrigin().
-
GetOrigin()
See origin
-
SetOrigin(origin)
See origin
-
GetRadius()
See radius
-
SetRadius(radius)
See radius
-
class ost.geom.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.
-
GetMin()
Get minimum coordinate, i.e. the lower bound of x-, y-, and z for
any point in the cuboid
-
GetMax()
Get maximum coordinate, i.e. the upper bound of x-, y-, and z for
any point in the cuboid.
-
class ost.geom.CuboidAxis
-
class ost.geom.CuboidAxis(dir, half_extent)
A cuboid axis is defined by a half-extent, 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()
-
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()
-
extent
The extent of the cuboid axis. This value is always twice the
half_extent. Read-only. Also available as
GetExtent().
-
GetHalfExtent()
See half_extent
-
GetExtent()
See extent
-
GetVector()
See vector
-
class ost.geom.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 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)
-
center
The center of the cuboid.
-
axis_a
The first cuboid axis
-
axis_b
The second cuboid axis
-
axis_c
The third cuboid axis
Operations on Geometrical Objects
-
ost.geom.Angle(lhs, rhs)
Calculate the angle (in radians) between lhs and rhs.
| Parameters: |
|
| Return type: | float
|
-
ost.geom.IntersectionPoint(lhs, rhs)
Calculates and returns the intersection point between lhs and rhs
| Parameters: |
|
| Raises : | GeomException when the two objects do not intersect
|
| Return type: | Vec3 (Vec2 in case of Line2)
|
-
ost.geom.IntersectionLine(plane2, plane2)
Returns the intersection line between plane1 and plane2.
| Parameters: |
- plane1 (Plane) – The first plane
- plane2 (Plane) – The second plane
|
| Raises : | :exc:GeomException if the two planes are parallel.
|
-
ost.geom.Distance(lhs, rhs)
Returns the minimal distance between lhs and rhs.
| Parameters: |
|
| Return type: | float
|
-
ost.geom.IsOnLine(line, point, epsilon=geom.EPSILON)
Check whether point lies on line and returns true if point i no further
away than epsilon.
-
ost.geom.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
|
-
ost.geom.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
|
-
ost.geom.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
|
-
ost.geom.IsInSphere(sphere, point)
Check whether the sphere contains point.
|
Contents
Search
Enter search terms or a module, class or function name.
Previous topic
Matrices
Next topic
mol – Molecular structures and surfaces
You are here
|