java.lang.Object
de.grogra.vecmath.geom.VolumeBase
de.grogra.vecmath.geom.TransformableVolume
- All Implemented Interfaces:
Volume
- Direct Known Subclasses:
Cube
,FrustumBase
,HalfSpace
,ImplicitVolume
,SensorDisc
,SkySphere
,Sphere
,SphereSegmentSolid
,Square
This class represents the base class for volumes whose
geometry is specified
in local coordinates. The transformation from global
world coordinates to local object coordinates is stored in the
fields
oi
= ∑i mi,j (wj - tj)
I.e., the vector
m00
to m22
and t0
to t2
,
the transformation is computed by
t
represents the location of the
object origin in world coordinates.
This representation has been chosen instead of
an instance of Matrix4d
for memory and speed
(faster instantiation) reasons. After modification of
matrix components and other geometric parameters declared
by subclasses, invalidate()
has to be invoked.- Author:
- Ole Kniemeyer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
00-component of the rotation matrix from world coordinates to object coordinates.protected double
01-component of the rotation matrix from world coordinates to object coordinates.protected double
02-component of the rotation matrix from world coordinates to object coordinates.protected double
10-component of the rotation matrix from world coordinates to object coordinates.protected double
11-component of the rotation matrix from world coordinates to object coordinates.protected double
12-component of the rotation matrix from world coordinates to object coordinates.protected double
20-component of the rotation matrix from world coordinates to object coordinates.protected double
21-component of the rotation matrix from world coordinates to object coordinates.protected double
22-component of the rotation matrix from world coordinates to object coordinates.protected double
0-component of the translation from object coordinates to world coordinates.protected double
1-component of the translation from object coordinates to world coordinates.protected double
2-component of the translation from object coordinates to world coordinates. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
getDiscExtent
(double z, double radius, Tuple3d min, Tuple3d max) void
getDiscsExtent
(double z1, double radius1, double z2, double radius2, Tuple3d min, Tuple3d max) double
Returns the Frobenius norm of the upper 3x3 values of the world-to-object transformation, i.e., the square root ofm00 * m00 + ... + m22 * m22
.Computes the rotational component of the transformation from local object coordinates to global world coordinates.void
getTransformation
(Matrix3d rot, Tuple3d trans) gets the transformation from world to object coordinates to the specified matrix and vector:o = rot * (w - trans)
void
Invalidates cached information about this volume.void
invTransformPoint
(Tuple3d in, Tuple3d out) Transforms the pointin
, specified in local object coordinates, toout
in global world coordinates.void
scale
(double sx, double sy, double sz) Multiplies the current world-to-object transformation from left by a scaling matrix.void
setTransformation
(Matrix3d rot, Tuple3d trans) Sets the transformation from world to object coordinates to the specified matrix and vector:o = rot * (w - trans)
void
setTransformation
(Tuple3d origin, Tuple3d axis) Sets the transformation from world to object coordinates to an orthonormal transformation which transforms theorigin
point to (0,0,0) and the normalizedaxis
vector to (0,0,1).void
transformPoint
(Tuple3d in, Tuple3d out) Transforms the pointin
, specified in global world coordinates, toout
in local object coordinates.void
transformTranspose
(Tuple3d in, Tuple3d out) Multiplies the vectorin
by the transpose of the upper 3x3 values of the world-to-object transformation and stores the result inout
.void
transformVector
(Tuple3d in, Tuple3d out) Transforms the directionin
, specified in global world coordinates, toout
in local object coordinates.void
translate
(double dx, double dy, double dz) Multiplies the current world-to-object transformation from right by a translation matrix using the negated values.Methods inherited from class de.grogra.vecmath.geom.VolumeBase
addConvexIntersections, getId, operator$and, operator$com, operator$or, operator$sub, setId
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.grogra.vecmath.geom.Volume
boxContainsBoundary, computeIntersections, computeNormal, computeTangents, computeUV, contains, getExtent
-
Field Details
-
m00
protected double m0000-component of the rotation matrix from world coordinates to object coordinates. -
m01
protected double m0101-component of the rotation matrix from world coordinates to object coordinates. -
m02
protected double m0202-component of the rotation matrix from world coordinates to object coordinates. -
m10
protected double m1010-component of the rotation matrix from world coordinates to object coordinates. -
m11
protected double m1111-component of the rotation matrix from world coordinates to object coordinates. -
m12
protected double m1212-component of the rotation matrix from world coordinates to object coordinates. -
m20
protected double m2020-component of the rotation matrix from world coordinates to object coordinates. -
m21
protected double m2121-component of the rotation matrix from world coordinates to object coordinates. -
m22
protected double m2222-component of the rotation matrix from world coordinates to object coordinates. -
t0
protected double t00-component of the translation from object coordinates to world coordinates. -
t1
protected double t11-component of the translation from object coordinates to world coordinates. -
t2
protected double t22-component of the translation from object coordinates to world coordinates.
-
-
Constructor Details
-
TransformableVolume
public TransformableVolume()
-
-
Method Details
-
setTransformation
Sets the transformation from world to object coordinates to the specified matrix and vector:o = rot * (w - trans)
- Parameters:
rot
- rotational component of new transformationtrans
- translational component of new transformation
-
getTransformation
gets the transformation from world to object coordinates to the specified matrix and vector:o = rot * (w - trans)
- Parameters:
rot
- rotational component is stored in rottrans
- translational component is stored in trans
-
setTransformation
Sets the transformation from world to object coordinates to an orthonormal transformation which transforms theorigin
point to (0,0,0) and the normalizedaxis
vector to (0,0,1).- Parameters:
origin
- origin in world coordinatesaxis
- axis (local z-direction) in world coordinates
-
scale
public void scale(double sx, double sy, double sz) Multiplies the current world-to-object transformation from left by a scaling matrix. This corresponds to a scaling of the object by the reciprocal of the specified values.- Parameters:
sx
- scaling factor in x-directionsy
- scaling factor in y-directionsz
- scaling factor in z-direction
-
translate
public void translate(double dx, double dy, double dz) Multiplies the current world-to-object transformation from right by a translation matrix using the negated values. This corresponds to a translation of the object in the world by the specified values.- Parameters:
dx
- translation in x-directiondy
- translation in y-directiondz
- translation in z-direction
-
transformVector
Transforms the directionin
, specified in global world coordinates, toout
in local object coordinates.in
andout
may be the same instance.- Parameters:
in
- direction in world coordinatesout
- direction in object coordinates
-
transformPoint
Transforms the pointin
, specified in global world coordinates, toout
in local object coordinates.in
andout
may be the same instance.- Parameters:
in
- point in world coordinatesout
- point in object coordinates
-
invTransformPoint
Transforms the pointin
, specified in local object coordinates, toout
in global world coordinates.in
andout
may be the same instance.- Parameters:
in
- point in object coordinatesout
- point in world coordinates
-
transformTranspose
Multiplies the vectorin
by the transpose of the upper 3x3 values of the world-to-object transformation and stores the result inout
. This can be used to transform normal vectors from object coordinates to world coordinates.in
andout
may be the same instance.- Parameters:
in
- direction in world coordinatesout
- direction in object coordinates
-
getObjectToWorldRotationScale
Computes the rotational component of the transformation from local object coordinates to global world coordinates. The matrix components of the returned value must not be modified.- Returns:
- object-to-world transformation
-
getFrobeniusNorm
public double getFrobeniusNorm()Returns the Frobenius norm of the upper 3x3 values of the world-to-object transformation, i.e., the square root ofm00 * m00 + ... + m22 * m22
. Note that the length of a vector in object coordinates is less than or equal to the length of this vector in world coordinates multplied by the Frobenius norm of the transformation.- Returns:
- Frobenius norm of world-to-object transformation
-
invalidate
public void invalidate()Invalidates cached information about this volume. This method has to be invoked after matrix components and geometric parameters declared by subclasses have been changed. -
getDiscExtent
-
getDiscsExtent
-