Class JPoint3DD

  • Direct Known Subclasses:
    UnitSphere

    public class JPoint3DD
    extends java.lang.Object
    Immutable 3D point or vector.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        JPoint3DD()
      Creata the zero vector.
        JPoint3DD​(double x, double y, double z)
      Create a 3D point or vector.
      protected JPoint3DD​(double x, double y, double z, double divisor)
      Create a scaled JPoint3DD, (x, y, z)/divisor.
    • Constructor Detail

      • JPoint3DD

        public JPoint3DD()
        Creata the zero vector.
      • JPoint3DD

        public JPoint3DD​(double x,
                         double y,
                         double z)
        Create a 3D point or vector.
        Parameters:
        x -
        y -
        z -
      • JPoint3DD

        protected JPoint3DD​(double x,
                            double y,
                            double z,
                            double divisor)
        Create a scaled JPoint3DD, (x, y, z)/divisor. If the divisor is zero, will create a zero vector (instead of dividing by zero).
        Parameters:
        x -
        y -
        z -
        divisor - amount to divide (x, y, z) by; if zero, creates a zero vector.
    • Method Detail

      • getX

        public final double getX()
        Get x.
        Returns:
        x value
      • getY

        public final double getY()
        Get y.
        Returns:
        y value
      • getZ

        public final double getZ()
        Get z.
        Returns:
        z value
      • length

        public final double length()
        Return the length of the vector.
        Returns:
        cartesian length
      • isZero

        public final boolean isZero()
        Test if all three values x, y, and z are zero.
        Returns:
        true if this is the zero vector.
      • cross

        public static final JPoint3DD cross​(JPoint3DD a,
                                            JPoint3DD b)
        Return the cross product (a x b).
        Parameters:
        a -
        b -
        Returns:
        cross product
      • dot

        public static final double dot​(JPoint3DD a,
                                       JPoint3DD b)
        Return the dot product of two 3D vectors.
        Parameters:
        a -
        b -
        Returns:
        dot product
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object