Class CoordinateUtils


  • public class CoordinateUtils
    extends java.lang.Object
    A utility class that can be used to modify coordinate values of an item of geometry.

    The utility class may be used as either a single shared instance or as a normal class. Sometimes you have a lot of different code all wanting to do similar modifications simultaneously and so having a single static-only class with synchronised methods would be very bad for performance.

    Version:
    $Revision: 1.1 $
    Author:
    Justin Couch
    • Constructor Summary

      Constructors 
      Constructor Description
      CoordinateUtils()
      Create a default instance of the utility class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CoordinateUtils getSharedInstance()
      Fetch the currently shared singleton instance.
      void translate​(float[][] srcCoords, int numCoords, float[][] destCoords, float x, float y, float z)
      Translate the coordintes by the given amount in each direction and place them in the destination array.
      void translate​(float[][] coords, int numCoords, float x, float y, float z)
      Translate, in place, the coordintes by the given amount in each direction.
      void translate​(float[] srcCoords, int numCoords, float[] destCoords, float x, float y, float z)
      Translate the coordintes by the given amount in each direction and place them in the destination array.
      void translate​(float[] coords, int numCoords, float x, float y, float z)
      Translate, in place, the coordintes by the given amount in each direction.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CoordinateUtils

        public CoordinateUtils()
        Create a default instance of the utility class.
    • Method Detail

      • translate

        public void translate​(float[] coords,
                              int numCoords,
                              float x,
                              float y,
                              float z)
        Translate, in place, the coordintes by the given amount in each direction. It assumes that the array has the coordinate values as a flat array of values.
        Parameters:
        coords - The source coordinate array to copy
        numCoords - The number of valid coordinates in the array
        x - The amount to translate in the x axis
        y - The amount to translate in the y ayis
        z - The amount to translate in the z azis
      • translate

        public void translate​(float[][] coords,
                              int numCoords,
                              float x,
                              float y,
                              float z)
        Translate, in place, the coordintes by the given amount in each direction. It assumes that the array has the coordinate values as a flat array of values.
        Parameters:
        coords - The source coordinate array to copy
        numCoords - The number of valid coordinates in the array
        x - The amount to translate in the x axis
        y - The amount to translate in the y ayis
        z - The amount to translate in the z azis
      • translate

        public void translate​(float[] srcCoords,
                              int numCoords,
                              float[] destCoords,
                              float x,
                              float y,
                              float z)
        Translate the coordintes by the given amount in each direction and place them in the destination array. It assumes that the array has the coordinate values as a flat array of values.
        Parameters:
        srcCoords - The source coordinate array to copy
        numCoords - The number of valid coordinates in the array
        destCoords - The array to copy the values into
        x - The amount to translate in the x axis
        y - The amount to translate in the y ayis
        z - The amount to translate in the z azis
      • translate

        public void translate​(float[][] srcCoords,
                              int numCoords,
                              float[][] destCoords,
                              float x,
                              float y,
                              float z)
        Translate the coordintes by the given amount in each direction and place them in the destination array. It assumes that the array has the coordinate values as a flat array of values.
        Parameters:
        srcCoords - The source coordinate array to copy
        numCoords - The number of valid coordinates in the array
        destCoords - The array to copy the values into
        x - The amount to translate in the x axis
        y - The amount to translate in the y ayis
        z - The amount to translate in the z azis