hmi.math
Class SpatialVec

java.lang.Object
  extended by hmi.math.SpatialVec

public final class SpatialVec
extends Object

A collection of methods for spatial vectors As defined in Rigid Body Dynamics Algorithms Roy Featherstone 2007 Spatial vectors can be stored within arrays of length 6, or they can be stored inside a larger float array a, together with an integer offset "index" into that array. This represents a vector with components (a[index], a[index+1], a[index+2]). The methods from this class never allocate new arrays; rather, they assume that results are to be stored into some existing "destination" array.

Author:
Herwin van Welbergen

Field Summary
static int SPATIALVEC_SIZE
          Length of SpatialVec arrays is 6
static float[] ZERO
          The zero vector
 
Constructor Summary
private SpatialVec()
           
 
Method Summary
static void add(float[] dst, float[] a)
          dst = dst+a
static void add(float[] dst, float[] a, float[] b)
          dst = a+b
static void add(float[] dst, int dstIndex, float[] a, int aIndex)
          dst = dst+a
static void cross(float[] dst, float[] a, float[] b)
          Cross product
static void cross(float[] dst, int dstIndex, float[] a, int aIndex, float[] b, int bIndex)
          velocity x velocity product
static void crossForce(float[] dst, float[] v, float[] f)
          movement x force, Featherstone's x* operation
static void crossForce(float[] dst, int dstIndex, float[] v, int vIndex, float[] f, int fIndex)
          movement x force, Featherstone's x* operation
static float dot(float[] a, float[] b)
          Spatial dot product
static float dot(float[] a, int aIndex, float[] b, int bIndex)
          Spatial dot product
static boolean epsilonEquals(float[] a, float[] b, float epsilon)
          Tests for equality of vector components within epsilon.
static boolean epsilonEquals(float[] a, int aIndex, float[] b, int bIndex, float epsilon)
          Tests for equality of vector components within epsilon.
static void set(float[] dst, float[] src)
          Copies the src 6-vector to the dst 6-vector
static void set(float[] dst, float[] w, float[] v0)
          Sets the dst 6-vector from two 3-vectors dst=[w v0]^T
static void set(float[] dst, float v0, float v1, float v2, float v3, float v4, float v5)
          Copies the src 6-vector to the dst 6-vector
static void set(float[] dst, int dstIndex, float[] src, int srcIndex)
          Copies the src 6-vector to the dst 6-vector
static void setAcc(float[] dst, float[] w, float[] v, float[] wDiff, float[] a)
          Set the spatial acceleration vector from 'traditional' angular velocity, velocity, angular acceleration and acceleration
static void setZero(float[] dst)
           
static void sub(float[] dst, float[] a)
          dst = dst-a
static void sub(float[] dst, float[] a, float[] b)
          dst = a-b
static void sub(float[] dst, int dstIndex, float[] a, int aIndex)
          dst = dst-a
static String toString(float[] a)
          String representation
static String toString(float[] a, int aIndex)
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPATIALVEC_SIZE

public static final int SPATIALVEC_SIZE
Length of SpatialVec arrays is 6

See Also:
Constant Field Values

ZERO

public static final float[] ZERO
The zero vector

Constructor Detail

SpatialVec

private SpatialVec()
Method Detail

set

public static void set(float[] dst,
                       float v0,
                       float v1,
                       float v2,
                       float v3,
                       float v4,
                       float v5)
Copies the src 6-vector to the dst 6-vector


setZero

public static void setZero(float[] dst)

set

public static void set(float[] dst,
                       float[] src)
Copies the src 6-vector to the dst 6-vector


set

public static void set(float[] dst,
                       int dstIndex,
                       float[] src,
                       int srcIndex)
Copies the src 6-vector to the dst 6-vector


set

public static void set(float[] dst,
                       float[] w,
                       float[] v0)
Sets the dst 6-vector from two 3-vectors dst=[w v0]^T


setAcc

public static void setAcc(float[] dst,
                          float[] w,
                          float[] v,
                          float[] wDiff,
                          float[] a)
Set the spatial acceleration vector from 'traditional' angular velocity, velocity, angular acceleration and acceleration


add

public static void add(float[] dst,
                       float[] a,
                       float[] b)
dst = a+b


sub

public static void sub(float[] dst,
                       float[] a,
                       float[] b)
dst = a-b


add

public static void add(float[] dst,
                       float[] a)
dst = dst+a


sub

public static void sub(float[] dst,
                       float[] a)
dst = dst-a


add

public static void add(float[] dst,
                       int dstIndex,
                       float[] a,
                       int aIndex)
dst = dst+a


sub

public static void sub(float[] dst,
                       int dstIndex,
                       float[] a,
                       int aIndex)
dst = dst-a


dot

public static float dot(float[] a,
                        float[] b)
Spatial dot product


dot

public static float dot(float[] a,
                        int aIndex,
                        float[] b,
                        int bIndex)
Spatial dot product


cross

public static void cross(float[] dst,
                         float[] a,
                         float[] b)
Cross product


cross

public static void cross(float[] dst,
                         int dstIndex,
                         float[] a,
                         int aIndex,
                         float[] b,
                         int bIndex)
velocity x velocity product


crossForce

public static void crossForce(float[] dst,
                              float[] v,
                              float[] f)
movement x force, Featherstone's x* operation


crossForce

public static void crossForce(float[] dst,
                              int dstIndex,
                              float[] v,
                              int vIndex,
                              float[] f,
                              int fIndex)
movement x force, Featherstone's x* operation


epsilonEquals

public static boolean epsilonEquals(float[] a,
                                    float[] b,
                                    float epsilon)
Tests for equality of vector components within epsilon.


epsilonEquals

public static boolean epsilonEquals(float[] a,
                                    int aIndex,
                                    float[] b,
                                    int bIndex,
                                    float epsilon)
Tests for equality of vector components within epsilon.


toString

public static String toString(float[] a)
String representation


toString

public static String toString(float[] a,
                              int aIndex)
String representation