bspy.manifold
A manifold is an abstract base class for differentiable functions with normals and tangent spaces whose range is one dimension higher than their domain.
Parameters
- metadata (
dict
, optional): A dictionary of ancillary data to store with the manifold. Default is {}.
If two points are within minSeparation of each each other, they are coincident.
Factory dictionary for creating manifolds.
Intersect two manifolds, caching the result for twins (same intersection but swapping self and other).
Parameters
- other (
Manifold
): TheManifold
intersecting the manifold. - cache (
dict
, optional): A dictionary to cacheManifold
intersections, speeding computation. The default isNone
.
Returns
intersections (
list
(orNotImplemented
if other is an unknown type of Manifold)): A list of intersections between the two manifolds. Each intersection records either a crossing or a coincident region.For a crossing, intersection is a Manifold.Crossing: (left, right)
- left :
Manifold
in the manifold's domain where the manifold and the other cross. - right :
Manifold
in the other's domain where the manifold and the other cross. - Both intersection manifolds have the same domain and range (the crossing between the manifold and the other).
For a coincident region, intersection is Manifold.Coincidence: (left, right, alignment, transform, inverse, translation)
- left :
Solid
in the manifold's domain within which the manifold and the other are coincident. - right :
Solid
in the other's domain within which the manifold and the other are coincident. - alignment : scalar value holding the normal alignment between the manifold and the other (the dot product of their unit normals).
- transform :
numpy.array
holding the matrix transform from the boundary's domain to the other's domain. - inverse :
numpy.array
holding the matrix inverse transform from the other's domain to the boundary's domain. - translation :
numpy.array
holding the 1D translation from the manifold's domain to the other's domain. - Together transform, inverse, and translation form the mapping from the manifold's domain to the other's domain and vice-versa.
- left :
- isTwin (
bool
): True if this intersection is the twin from the cache (the intersection with self and other swapped).
See Also
intersect
: Intersect two manifolds.
Solid.slice
: slice the solid by a manifold.
Notes
To invert the mapping to go from the other's domain to the manifold's domain, you first subtract the translation and then multiply by the inverse of the transform.
Add any missing inherent (implicit) boundaries of this manifold's domain to the given slice of the given solid that are needed to make the slice valid and complete.
Parameters
- slice (
Solid
): The slice of the given solid formed by the manifold. The slice may be incomplete, missing some of the manifold's inherent domain boundaries. Its dimension must matchself.domain_dimension()
. - solid (
Solid
): The solid being sliced by the manifold. Its dimension must matchself.range_dimension()
.
See Also
Solid.slice
: Slice the solid by a manifold.
Notes
For manifolds without inherent domain boundaries (like hyperplanes), the operation does nothing.
Return the value of the manifold (a point on the manifold).
Parameters
- domainPoint (
numpy.array
): The 1D array at which to evaluate the point.
Returns
- point (
numpy.array
):
Flip the direction of the normal.
Returns
- manifold (
Manifold
): The manifold with flipped normal. The manifold retains the same tangent space.
See Also
Solid.complement
: Return the complement of the solid: whatever was inside is outside and vice-versa.
Return a solid that represents the full domain of the manifold.
Returns
- domain (
Solid
): The full (untrimmed) domain of the manifold.
See Also
Boundary
: A portion of the boundary of a solid.
Intersect two manifolds (self and other).
Parameters
Returns
intersections (
list
(orNotImplemented
if other is an unknown type of Manifold)): A list of intersections between the two manifolds. Each intersection records either a crossing or a coincident region.For a crossing, intersection is a
Manifold.Crossing
: (left, right)- left :
Manifold
in the manifold's domain where the manifold and the other cross. - right :
Manifold
in the other's domain where the manifold and the other cross. - Both intersection manifolds have the same domain and range (the crossing between the manifold and the other).
For a coincident region, intersection is a
Manifold.Coincidence
: (left, right, alignment, transform, inverse, translation)- left :
Solid
in the manifold's domain within which the manifold and the other are coincident. - right :
Solid
in the other's domain within which the manifold and the other are coincident. - alignment : scalar value holding the normal alignment between the manifold and the other (the dot product of their unit normals).
- transform :
numpy.array
holding the transform matrix from the manifold's domain to the other's domain. - inverse :
numpy.array
holding the inverse transform matrix from the other's domain to the boundary's domain. - translation :
numpy.array
holding the translation vector from the manifold's domain to the other's domain. - Together transform, inverse, and translation form the mapping from the manifold's domain to the other's domain and vice-versa.
- left :
See Also
cached_intersect
: Intersect two manifolds, caching the result for twins (same intersection but swapping self and other).
Solid.slice
: slice the solid by a manifold.
Notes
To invert the mapping to go from the other's domain to the manifold's domain, you first subtract the translation and then multiply by the inverse of the transform.
Return the normal.
Parameters
- domainPoint (
numpy.array
): The 1D array at which to evaluate the normal. - normalize (
boolean
, optional): If True the returned normal will have unit length (the default). Otherwise, the normal's length will be the area of the tangent space (for two independent variables, its the length of the cross product of tangent vectors). - indices (
iterable
, optional): An iterable of normal indices to calculate. For example,indices=(0, 3)
will return a vector of length 2 with the first and fourth values of the normal. IfNone
, all normal values are returned (the default).
Returns
- normal (
numpy.array
):
Return the range bounds for the manifold.
Returns
- rangeBounds (
np.array
orNone
): The range of the manifold given as lower and upper bounds on each dependent variable. If the manifold has an unbounded range,None
is returned.
Return the tangent space.
Parameters
- domainPoint (
numpy.array
): The 1D array at which to evaluate the tangent space.
Returns
- tangentSpace (
numpy.array
):
Transform the range of the manifold.
Parameters
- matrix (
numpy.array
): A square matrix transformation. - matrixInverseTranspose (
numpy.array
, optional): The inverse transpose of matrix (computed if not provided).
Returns
- manifold (
Manifold
): The transformed manifold.
See Also
Solid.transform
: transform the range of the solid.
Translate the range of the manifold.
Parameters
- delta (
numpy.array
): A 1D array translation.
Returns
- manifold (
Manifold
): The translated manifold.
See Also
Solid.translate
: translate the range of the solid.
Return the trimmed range bounds for the manifold.
Parameters
- domainBounds (array-like): An array with shape (domain_dimension, 2) of lower and upper and lower bounds on each manifold parameter.
Returns
- trimmedManifold, rangeBounds (
Manifold
,np.array
): A manifold trimmed to the given domain bounds, and the range of the trimmed manifold given as lower and upper bounds on each dependent variable.
Notes
The returned trimmed manifold may be the original manifold, depending on the subclass of manifold.
Crossing(left, right)
Return type for intersect.
Inherited Members
- builtins.tuple
- index
- count