public final class EmbeddingPlane extends Plane implements EmbeddingHyperplane<Vector3D,Vector2D>
Plane
class that supports embedding of 2D subspaces in the plane.
This is accomplished by defining two additional vectors, u
and v
,
that define the x
and y
axes respectively of the embedded subspace. For completeness,
an additional vector getW()
is defined, which is simply an alias for the plane normal.
Together, the vectors u
, v
, and w
form a right-handed orthonormal basis.
The additional u
and v
vectors are not required to fulfill the contract of
Hyperplane
. Therefore, they
are not considered when using instances of this type purely as a hyperplane. For example, the
eq
and
similiarOrientation
methods do not consider them.
Modifier and Type | Class and Description |
---|---|
static class |
EmbeddingPlane.SubspaceTransform
Class containing a transformed plane instance along with a subspace (2D) transform.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
EmbeddingPlane |
getEmbedding()
Return the current instance.
|
Vector3D.Unit |
getU()
Get the plane first canonical vector.
|
Vector3D.Unit |
getV()
Get the plane second canonical vector.
|
Vector3D.Unit |
getW()
Get the plane third canonical vector, ie, the plane normal.
|
int |
hashCode() |
Vector3D |
pointAt(Vector2D inPlane,
double offset)
Get one point from the 3D-space.
|
EmbeddingPlane |
reverse()
Build a new reversed version of this plane, with opposite orientation.
|
EmbeddingPlane |
rotate(Vector3D center,
QuaternionRotation rotation)
Rotate the plane around the specified point.
|
EmbeddingPlane.SubspaceTransform |
subspaceTransform(Transform<Vector3D> transform)
Get an object containing the current plane transformed by the argument along with a
2D transform that can be applied to subspace points.
|
Vector3D |
toSpace(Vector2D point)
Transform an in-plane point into a 3D space point.
|
String |
toString() |
Vector2D |
toSubspace(Vector3D point)
Transform a 3D space point into an in-plane point.
|
EmbeddingPlane |
transform(Transform<Vector3D> transform) |
EmbeddingPlane |
translate(Vector3D translation)
Translate the plane by the specified amount.
|
contains, contains, contains, eq, getNormal, getOrigin, getOriginOffset, intersection, intersection, intersection, isParallel, isParallel, offset, offset, offset, project, project, similarOrientation, span
classify, getPrecision
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
classify, contains, offset, project, similarOrientation, span
toSpace, toSubspace
public Vector3D.Unit getU()
The frame defined by (u
, v
,
w
) is a right-handed orthonormalized frame).
getV()
,
getW()
,
Plane.getNormal()
public Vector3D.Unit getV()
The frame defined by (u
, v
,
w
) is a right-handed orthonormalized frame).
getU()
,
getW()
,
Plane.getNormal()
public Vector3D.Unit getW()
Plane.getNormal()
.
The frame defined by u
, v
,
w
is a right-handed orthonormalized frame.
getU()
,
getV()
,
Plane.getNormal()
public EmbeddingPlane getEmbedding()
getEmbedding
in class Plane
public Vector2D toSubspace(Vector3D point)
toSubspace
in interface Embedding<Vector3D,Vector2D>
point
- point of the spacetoSpace(org.apache.commons.geometry.euclidean.twod.Vector2D)
public Vector3D toSpace(Vector2D point)
toSpace
in interface Embedding<Vector3D,Vector2D>
point
- in-plane pointtoSubspace(Vector3D)
public Vector3D pointAt(Vector2D inPlane, double offset)
inPlane
- desired in-plane coordinates for the point in the planeoffset
- desired offset for the pointpublic EmbeddingPlane reverse()
The new plane frame is chosen in such a way that a 3D point that had
(x, y)
in-plane coordinates and z
offset with respect to the
plane and is unaffected by the change will have (y, x)
in-plane
coordinates and -z
offset with respect to the new plane. This means
that the u
and v
vectors returned by the getU()
and
getV()
methods are exchanged, and the w
vector returned by the
Plane.getNormal()
method is reversed.
reverse
in interface Hyperplane<Vector3D>
reverse
in class Plane
public EmbeddingPlane transform(Transform<Vector3D> transform)
Instances are transformed by selecting 3 representative points from the
plane, transforming them, and constructing a new plane from the transformed points.
Since the normal is not transformed directly, but rather is constructed new from the
transformed points, the relative orientations of points in the plane are preserved,
even for transforms that do not
preserve orientation
. The example below shows
a plane being transformed by a non-orientation-preserving transform. The normal of the
transformed plane retains its counterclockwise relationship to the points in the plane,
in contrast with the normal that is transformed directly by the transform.
// construct a plane from 3 points; the normal will be selected such that the // points are ordered counterclockwise when looking down the plane normal. Vector3D p1 = Vector3D.of(0, 0, 0); Vector3D p2 = Vector3D.of(+1, 0, 0); Vector3D p3 = Vector3D.of(0, +1, 0); Plane plane = Planes.fromPoints(p1, p2, p3, precision); // normal is (0, 0, +1) // create a transform that negates all x-values; this transform does not // preserve orientation, i.e. it will convert a right-handed system into a left-handed // system and vice versa AffineTransformMatrix3D transform = AffineTransformMatrix3D.createScale(-1, 1, 1); // transform the plane Plane transformedPlane = plane.transform(transform); // the plane normal is oriented such that transformed points are still ordered // counterclockwise when looking down the plane normal; since the point (1, 0, 0) has // now become (-1, 0, 0), the normal has flipped to (0, 0, -1) transformedPlane.getNormal(); // directly transform the original plane normal; the normal is unchanged by the transform // since the target space of the transform is left-handed AffineTransformMatrix3D normalTransform = transform.normalTransform(); Vector3D directlyTransformedNormal = normalTransform.apply(plane.getNormal()); // (0, 0, +1)
transform
in interface Hyperplane<Vector3D>
transform
in class Plane
public EmbeddingPlane translate(Vector3D translation)
public EmbeddingPlane rotate(Vector3D center, QuaternionRotation rotation)
public EmbeddingPlane.SubspaceTransform subspaceTransform(Transform<Vector3D> transform)
SubspaceTransform st = plane.subspaceTransform(transform); Vector2D subPt = Vector2D.of(1, 1); Vector3D a = transform.apply(plane.toSpace(subPt)); // transform in 3D space Vector3D b = st.getPlane().toSpace(st.getTransform().apply(subPt)); // transform in 2D spaceAt the end of execution, the points
a
(which was transformed using the original
3D transform) and b
(which was transformed in 2D using the subspace transform)
are equivalent.transform
- the transform to apply to this instancetransform(Transform)
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.