Module vecmath

Class TransformableVolume

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

public abstract class TransformableVolume extends VolumeBase
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 m00 to m22 and t0 to t2, the transformation is computed by
oi = ∑i mi,j (wj - tj)
I.e., the vector 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

    Fields
    Modifier and Type
    Field
    Description
    protected 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 of m00 * m00 + ... + m22 * m22.
    Computes the rotational component of the transformation from local object coordinates to global world coordinates.
    void
    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
    Transforms the point in, specified in local object coordinates, to out 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
    Sets the transformation from world to object coordinates to the specified matrix and vector: o = rot * (w - trans)
    void
    Sets the transformation from world to object coordinates to an orthonormal transformation which transforms the origin point to (0,0,0) and the normalized axis vector to (0,0,1).
    void
    Transforms the point in, specified in global world coordinates, to out in local object coordinates.
    void
    Multiplies the vector in by the transpose of the upper 3x3 values of the world-to-object transformation and stores the result in out.
    void
    Transforms the direction in, specified in global world coordinates, to out 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 m00
      00-component of the rotation matrix from world coordinates to object coordinates.
    • m01

      protected double m01
      01-component of the rotation matrix from world coordinates to object coordinates.
    • m02

      protected double m02
      02-component of the rotation matrix from world coordinates to object coordinates.
    • m10

      protected double m10
      10-component of the rotation matrix from world coordinates to object coordinates.
    • m11

      protected double m11
      11-component of the rotation matrix from world coordinates to object coordinates.
    • m12

      protected double m12
      12-component of the rotation matrix from world coordinates to object coordinates.
    • m20

      protected double m20
      20-component of the rotation matrix from world coordinates to object coordinates.
    • m21

      protected double m21
      21-component of the rotation matrix from world coordinates to object coordinates.
    • m22

      protected double m22
      22-component of the rotation matrix from world coordinates to object coordinates.
    • t0

      protected double t0
      0-component of the translation from object coordinates to world coordinates.
    • t1

      protected double t1
      1-component of the translation from object coordinates to world coordinates.
    • t2

      protected double t2
      2-component of the translation from object coordinates to world coordinates.
  • Constructor Details

    • TransformableVolume

      public TransformableVolume()
  • Method Details

    • setTransformation

      public void setTransformation(Matrix3d rot, Tuple3d trans)
      Sets the transformation from world to object coordinates to the specified matrix and vector: o = rot * (w - trans)
      Parameters:
      rot - rotational component of new transformation
      trans - translational component of new transformation
    • getTransformation

      public void getTransformation(Matrix3d rot, Tuple3d trans)
      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 rot
      trans - translational component is stored in trans
    • setTransformation

      public void setTransformation(Tuple3d origin, Tuple3d axis)
      Sets the transformation from world to object coordinates to an orthonormal transformation which transforms the origin point to (0,0,0) and the normalized axis vector to (0,0,1).
      Parameters:
      origin - origin in world coordinates
      axis - 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-direction
      sy - scaling factor in y-direction
      sz - 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-direction
      dy - translation in y-direction
      dz - translation in z-direction
    • transformVector

      public void transformVector(Tuple3d in, Tuple3d out)
      Transforms the direction in, specified in global world coordinates, to out in local object coordinates. in and out may be the same instance.
      Parameters:
      in - direction in world coordinates
      out - direction in object coordinates
    • transformPoint

      public void transformPoint(Tuple3d in, Tuple3d out)
      Transforms the point in, specified in global world coordinates, to out in local object coordinates. in and out may be the same instance.
      Parameters:
      in - point in world coordinates
      out - point in object coordinates
    • invTransformPoint

      public void invTransformPoint(Tuple3d in, Tuple3d out)
      Transforms the point in, specified in local object coordinates, to out in global world coordinates. in and out may be the same instance.
      Parameters:
      in - point in object coordinates
      out - point in world coordinates
    • transformTranspose

      public void transformTranspose(Tuple3d in, Tuple3d out)
      Multiplies the vector in by the transpose of the upper 3x3 values of the world-to-object transformation and stores the result in out. This can be used to transform normal vectors from object coordinates to world coordinates. in and out may be the same instance.
      Parameters:
      in - direction in world coordinates
      out - direction in object coordinates
    • getObjectToWorldRotationScale

      public Matrix3d 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 of m00 * 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

      public void getDiscExtent(double z, double radius, Tuple3d min, Tuple3d max)
    • getDiscsExtent

      public void getDiscsExtent(double z1, double radius1, double z2, double radius2, Tuple3d min, Tuple3d max)