29package com.jogamp.opengl.test.junit.math;
31import org.junit.Assert;
33import org.junit.FixMethodOrder;
34import org.junit.runners.MethodSorters;
36import com.jogamp.junit.util.JunitTracer;
37import com.jogamp.math.FloatUtil;
38import com.jogamp.math.Matrix4f;
39import com.jogamp.math.Vec3f;
41@FixMethodOrder(MethodSorters.NAME_ASCENDING)
44 final float[] mI_0 =
new float[]{ 1, 0, 0, 0,
50 final float[] m1_0 =
new float[]{ 1, 3, 4, 0,
56 final float[] m1T_0 =
new float[]{ 1, 6, 98, 54,
62 final float[] m2_0 =
new float[]{ 1, 6, 98, 54,
68 final float[] m2xm1_0 =
69 new float[]{ 26, 59, 143, 71,
72 71, 386, 5370, 2954 };
75 final float[] m1xm2_0 =
76 new float[]{12557, 893, 748, 1182,
79 1182, 113, 104, 131 };
86 Assert.assertEquals(mI, m);
89 final float[] f16 =
new float[16];
94 Assert.assertEquals(m1, m);
101 final float[] r_0 =
new float[16];
103 Assert.assertArrayEquals(m1xm2_0, r_0, 0f);
105 Assert.assertEquals(m1xm2,
new Matrix4f(m1).mul(m2));
106 Assert.assertEquals(m1xm2,
new Matrix4f().mul(m1, m2));
109 final float[] r_0 =
new float[16];
111 Assert.assertArrayEquals(m2xm1_0, r_0, 0f);
113 Assert.assertEquals(m2xm1,
new Matrix4f(m2).mul(m1));
114 Assert.assertEquals(m2xm1,
new Matrix4f().mul(m2, m1));
120 Assert.assertEquals(m1T,
new Matrix4f(m1).transpose());
121 Assert.assertEquals(m1T,
new Matrix4f().transpose(m1));
146 Assert.assertEquals(exp, m);
171 Assert.assertEquals(exp, m);
174 public static void main(
final String args[]) {
Basic Float math utility functions.
static final float EPSILON
Epsilon for floating point {@value}, as once computed via getMachineEpsilon() on an AMD-64 CPU.
static void multMatrix(final float[] a, final int a_off, final float[] b, final int b_off, final float[] d, final int d_off)
Multiply matrix: [d] = [a] x [b].
Basic 4x4 float matrix implementation using fields for intensive use-cases (host operations).
Matrix4f load(final Matrix4f src)
Load the values of the given matrix src to this matrix.
float get(final int i)
Gets the ith component, 0 <= i < 16.
Matrix4f setToLookAt(final Vec3f eye, final Vec3f center, final Vec3f up, final Matrix4f tmp)
Set this matrix to the look-at matrix based on given parameters.
3D Vector based upon three float components.
void test80LookAtNegZIsNoOp()
static void main(final String args[])