Class HiResCoord


  • public class HiResCoord
    extends java.lang.Object
    The HiResCoord object specifies the location of scene components within the Virtual Universe. The coordinates of all scene graph objects are relative to the HiResCoord of the Locale in which they are contained.

    The HiResCoord defines a point using a set of three high-resolution coordinates, each of which consists of three two's-complement fixed-point numbers. Each high-resolution number consists of 256 total bits with a binary point at bit 128, or between the integers at index 3 and 4. A high-resolution coordinate of 1.0 is defined to be exactly 1 meter. This coordinate system is sufficient to describe a universe in excess of several billion light years across, yet still define objects smaller than a proton.

    Java 3D uses integer arrays of length eight to define or extract a single 256-bit coordinate value. Java 3D interprets the integer at index 0 as the 32 most-significant bits and the integer at index 7 as the 32 least-significant bits.

    • Constructor Summary

      Constructors 
      Constructor Description
      HiResCoord()
      Constructs and initializes a new HiResCoord located at (0, 0, 0).
      HiResCoord​(int[] X, int[] Y, int[] Z)
      Constructs and initializes a new HiResCoord using the values provided in the argument.
      HiResCoord​(HiResCoord hc)
      Constructs and initializes a new HiResCoord using the values provided in the argument.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(HiResCoord h1, HiResCoord h2)
      Adds two HiResCoords placing the results into this HiResCoord.
      void difference​(HiResCoord h1, javax.vecmath.Vector3d v)
      Subtracts the specified HiResCoord from this HiResCoord placing the difference vector into the specified double-precision vector.
      double distance​(HiResCoord h1)
      The floating point distance between the specified HiResCoord and this HiResCoord.
      boolean equals​(java.lang.Object o1)
      Returns true if the Object o1 is of type HiResCoord and all of the data members of o1 are equal to the corresponding data members in this HiResCoord.
      boolean equals​(HiResCoord h1)
      Compares the specified HiResCoord to this HiResCoord.
      void getHiResCoord​(int[] X, int[] Y, int[] Z)
      Retrieves this HiResCoord's location and saves the coordinates in the specified arrays.
      void getHiResCoord​(HiResCoord hc)
      Retrieves this HiResCoord's location and places it into the hires argument.
      void getHiResCoordX​(int[] X)
      Retrieves this HiResCoord's X value and stores it in the specified array.
      void getHiResCoordY​(int[] Y)
      Retrieves this HiResCoord's Y value and stores it in the specified array.
      void getHiResCoordZ​(int[] Z)
      Retrieves this HiResCoord's Z value and stores it in the specified array.
      void negate()
      Negates this HiResCoord
      void negate​(HiResCoord h1)
      Negates the specified HiResCoords and places the results into this HiResCoord.
      void scale​(int scale)
      Scales this HiResCoord by the specified value.
      void scale​(int scale, HiResCoord h1)
      Scales the specified HiResCoords by the specified value and places the results into this HiResCoord.
      void setHiResCoord​(int[] X, int[] Y, int[] Z)
      Sets this HiResCoord to the location specified by the parameters provided.
      void setHiResCoord​(HiResCoord hires)
      Sets this HiResCoord to the location specified by the hires provided.
      void setHiResCoordX​(int[] X)
      Sets this HiResCoord's X value to that specified by the argument.
      void setHiResCoordY​(int[] Y)
      Sets this HiResCoord's Y value to that specified by the argument.
      void setHiResCoordZ​(int[] Z)
      Sets this HiResCoord's Z value to that specified by the argument.
      void sub​(HiResCoord h1, HiResCoord h2)
      Subtracts two HiResCoords placing the results into this HiResCoord.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HiResCoord

        public HiResCoord​(int[] X,
                          int[] Y,
                          int[] Z)
        Constructs and initializes a new HiResCoord using the values provided in the argument. The HiResCoord represents 768 bits of floating point 3-Space.
        Parameters:
        X - an eight element array specifying the x position
        Y - an eight element array specifying the y position
        Z - an eight element array specifying the z position
      • HiResCoord

        public HiResCoord​(HiResCoord hc)
        Constructs and initializes a new HiResCoord using the values provided in the argument. The HiResCoord represents 768 bits of floating point 3-Space.
        Parameters:
        hc - the HiResCoord to copy
      • HiResCoord

        public HiResCoord()
        Constructs and initializes a new HiResCoord located at (0, 0, 0). The HiResCoord represents 768 bits of floating point 3-Space.
    • Method Detail

      • setHiResCoord

        public void setHiResCoord​(int[] X,
                                  int[] Y,
                                  int[] Z)
        Sets this HiResCoord to the location specified by the parameters provided.
        Parameters:
        X - an eight-element array specifying the x position
        Y - an eight-element array specifying the y position
        Z - an eight-element array specifying the z position
      • setHiResCoord

        public void setHiResCoord​(HiResCoord hires)
        Sets this HiResCoord to the location specified by the hires provided.
        Parameters:
        hires - the hires coordinate to copy
      • setHiResCoordX

        public void setHiResCoordX​(int[] X)
        Sets this HiResCoord's X value to that specified by the argument.
        Parameters:
        X - an eight-element array specifying the x position
      • setHiResCoordY

        public void setHiResCoordY​(int[] Y)
        Sets this HiResCoord's Y value to that specified by the argument.
        Parameters:
        Y - an eight-element array specifying the y position
      • setHiResCoordZ

        public void setHiResCoordZ​(int[] Z)
        Sets this HiResCoord's Z value to that specified by the argument.
        Parameters:
        Z - an eight-element array specifying the z position
      • getHiResCoord

        public void getHiResCoord​(int[] X,
                                  int[] Y,
                                  int[] Z)
        Retrieves this HiResCoord's location and saves the coordinates in the specified arrays. The arrays must be large enough to hold all of the ints.
        Parameters:
        X - an eight element array that will receive the x position
        Y - an eight element array that will receive the y position
        Z - an eight element array that will receive the z position
      • getHiResCoord

        public void getHiResCoord​(HiResCoord hc)
        Retrieves this HiResCoord's location and places it into the hires argument.
        Parameters:
        hc - the hires coordinate that will receive this node's location
      • getHiResCoordX

        public void getHiResCoordX​(int[] X)
        Retrieves this HiResCoord's X value and stores it in the specified array. The array must be large enough to hold all of the ints.
        Parameters:
        X - an eight-element array that will receive the x position
      • getHiResCoordY

        public void getHiResCoordY​(int[] Y)
        Retrieves this HiResCoord's Y value and stores it in the specified array. The array must be large enough to hold all of the ints.
        Parameters:
        Y - an eight-element array that will receive the y position
      • getHiResCoordZ

        public void getHiResCoordZ​(int[] Z)
        Retrieves this HiResCoord's Z value and stores it in the specified array. The array must be large enough to hold all of the ints.
        Parameters:
        Z - an eight-element array that will receive the z position
      • equals

        public boolean equals​(HiResCoord h1)
        Compares the specified HiResCoord to this HiResCoord.
        Parameters:
        h1 - the second HiResCoord
        Returns:
        true if equal, false if not equal
      • equals

        public boolean equals​(java.lang.Object o1)
        Returns true if the Object o1 is of type HiResCoord and all of the data members of o1 are equal to the corresponding data members in this HiResCoord.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o1 - the second HiResCoord
        Returns:
        true if equal, false if not equal
      • add

        public void add​(HiResCoord h1,
                        HiResCoord h2)
        Adds two HiResCoords placing the results into this HiResCoord.
        Parameters:
        h1 - the first HiResCoord
        h2 - the second HiResCoord
      • sub

        public void sub​(HiResCoord h1,
                        HiResCoord h2)
        Subtracts two HiResCoords placing the results into this HiResCoord.
        Parameters:
        h1 - the first HiResCoord
        h2 - the second HiResCoord
      • negate

        public void negate​(HiResCoord h1)
        Negates the specified HiResCoords and places the results into this HiResCoord.
        Parameters:
        h1 - the source HiResCoord
      • negate

        public void negate()
        Negates this HiResCoord
      • scale

        public void scale​(int scale,
                          HiResCoord h1)
        Scales the specified HiResCoords by the specified value and places the results into this HiResCoord.
        Parameters:
        scale - the amount to scale the specified HiResCoord
        h1 - the source HiResCoord
      • scale

        public void scale​(int scale)
        Scales this HiResCoord by the specified value.
        Parameters:
        scale - the amount to scale the specified HiResCoord
      • difference

        public void difference​(HiResCoord h1,
                               javax.vecmath.Vector3d v)
        Subtracts the specified HiResCoord from this HiResCoord placing the difference vector into the specified double-precision vector.
        Parameters:
        h1 - the HiResCoord to be subtracted from this
        v - the vector that will receive the result
      • distance

        public double distance​(HiResCoord h1)
        The floating point distance between the specified HiResCoord and this HiResCoord.
        Parameters:
        h1 - the second HiResCoord