Class Matrix4D

java.lang.Object
org.gvsig.dwg.lib.util.Matrix4D

public final class Matrix4D extends Object
4x4dim double matrix used for perspective transformations. The class is now declared final to allow a more aggresive optimization.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
    double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create identity matrix.
    Matrix4D(double mxx, double mxy, double mxz, double mxw, double myx, double myy, double myz, double myw, double mzx, double mzy, double mzz, double mzw, double mwx, double mwy, double mwz, double mww)
     
    Copy constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Reset to identity
    void
    moveBy(double x, double y, double z)
    Move the stuff.
    void
    Translate the origin
    Matrix multiplication.
    Matrix multiplication of point.
    Matrix multiplication of vector.
    void
    Matrix multiplication.
    void
    Matrix multiplication from left.
    void
    scale(double f)
    Scale.
    void
    scale(double fx, double fy, double fz)
    Scale different in x,y,z.
    Output
    void
    Transformation of 1 point.
    void
    transform(Point3D[] v, int[] tx, int[] ty, int[] tz, int npoints)
    Transform some points.
    void
    Transformation of 1 vector.
    void
    Transformacion de un punto considerando solo el plano horizontal
    void
    translate(double x, double y, double z)
    Translate the origin.
    void
    Translate the origin
    void
    translateLeft(double x, double y, double z)
    Translate.
    void
    Translate the origin
    void
    Transponize.
    void
    xrot(double theta)
    Rotate theta degrees about the x axis.
    void
    yrot(double theta)
    Rotate theta degrees about the y axis.
    void
    zrot(double theta)
    Rotate theta degrees about the z axis.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • xx

      public double xx
    • xy

      public double xy
    • xz

      public double xz
    • xw

      public double xw
    • yx

      public double yx
    • yy

      public double yy
    • yz

      public double yz
    • yw

      public double yw
    • zx

      public double zx
    • zy

      public double zy
    • zz

      public double zz
    • zw

      public double zw
    • wx

      public double wx
    • wy

      public double wy
    • wz

      public double wz
    • ww

      public double ww
  • Constructor Details

    • Matrix4D

      public Matrix4D()
      Create identity matrix.
    • Matrix4D

      public Matrix4D(Matrix4D m)
      Copy constructor.
      Parameters:
      m - matrix to copy
    • Matrix4D

      public Matrix4D(double mxx, double mxy, double mxz, double mxw, double myx, double myy, double myz, double myw, double mzx, double mzy, double mzz, double mzw, double mwx, double mwy, double mwz, double mww)
      Parameters:
      mxx - 1st elem in 1st row
      mxy - 2nd elem in 1st row
      mxz - 3rd elem in 1st row
      mxw - 4th elem in 1st row
      myx - 1st elem in 2nd row
      myy - 2nd elem in 2nd row
      myz - 3rd elem in 2nd row
      myw - 4th elem in 2nd row
      mzx - 1st elem in 3rd row
      mzy - 2nd elem in 3rd row
      mzz - 3rd elem in 3rd row
      mzw - 4th elem in 3rd row
      mwx - 1st elem in 4th row
      mwy - 2nd elem in 4th row
      mwz - 3rd elem in 4th row
      mww - 4th elem in 4th row
  • Method Details

    • identity

      public void identity()
      Reset to identity
    • transponize

      public void transponize()
      Transponize.
    • mult

      public Vector3D mult(Vector3D v)
      Matrix multiplication of vector.
      Parameters:
      v - vector to transform
      Returns:
      transformed vector
    • transform

      public void transform(Vector3D v)
      Transformation of 1 vector.
      Parameters:
      v - vector to transform
    • mult

      public Point3D mult(Point3D p)
      Matrix multiplication of point.
      Parameters:
      p - point to transform
      Returns:
      transformed point
    • transform

      public void transform(Point3D p)
      Transformation of 1 point.
      Parameters:
      p - point to transform
    • transformXY

      public void transformXY(Point3D p)
      Transformacion de un punto considerando solo el plano horizontal
    • mult

      public Matrix4D mult(Matrix4D m)
      Matrix multiplication.
      Parameters:
      m - matrix to multiply with
      Returns:
      this * m
    • multBy

      public void multBy(Matrix4D m)
      Matrix multiplication.
      Parameters:
      m - matrix to multply with
    • multLeftBy

      public void multLeftBy(Matrix4D m)
      Matrix multiplication from left.
      Parameters:
      m - matrix to multiply with.
    • translate

      public void translate(double x, double y, double z)
      Translate the origin.
      Parameters:
      x - translation in x
      y - translation in y
      z - translation in z
    • translate

      public void translate(Vector3D v)
      Translate the origin
      Parameters:
      v - translation vector
    • translateLeft

      public void translateLeft(double x, double y, double z)
      Translate.
      Parameters:
      x - translation in x
      y - translation in y
      z - translation in z
    • translateLeft

      public void translateLeft(Vector3D v)
      Translate the origin
      Parameters:
      v - tranbslation vector
    • moveBy

      public void moveBy(double x, double y, double z)
      Move the stuff.
      Parameters:
      x - translation in x
      y - translation in y
      z - translation in z
    • moveBy

      public void moveBy(Vector3D v)
      Translate the origin
      Parameters:
      v - translation vector
    • yrot

      public void yrot(double theta)
      Rotate theta degrees about the y axis.
      Parameters:
      theta - rotation angle in rad
    • xrot

      public void xrot(double theta)
      Rotate theta degrees about the x axis.
      Parameters:
      theta - rotation angle in rad
    • zrot

      public void zrot(double theta)
      Rotate theta degrees about the z axis.
      Parameters:
      theta - rotation angle in rad
    • scale

      public void scale(double f)
      Scale.
      Parameters:
      f - factor to scale with.
    • scale

      public void scale(double fx, double fy, double fz)
      Scale different in x,y,z.
      Parameters:
      fx - scaling factor in x
      fy - scaling factor in y
      fz - scaling factor in z
    • transform

      public void transform(Point3D[] v, int[] tx, int[] ty, int[] tz, int npoints)
      Transform some points.
      Parameters:
      v - points to transform
      tx - transformed points x coord
      ty - transformed points y coord
      tz - transformed points z coord
      npoints - nr of points to transform
    • toString

      public String toString()
      Output
      Overrides:
      toString in class Object
      Returns:
      String representing this.