|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jogamp.opengl.math.FloatUtil
public class FloatUtil
Basic Float math utility functions.
Implementation assumes linear matrix layout in column-major order matching OpenGL's implementation.
Derived from ProjectFloat.java - Created 11-jan-2004
Field Summary | |
---|---|
static float |
E
|
static float |
PI
|
Constructor Summary | |
---|---|
FloatUtil()
|
Method Summary | |
---|---|
static float |
abs(float a)
|
static float |
acos(float a)
|
static float |
cos(float a)
|
static void |
cross(float[] v1,
float[] v2,
float[] result)
Calculate cross-product of 2 vector |
static void |
cross(FloatBuffer v1,
FloatBuffer v2,
FloatBuffer result)
Calculate cross-product of 2 vector |
static void |
makeIdentityf(float[] m,
int offset)
Make matrix an identity matrix |
static void |
makeIdentityf(FloatBuffer m)
Make matrix an identity matrix |
static void |
makeZero(float[] m,
int offset)
Make matrix an zero matrix |
static void |
makeZero(FloatBuffer m)
Make matrix an zero matrix |
static StringBuilder |
matrixRowToString(StringBuilder sb,
String f,
float[] a,
int aOffset,
int rows,
int columns,
boolean rowMajorOrder,
int row)
|
static StringBuilder |
matrixRowToString(StringBuilder sb,
String f,
FloatBuffer a,
int aOffset,
int rows,
int columns,
boolean rowMajorOrder,
int row)
|
static StringBuilder |
matrixToString(StringBuilder sb,
String rowPrefix,
String f,
float[] a,
int aOffset,
float[] b,
int bOffset,
int rows,
int columns,
boolean rowMajorOrder)
|
static StringBuilder |
matrixToString(StringBuilder sb,
String rowPrefix,
String f,
float[] a,
int aOffset,
int rows,
int columns,
boolean rowMajorOrder)
|
static StringBuilder |
matrixToString(StringBuilder sb,
String rowPrefix,
String f,
FloatBuffer a,
int aOffset,
FloatBuffer b,
int bOffset,
int rows,
int columns,
boolean rowMajorOrder)
|
static StringBuilder |
matrixToString(StringBuilder sb,
String rowPrefix,
String f,
FloatBuffer a,
int aOffset,
int rows,
int columns,
boolean rowMajorOrder)
|
static void |
multMatrixf(float[] a,
int a_off,
float[] b,
int b_off)
|
static void |
multMatrixf(float[] a,
int a_off,
float[] b,
int b_off,
float[] d,
int d_off)
|
static void |
multMatrixf(float[] a,
int a_off,
float[] b,
int b_off,
FloatBuffer d)
|
static void |
multMatrixf(FloatBuffer a,
float[] b,
int b_off)
|
static void |
multMatrixf(FloatBuffer a,
float[] b,
int b_off,
FloatBuffer d)
|
static void |
multMatrixf(FloatBuffer a,
FloatBuffer b)
|
static void |
multMatrixf(FloatBuffer a,
FloatBuffer b,
float[] d,
int d_off)
|
static void |
multMatrixf(FloatBuffer a,
FloatBuffer b,
FloatBuffer d)
|
static void |
multMatrixVecf(float[] m_in,
float[] v_in,
float[] v_out)
|
static void |
multMatrixVecf(float[] m_in,
int m_in_off,
float[] v_in,
int v_in_off,
float[] v_out,
int v_out_off)
|
static void |
multMatrixVecf(FloatBuffer m_in,
float[] v_in,
float[] v_out)
|
static void |
multMatrixVecf(FloatBuffer m_in,
float[] v_in,
int v_in_off,
float[] v_out,
int v_out_off)
|
static void |
multMatrixVecf(FloatBuffer m_in,
FloatBuffer v_in,
FloatBuffer v_out)
|
static void |
normalize(float[] v)
Normalize vector |
static void |
normalize(FloatBuffer v)
Normalize vector |
static float |
pow(float a,
float b)
|
static float |
sin(float a)
|
static float |
sqrt(float a)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float E
public static final float PI
Constructor Detail |
---|
public FloatUtil()
Method Detail |
---|
public static final void makeIdentityf(float[] m, int offset)
public static final void makeIdentityf(FloatBuffer m)
public static final void makeZero(float[] m, int offset)
public static final void makeZero(FloatBuffer m)
public static final void multMatrixf(float[] a, int a_off, float[] b, int b_off, float[] d, int d_off)
a
- 4x4 matrix in column-major orderb
- 4x4 matrix in column-major orderd
- result a*b in column-major orderpublic static final void multMatrixf(float[] a, int a_off, float[] b, int b_off)
a
- 4x4 matrix in column-major order (also result)b
- 4x4 matrix in column-major orderpublic static final void multMatrixf(float[] a, int a_off, float[] b, int b_off, FloatBuffer d)
a
- 4x4 matrix in column-major orderb
- 4x4 matrix in column-major orderd
- result a*b in column-major orderpublic static final void multMatrixf(FloatBuffer a, float[] b, int b_off, FloatBuffer d)
a
- 4x4 matrix in column-major orderb
- 4x4 matrix in column-major orderd
- result a*b in column-major orderpublic static final void multMatrixf(FloatBuffer a, float[] b, int b_off)
a
- 4x4 matrix in column-major order (also result)b
- 4x4 matrix in column-major orderpublic static final void multMatrixf(FloatBuffer a, FloatBuffer b, FloatBuffer d)
a
- 4x4 matrix in column-major orderb
- 4x4 matrix in column-major orderd
- result a*b in column-major orderpublic static final void multMatrixf(FloatBuffer a, FloatBuffer b)
a
- 4x4 matrix in column-major order (also result)b
- 4x4 matrix in column-major orderpublic static final void multMatrixf(FloatBuffer a, FloatBuffer b, float[] d, int d_off)
a
- 4x4 matrix in column-major orderb
- 4x4 matrix in column-major orderd
- result a*b in column-major orderpublic static final void normalize(float[] v)
v
- makes len(v)==1public static final void normalize(FloatBuffer v)
v
- makes len(v)==1public static final void cross(float[] v1, float[] v2, float[] result)
v1
- 3-component vectorv2
- 3-component vectorresult
- v1 X v2public static final void cross(FloatBuffer v1, FloatBuffer v2, FloatBuffer result)
v1
- 3-component vectorv2
- 3-component vectorresult
- v1 X v2public static final void multMatrixVecf(float[] m_in, int m_in_off, float[] v_in, int v_in_off, float[] v_out, int v_out_off)
m_in
- 4x4 matrix in column-major orderm_in_off
- v_in
- 4-component column-vectorv_out
- m_in * v_inpublic static final void multMatrixVecf(float[] m_in, float[] v_in, float[] v_out)
m_in
- 4x4 matrix in column-major orderm_in_off
- v_in
- 4-component column-vectorv_out
- m_in * v_inpublic static final void multMatrixVecf(FloatBuffer m_in, float[] v_in, int v_in_off, float[] v_out, int v_out_off)
m_in
- 4x4 matrix in column-major orderv_in
- 4-component column-vectorv_out
- m_in * v_inpublic static final void multMatrixVecf(FloatBuffer m_in, float[] v_in, float[] v_out)
m_in
- 4x4 matrix in column-major orderv_in
- 4-component column-vectorv_out
- m_in * v_inpublic static final void multMatrixVecf(FloatBuffer m_in, FloatBuffer v_in, FloatBuffer v_out)
m_in
- 4x4 matrix in column-major orderv_in
- 4-component column-vectorv_out
- m_in * v_inpublic static StringBuilder matrixRowToString(StringBuilder sb, String f, FloatBuffer a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row)
sb
- optional passed StringBuilder instance to be usedf
- the format string of one floating point, i.e. "%10.5f", see Formatter
a
- mxn matrix (rows x columns)aOffset
- offset to a
's current positionrows
- columns
- rowMajorOrder
- if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)row
- row number to print
public static StringBuilder matrixRowToString(StringBuilder sb, String f, float[] a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row)
sb
- optional passed StringBuilder instance to be usedf
- the format string of one floating point, i.e. "%10.5f", see Formatter
a
- mxn matrix (rows x columns)aOffset
- offset to a
's current positionrows
- columns
- rowMajorOrder
- if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)row
- row number to print
public static StringBuilder matrixToString(StringBuilder sb, String rowPrefix, String f, FloatBuffer a, int aOffset, int rows, int columns, boolean rowMajorOrder)
sb
- optional passed StringBuilder instance to be usedrowPrefix
- optional prefix for each rowf
- the format string of one floating point, i.e. "%10.5f", see Formatter
a
- mxn matrix (rows x columns)aOffset
- offset to a
's current positionrows
- columns
- rowMajorOrder
- if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
public static StringBuilder matrixToString(StringBuilder sb, String rowPrefix, String f, float[] a, int aOffset, int rows, int columns, boolean rowMajorOrder)
sb
- optional passed StringBuilder instance to be usedrowPrefix
- optional prefix for each rowf
- the format string of one floating point, i.e. "%10.5f", see Formatter
a
- mxn matrix (rows x columns)aOffset
- offset to a
's current positionrows
- columns
- rowMajorOrder
- if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
public static StringBuilder matrixToString(StringBuilder sb, String rowPrefix, String f, FloatBuffer a, int aOffset, FloatBuffer b, int bOffset, int rows, int columns, boolean rowMajorOrder)
sb
- optional passed StringBuilder instance to be usedrowPrefix
- optional prefix for each rowf
- the format string of one floating point, i.e. "%10.5f", see Formatter
a
- 4x4 matrix in column major order (OpenGL)aOffset
- offset to a
's current positionb
- 4x4 matrix in column major order (OpenGL)bOffset
- offset to a
's current positionrows
- columns
- rowMajorOrder
- if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
public static StringBuilder matrixToString(StringBuilder sb, String rowPrefix, String f, float[] a, int aOffset, float[] b, int bOffset, int rows, int columns, boolean rowMajorOrder)
sb
- optional passed StringBuilder instance to be usedrowPrefix
- optional prefix for each rowf
- the format string of one floating point, i.e. "%10.5f", see Formatter
a
- 4x4 matrix in column major order (OpenGL)aOffset
- offset to a
's current positionb
- 4x4 matrix in column major order (OpenGL)bOffset
- offset to a
's current positionrows
- columns
- rowMajorOrder
- if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
public static float abs(float a)
public static float pow(float a, float b)
public static float sin(float a)
public static float cos(float a)
public static float acos(float a)
public static float sqrt(float a)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |