Package jahuwaldt.j3d.geom
Class CoordinateUtils
- java.lang.Object
-
- jahuwaldt.j3d.geom.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.
-
-
-
Constructor Detail
-
CoordinateUtils
public CoordinateUtils()
Create a default instance of the utility class.
-
-
Method Detail
-
getSharedInstance
public CoordinateUtils getSharedInstance()
Fetch the currently shared singleton instance.- Returns:
- The current instance
-
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 copynumCoords
- The number of valid coordinates in the arrayx
- The amount to translate in the x axisy
- The amount to translate in the y ayisz
- 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 copynumCoords
- The number of valid coordinates in the arrayx
- The amount to translate in the x axisy
- The amount to translate in the y ayisz
- 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 copynumCoords
- The number of valid coordinates in the arraydestCoords
- The array to copy the values intox
- The amount to translate in the x axisy
- The amount to translate in the y ayisz
- 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 copynumCoords
- The number of valid coordinates in the arraydestCoords
- The array to copy the values intox
- The amount to translate in the x axisy
- The amount to translate in the y ayisz
- The amount to translate in the z azis
-
-