Shapes 3D  3.0
 All Classes Functions Variables Pages
shapes3d.utils.Util Class Reference

Static Public Member Functions

static PVector[] makePVectorArray (float[] x, float[] y)
 
static PVector[] makePVectorArray (float[] x, float[] y, float[] z)
 
static Vector3D convert (PVector pv)
 
static PVector convert (Vector3D v3d)
 
static PVector[] convert (Vector3D[] v3d)
 
static PVector[][] convert (Vector3D[][] v3d)
 
static PVector slerp (final PVector start, final PVector end, float t)
 
static PVector slerp (final PVector start, final PVector end, float t, boolean norm)
 
static PVector slerp (final PVector start, final PVector end, float t, float mag)
 
static PVector[] deepCopy (PVector[] array)
 
static PVector[][] deepCopy (PVector[][] array)
 
static UV[] deepCopy (UV[] array)
 
static UV[][] deepCopy (UV[][] array)
 
static int[] deepCopy (int[] array)
 
static< T > T[] reverse (T[] array)
 
static int[] reverse (int[] array)
 
static int[] box_box_p (int ax0, int ay0, int ax1, int ay1, int bx0, int by0, int bx1, int by1)
 

Detailed Description

A variety of utility methods used by the library. Including

  • Some simple methods to covert vectors between Processing and Apache Commons Maths implementations.
  • array copy methods for PVector and Util classes.
Author
Peter Lager

Member Function Documentation

static int [] shapes3d.utils.Util.box_box_p ( int  ax0,
int  ay0,
int  ax1,
int  ay1,
int  bx0,
int  by0,
int  bx1,
int  by1 
)
static

If two boxes overlap then the overlap region is another box. This method is used to calculate the coordinates of the overlap.
The boxes are represented by the top-left and bottom-right corner coordinates. If the returned array has a length: 0 then they do not overlap
4 then these are the coordinates of the top-left and bottom-right corners of the overlap region.

Parameters
ax0top-left corner of rectangle A
ay0top-left corner of rectangle A
ax1bottom-right corner of rectangle A
ay1bottom-right corner of rectangle A
bx0top-left corner of rectangle B
by0top-left corner of rectangle B
bx1bottom-right corner of rectangle B
by1bottom-right corner of rectangle B
Returns
an array with the overlap box coordinates (if any)
static Vector3D shapes3d.utils.Util.convert ( PVector  pv)
static

Convert from Processing to AMC vector implementation

Parameters
pvthe PVector to convert
Returns
the Vector3D result
static PVector shapes3d.utils.Util.convert ( Vector3D  v3d)
static

Convert from AMC to Processing vector implementation

Parameters
v3dthe Vector3D to convert
Returns
the PVector result
static PVector [] shapes3d.utils.Util.convert ( Vector3D[]  v3d)
static

Convert from AMC to Processing vector implementation

Parameters
v3dthe array of Vector3D to convert
Returns
the PVector array result
static PVector [][] shapes3d.utils.Util.convert ( Vector3D  v3d[][])
static

Convert from AMC to Processing vector implementation

Parameters
v3dthe 2D array of Vector3D to convert
Returns
the PVector 2D array result
static PVector [] shapes3d.utils.Util.deepCopy ( PVector[]  array)
static

Create and return a deep copy of a 1D array of PVectors

Parameters
arraythe PVector array to duplicate
Returns
a copy of the original array
static PVector [][] shapes3d.utils.Util.deepCopy ( PVector  array[][])
static

Create and return a deep copy of a 2D array of PVectors

Parameters
arraythe PVector array to duplicate
Returns
a copy of the original array
static UV [] shapes3d.utils.Util.deepCopy ( UV[]  array)
static

Create and return a deep copy of a 1D array of UVs

Parameters
arraythe UV array to duplicate
Returns
a copy of the original array
static UV [][] shapes3d.utils.Util.deepCopy ( UV  array[][])
static

Create and return a deep copy of a 2D array of UVs

Parameters
arraythe UV array to duplicate
Returns
a copy of the original array
static int [] shapes3d.utils.Util.deepCopy ( int[]  array)
static

Create and return a deep copy of a 1D int array

Parameters
arraythe int array to duplicate
Returns
a copy of the original array
static PVector [] shapes3d.utils.Util.makePVectorArray ( float[]  x,
float[]  y 
)
static

Create an array of PVectors form 2 array holding x and y values.
If the arrays passed to this method differ in length the extra in the longer array are ignored.

Parameters
xarray of x values
yarray of y values
Returns
an array of PVectors
static PVector [] shapes3d.utils.Util.makePVectorArray ( float[]  x,
float[]  y,
float[]  z 
)
static

Create an array of PVectors from 3 arrays holding x, y and z values.
If the arrays passed to this method differ in length the extra in the longer arrays are ignored.

Parameters
xarray of x values
yarray of y values
yarray of z values
Returns
an array of PVectors
static <T> T [] shapes3d.utils.Util.reverse ( T[]  array)
static

Reverse the elements in an the array of objects.

Parameters
<T>the type of element in the array
arraythe array to be reversed
Returns
the reversed array
static int [] shapes3d.utils.Util.reverse ( int[]  array)
static

Reverse the elements (integer primitive type) in an array.

Parameters
arraythe array to be reversed
Returns
the reversed array
static PVector shapes3d.utils.Util.slerp ( final PVector  start,
final PVector  end,
float  t 
)
static

Perform a spherical linear interpolation between 2 vectors.
The magnitude of the returned vector will also be interpolated.

Parameters
startthe start vector (t == 0)
endthe end vector (t == 1)
tparametric constrained to the range ≥ 0 and ≤ 1
Returns
the interpolated vector
static PVector shapes3d.utils.Util.slerp ( final PVector  start,
final PVector  end,
float  t,
boolean  norm 
)
static

Perform a spherical linear interpolation between 2 vectors.
If required the returned vector will be normalized (i.e. a unit vector)

Parameters
startthe start vector (t == 0)
endthe end vector (t == 1)
tparametric constrained to the range ≥ 0 and ≤ 1
normif true will normalize the interpolated vector
Returns
the interpolated vector
static PVector shapes3d.utils.Util.slerp ( final PVector  start,
final PVector  end,
float  t,
float  mag 
)
static

Perform a spherical linear interpolation between 2 vectors.
The size of the returned vector will be set by the last parameter.

Parameters
startthe start vector (t == 0)
endthe end vector (t == 1)
tparametric constrained to the range ≥ 0 and ≤ 1
magthe required size of the interpolated vector
Returns
the interpolated vector

The documentation for this class was generated from the following file: