From fb8640a40e861c6e19b6b542dbd780ce4c6e3399 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Tue, 2 May 2023 17:55:47 +0200 Subject: [PATCH 01/27] Upwards including joints done --- CHANGELOG.txt | 2 + .../ode4j/ode/internal/joints/DxJoint.java | 16 +- .../ode/internal/joints/DxJointContact.java | 215 ++++++++++-------- .../ode/internal/joints/DxJointHinge2.java | 12 + .../ode4j/ode/internal/joints/DxJointPU.java | 4 + .../java/org/ode4j/tests/CollisionTest.java | 134 +++++++++-- .../java/org/ode4j/tests/TestOdeMath.java | 3 +- .../java/org/ode4j/tests/math/OdeMathTZ.java | 3 +- 8 files changed, 266 insertions(+), 123 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d0d48141..67ba6ff8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -42,6 +42,8 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col 0.5.0 (unreleased) ===== +- Port updates until 16.2. + TODO FIX prism dependency in ColliksionTest.test_collision_ray_convex() - Added GutHub Actions CI builds for Java 8 and 9. [#95](https://github.com/tzaeschke/ode4j/pull/95) - Added default logger for demos and tests. [#94](https://github.com/tzaeschke/ode4j/pull/94) - Added Android API compliance checker, now for API level 24 (the lowest that ode4j passed without changes) diff --git a/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java b/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java index 1a33f880..fa630bca 100644 --- a/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java +++ b/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java @@ -409,6 +409,13 @@ void setBall2(DxJoint joint, double fps, double erp, int rowskip, double[] J1A, dCalcVectorCross3(J1A, J1Ofs + rowskip + JointEnums.GI2__JA_MIN, a1, q1); dCalcVectorCross3(J1A, J1Ofs + 2 * rowskip + JointEnums.GI2__JA_MIN, a1, q2); + DxBody b0 = node[0].body; + dAddVectors3(a1, a1, b0.posr().pos()); + + // set right hand side - measure error along (axis,q1,q2) + double k1 = fps * erp1; + double k = fps * erp; + DxBody b1 = joint.node[1].body; if (b1 != null) { dCopyNegatedVector3(J2A, J2Ofs + JointEnums.GI2__JL_MIN, axis); @@ -422,16 +429,7 @@ void setBall2(DxJoint joint, double fps, double erp, int rowskip, double[] J1A, dCalcVectorCross3(J2A, J2Ofs + 2 * rowskip + JointEnums.GI2__JA_MIN, q2, a2); //== dCalcVectorCross3( J2 + // 2 * rowskip + JointEnums.GI2__J2A_MIN, a2, q2 ); dNegateVector3( J2 + 2 * rowskip + JointEnums // .GI2__J2A_MIN ); - } - // set right hand side - measure error along (axis,q1,q2) - double k1 = fps * erp1; - double k = fps * erp; - - DxBody b0 = joint.node[0].body; - dAddVectors3(a1, a1, b0.posr().pos()); - - if (b1 != null) { dAddVectors3(a2, a2, b1.posr().pos()); DVector3 a2_minus_a1 = new DVector3(); diff --git a/core/src/main/java/org/ode4j/ode/internal/joints/DxJointContact.java b/core/src/main/java/org/ode4j/ode/internal/joints/DxJointContact.java index 57dfa4ba..774e56dc 100644 --- a/core/src/main/java/org/ode4j/ode/internal/joints/DxJointContact.java +++ b/core/src/main/java/org/ode4j/ode/internal/joints/DxJointContact.java @@ -80,40 +80,69 @@ void getSureMaxInfo( SureMaxInfo info ) // make sure mu's >= 0, then calculate number of constraint rows and number // of unbounded rows. int m = 1, nub = 0; - boolean roll = (contact.surface.mode&OdeConstants.dContactRolling)!=0; - - if ( contact.surface.mu < 0 ) contact.surface.mu = 0; - - // Anisotropic sliding and rolling and spinning friction - if ( (contact.surface.mode & OdeConstants.dContactAxisDep) != 0 ) - { - if ( contact.surface.mu2 < 0 ) contact.surface.mu2 = 0; - if ( contact.surface.mu > 0 ) m++; - if ( contact.surface.mu2 > 0 ) m++; - if ( contact.surface.mu == dInfinity ) nub ++; - if ( contact.surface.mu2 == dInfinity ) nub ++; - if (roll) { - if ( contact.surface.rho < 0 ) contact.surface.rho = 0; - else m++; - if ( contact.surface.rho2 < 0 ) contact.surface.rho2 = 0; - else m++; - if ( contact.surface.rhoN < 0 ) contact.surface.rhoN = 0; - else m++; - - if ( contact.surface.rho == dInfinity ) nub++; - if ( contact.surface.rho2 == dInfinity ) nub++; - if ( contact.surface.rhoN == dInfinity ) nub++; - } + + // Anisotropic sliding and rolling and spinning friction + if ((contact.surface.mode & dContactAxisDep) != 0) { + if (contact.surface.mu < 0) { + contact.surface.mu = 0; + } + else if (contact.surface.mu > 0) { + if (contact.surface.mu == dInfinity) { nub++; } + m++; + } + + if (contact.surface.mu2 < 0) { + contact.surface.mu2 = 0; + } + else if (contact.surface.mu2 > 0) { + if (contact.surface.mu2 == dInfinity) { nub++; } + m++; + } + + if ((contact.surface.mode & dContactRolling) != 0) { + if (contact.surface.rho < 0) { + contact.surface.rho = 0; + } + else { + if (contact.surface.rho == dInfinity) { nub++; } + m++; + } + + if (contact.surface.rho2 < 0) { + contact.surface.rho2 = 0; + } + else { + if (contact.surface.rho2 == dInfinity) { nub++; } + m++; + } + + if (contact.surface.rhoN < 0) { + contact.surface.rhoN = 0; + } + else { + if (contact.surface.rhoN == dInfinity) { nub++; } + m++; + } + } } - else - { - if ( contact.surface.mu > 0 ) m += 2; - if ( contact.surface.mu == dInfinity ) nub += 2; - if (roll) { - if ( contact.surface.rho < 0 ) contact.surface.rho = 0; - else m+=3; - if ( contact.surface.rho == dInfinity ) nub += 3; - } + else { + if (contact.surface.mu < 0) { + contact.surface.mu = 0; + } + else if (contact.surface.mu > 0) { + if (contact.surface.mu == dInfinity) { nub += 2; } + m += 2; + } + + if ((contact.surface.mode & dContactRolling) != 0) { + if (contact.surface.rho < 0) { + contact.surface.rho = 0; + } + else { + if (contact.surface.rho == dInfinity) { nub += 3; } + m += 3; + } + } } the_m = m; @@ -131,33 +160,8 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A final int ROW_NORMAL = 0; final int ROW__OPTIONAL_MIN = 1; - // get normal, with sign adjusted for body1/body2 polarity - DVector3 normal = new DVector3(); - if (isFlagsReverse()) { - dCopyNegatedVector3(normal, contact.geom.normal); - } else { - dCopyVector3(normal, contact.geom.normal); - } - - // c1,c2 = contact points with respect to body PORs - DVector3 c1 = new DVector3(), c2 = new DVector3(0, 0, 0); - - DxBody b0 = node[0].body; - dSubtractVectors3(c1, contact.geom.pos, b0.posr().pos()); - - // set Jacobian for normal - dCopyVector3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JL_MIN, normal); - dCalcVectorCross3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, c1, normal); - - DxBody b1 = node[1].body; - if (b1 != null) { - dSubtractVectors3(c2, contact.geom.pos, b1.posr().pos()); - dCopyNegatedVector3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JL_MIN, normal); - dCalcVectorCross3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, normal, c2); //== dCalcVectorCross3( - // J2A, J2Ofs + GI2__JA_MIN, c2, normal ); dNegateVector3( J2A, J2Ofs + GI2__JA_MIN ); - } - final int surface_mode = contact.surface.mode; + // set right hand side and cfm value for normal double erp = (surface_mode & dContactSoftERP) != 0 ? contact.surface.soft_erp : worldERP; double k = worldFPS * erp; @@ -167,28 +171,59 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A double motionN = (surface_mode & dContactMotionN) != 0 ? contact.surface.motionN : 0.0; final double pushout = k * depth + motionN; + + boolean apply_bounce = (surface_mode & dContactBounce) != 0 && contact.surface.bounce_vel >= 0; + double outgoing = 0; + // note: this cap should not limit bounce velocity final double maxvel = world.contactp.max_vel; double c = pushout > maxvel ? maxvel : pushout; - // deal with bounce - if ((surface_mode & dContactBounce) != 0) { - // calculate outgoing velocity (-ve for incoming contact) - double outgoing = - dCalcVectorDot3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JL_MIN, node[0].body.lvel) - + dCalcVectorDot3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, node[0].body.avel); + // c1,c2 = contact points with respect to body PORs + DVector3 c1 = new DVector3(), c2 = new DVector3(); - if (b1 != null) { - outgoing += dCalcVectorDot3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JL_MIN, node[1].body.lvel) - + dCalcVectorDot3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, node[1].body.avel); + // get normal, with sign adjusted for body1/body2 polarity + DVector3 normal = new DVector3(); + if ((flags & dJOINT_REVERSE) != 0) { + dCopyNegatedVector3(normal, contact.geom.normal); + } + else { + dCopyVector3(normal, contact.geom.normal); + } + + DxBody b1 = node[1].body; + if (b1 != null) { + dSubtractVectors3(c2, contact.geom.pos, b1.posr().pos()); + // set Jacobian for b1 normal + dCopyNegatedVector3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JL_MIN, normal); + dCalcVectorCross3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, normal, c2); //== dCalcVectorCross3( J2 + GI2__JA_MIN, c2, normal ); dNegateVector3( J2 + GI2__JA_MIN ); + if (apply_bounce) { + outgoing /*+*/= dCalcVectorDot3(J2A, J2Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, node[1].body.avel) + - dCalcVectorDot3(normal, node[1].body.lvel); } + } + + DxBody b0 = node[0].body; + dSubtractVectors3(c1, contact.geom.pos, b0.posr().pos()); + // set Jacobian for b0 normal + dCopyVector3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JL_MIN, normal); + dCalcVectorCross3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, c1, normal); + if (apply_bounce) { + // calculate outgoing velocity (-ve for incoming contact) + outgoing += dCalcVectorDot3(J1A, J1Ofs + ROW_NORMAL * rowskip + GI2__JA_MIN, node[0].body.avel) + + dCalcVectorDot3(normal, node[0].body.lvel); + } - outgoing -= motionN; + // deal with bounce + if (apply_bounce) { + double negated_outgoing = motionN - outgoing; // only apply bounce if the outgoing velocity is greater than the // threshold, and if the resulting c[rowNormal] exceeds what we already have. - if (contact.surface.bounce_vel >= 0 && (-outgoing) > contact.surface.bounce_vel) { - final double newc = -contact.surface.bounce * outgoing + motionN; - if (newc > c) c = newc; + dIASSERT(contact.surface.bounce_vel >= 0); + if (/*contact.surface.bounce_vel >= 0 &&*/ + negated_outgoing > contact.surface.bounce_vel) { + final double newc = contact.surface.bounce * negated_outgoing + motionN; + if (newc > c) { c = newc; } } } @@ -218,7 +253,9 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A int currRowSkip = row * rowskip, currPairSkip = row * pairskip; // first friction direction - if (contact.surface.mu > 0) { + final double mu = contact.surface.mu; + + if (mu > 0) { dCopyVector3(J1A, J1Ofs + currRowSkip + GI2__JL_MIN, t1); dCalcVectorCross3(J1A, J1Ofs + currRowSkip + GI2__JA_MIN, c1, t1); @@ -239,8 +276,8 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A // set LCP bounds and friction index. this depends on the approximation // mode - pairLoHiA[pairLoHiOfs + currPairSkip + GI2_LO] = -contact.surface.mu; - pairLoHiA[pairLoHiOfs + currPairSkip + GI2_HI] = contact.surface.mu; + pairLoHiA[pairLoHiOfs + currPairSkip + GI2_LO] = -mu; + pairLoHiA[pairLoHiOfs + currPairSkip + GI2_HI] = mu; if ((surface_mode & dContactApprox1_1) != 0) { findexA[findexOfs + row] = 0; @@ -251,9 +288,8 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A currPairSkip += pairskip; } - final double mu2 = (surface_mode & dContactMu2) != 0 ? contact.surface.mu2 : contact.surface.mu; - // second friction direction + final double mu2 = (surface_mode & dContactMu2) != 0 ? contact.surface.mu2 : mu; if (mu2 > 0) { dCopyVector3(J1A, J1Ofs + currRowSkip + GI2__JL_MIN, t2); dCalcVectorCross3(J1A, J1Ofs + currRowSkip + GI2__JA_MIN, c1, t2); @@ -289,6 +325,15 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A // Handle rolling/spinning friction if ((surface_mode & dContactRolling) != 0) { + + DVector3C[] ax = { + t1, // Rolling around t1 creates movement parallel to t2 + t2, + normal // Spinning axis + }; + + final int[] approx_bits = { dContactApprox1_1, dContactApprox1_2, dContactApprox1_N }; + // Get the coefficients double[] rho = new double[3]; rho[0] = contact.surface.rho; @@ -300,17 +345,6 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A rho[2] = rho[0]; } - final DVector3C[] ax = new DVector3[3]; - ax[0] = t1; // Rolling around t1 creates movement parallel to t2 - ax[1] = t2; - ax[2] = normal; // Spinning axis - - // Should we use proportional force? - boolean[] approx = new boolean[3]; - approx[0] = (surface_mode & dContactApprox1_1) != 0; - approx[1] = (surface_mode & dContactApprox1_2) != 0; - approx[2] = (surface_mode & dContactApprox1_N) != 0; - for (int i = 0; i != 3; ++i) { if (rho[i] > 0) { // Set the angular axis @@ -324,8 +358,9 @@ public void getInfo2(double worldFPS, double worldERP, int rowskip, double[] J1A pairLoHiA[pairLoHiOfs + currPairSkip + GI2_LO] = -rho[i]; pairLoHiA[pairLoHiOfs + currPairSkip + GI2_HI] = rho[i]; - // Make limits proportional to normal force - if (approx[i]) { + // Should we use proportional force? + if ((surface_mode & approx_bits[i]) != 0) { + // Make limits proportional to normal force findexA[findexOfs + row] = 0; } diff --git a/core/src/main/java/org/ode4j/ode/internal/joints/DxJointHinge2.java b/core/src/main/java/org/ode4j/ode/internal/joints/DxJointHinge2.java index ec18a188..8687b70d 100644 --- a/core/src/main/java/org/ode4j/ode/internal/joints/DxJointHinge2.java +++ b/core/src/main/java/org/ode4j/ode/internal/joints/DxJointHinge2.java @@ -392,6 +392,12 @@ private void dJointGetHinge2Axis1( DVector3 result ) { dMultiply0_331( result, node[0].body.posr().R(), _axis1 ); } + else + { + // dZeroVector3(result); + result.setZero(); + dUASSERT( false, "the joint does not have first body attached" ); + } } @@ -402,6 +408,12 @@ private void dJointGetHinge2Axis2( DVector3 result ) { dMultiply0_331( result, node[1].body.posr().R(), _axis2 ); } + else + { + // dZeroVector3(result); + result.setZero(); + dUASSERT( false, "the joint does not have second body attached" ); + } } diff --git a/core/src/main/java/org/ode4j/ode/internal/joints/DxJointPU.java b/core/src/main/java/org/ode4j/ode/internal/joints/DxJointPU.java index 63c7bbd7..795a07e4 100644 --- a/core/src/main/java/org/ode4j/ode/internal/joints/DxJointPU.java +++ b/core/src/main/java/org/ode4j/ode/internal/joints/DxJointPU.java @@ -208,6 +208,10 @@ public double dJointGetPUPositionRate() if ( node[1].body!=null ) { // Find joint->anchor2 in global coordinates + + // NOTE! anchor2 needs a volatile assignment on the multiplication to discard computation errors. + // Otherwise, tests fail for single type on x86. + // dxTruncToType::dMultiply0_331(anchor2, joint->node[1].body->posr.R, joint->anchor2); dMultiply0_331( anchor2, node[1].body.posr().R(), _anchor2 ); // r.v[0] = ( node[0].body._posr.pos.v[0] - diff --git a/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java b/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java index f3b68460..5646befe 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java @@ -24,33 +24,17 @@ *************************************************************************/ package org.ode4j.tests; -import static org.ode4j.cpp.internal.ApiCppCollision.dCollide; -import static org.ode4j.cpp.internal.ApiCppCollision.dCreateHeightfield; -import static org.ode4j.cpp.internal.ApiCppCollision.dCreateRay; -import static org.ode4j.cpp.internal.ApiCppCollision.dCreateSphere; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomDestroy; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomHeightfieldDataBuildByte; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomHeightfieldDataCreate; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomHeightfieldDataDestroy; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomHeightfieldDataSetBounds; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomRaySet; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomSetPosition; -import static org.ode4j.cpp.internal.ApiCppCollision.dGeomSetRotation; +import static org.ode4j.cpp.internal.ApiCppCollision.*; import static org.ode4j.cpp.internal.ApiCppCollisionTrimesh.dCreateTriMesh; import static org.ode4j.cpp.internal.ApiCppCollisionTrimesh.dGeomTriMeshDataBuildSingle; import static org.ode4j.cpp.internal.ApiCppCollisionTrimesh.dGeomTriMeshDataCreate; -import static org.ode4j.tests.UnitTestPlusPlus.CheckMacros.CHECK_ARRAY_EQUAL; -import static org.ode4j.tests.UnitTestPlusPlus.CheckMacros.CHECK_EQUAL; +import static org.ode4j.ode.internal.Common.*; +import static org.ode4j.tests.UnitTestPlusPlus.CheckMacros.*; import org.junit.Test; import org.ode4j.math.DMatrix3; import org.ode4j.math.DVector3; -import org.ode4j.ode.DContactBuffer; -import org.ode4j.ode.DContactGeomBuffer; -import org.ode4j.ode.DGeom; -import org.ode4j.ode.DHeightfieldData; -import org.ode4j.ode.DRay; -import org.ode4j.ode.DTriMeshData; +import org.ode4j.ode.*; import org.ode4j.tests.UnitTestPlusPlus.TestSuperClass; /** @@ -199,4 +183,114 @@ public class CollisionTest extends TestSuperClass { } + // Copied from ConvexRayCollisionTest + private final int prism_pointcount = 8; + private final int prism_planecount = 6; + private final double prism_points[] = { 10.0, 1.0, -1.0, 10.0, -1.0, -1.0, -10.0, -1.0, -1.0, -10.0, 1.0, -1.0, + 10.0, 1.0, 1.0, 10.0, -1.0, 1.0, -10.0, -1.0, 1.0, -10.0, 1.0, 1.0 }; + + private final int prism_polygons[] = { 4, 0, 1, 2, 3, 4, 4, 7, 6, 5, 4, 0, 4, 5, 1, 4, 1, 5, 6, 2, 4, 2, 6, 7, 3, 4, + 4, 0, 3, 7, }; + + private final double prism_planes[] = { 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 10.0, 0.0, -1.0, + 0.0, 1.0, -1.0, 0.0, -0.0, 10.0, 0.0, 1.0, 0.0, 1.0, }; + + @Test + public void test_collision_ray_convex() + { + /* + * Issue 55: ray vs convex collider does not consider the position of the convex geometry. + */ + { + DContactBuffer all_contacts = new DContactBuffer(1); + DContactGeomBuffer contacts = all_contacts.getGeomBuffer(); + DContact contact = all_contacts.get(0); // TODO correct? + + // Create convex + DGeom convex = dCreateConvex(null, + prism_planes, + prism_planecount, + prism_points, + prism_pointcount, + prism_polygons); + dGeomSetPosition(convex,0,0,0); + + // Create ray + DRay ray = dCreateRay(null, 20); + + dGeomRaySet(ray, 0, -10, 0, 0, 1, 0); + + int count = dCollide(ray, convex, 1, contacts); + + CHECK_EQUAL(1,count); + CHECK_CLOSE(0.0,contact.geom.pos.get0(), dEpsilon); + CHECK_CLOSE(-1.0,contact.geom.pos.get1(), dEpsilon); + CHECK_CLOSE(0.0,contact.geom.pos.get2(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get0(), dEpsilon); + CHECK_CLOSE(-1.0, contact.geom.normal.get1(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get2(), dEpsilon); + CHECK_CLOSE(9.0, contact.geom.depth, dEpsilon); + + // Move Ray + dGeomRaySet(ray, 5, -10, 0, 0, 1, 0); + + count = dCollide(ray, convex, 1, contacts); + + CHECK_EQUAL(1,count); + CHECK_CLOSE(5.0, contact.geom.pos.get0(), dEpsilon); + CHECK_CLOSE(-1.0, contact.geom.pos.get1(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.pos.get2(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get0(), dEpsilon); + CHECK_CLOSE(-1.0, contact.geom.normal.get1(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get2(), dEpsilon); + CHECK_CLOSE(9.0, contact.geom.depth, dEpsilon); + + // Rotate Convex + DMatrix3 rotate90z = new DMatrix3( + + 0,-1,0,0, + 1,0,0,0, + 0,0,1,0 + ); + dGeomSetRotation(convex, rotate90z); + + count = dCollide(ray, convex, 1, contacts); + + CHECK_EQUAL(0,count); + + // Move Ray + dGeomRaySet(ray, 10, 0, 0, -1, 0, 0); + count = dCollide(ray, convex, 1, contacts); + + CHECK_EQUAL(1,count); + CHECK_CLOSE(1.0, contact.geom.pos.get0(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.pos.get1(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.pos.get2(), dEpsilon); + CHECK_CLOSE(1.0, contact.geom.normal.get0(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get1(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get2(), dEpsilon); + CHECK_CLOSE(9.0,contact.geom.depth, dEpsilon); + + + // Move Ray + dGeomRaySet(ray, 10, 1000, 1000, -1, 0, 0); + // Move Geom + dGeomSetPosition(convex, 0, 1000, 1000); + + count = dCollide(ray, convex, 1, contacts); + + CHECK_EQUAL(1, count); + CHECK_CLOSE(1.0, contact.geom.pos.get0(), dEpsilon); + CHECK_CLOSE(1000.0, contact.geom.pos.get1(), dEpsilon); + CHECK_CLOSE(1000.0, contact.geom.pos.get2(), dEpsilon); + CHECK_CLOSE(1.0, contact.geom.normal.get0(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get1(), dEpsilon); + CHECK_CLOSE(0.0, contact.geom.normal.get2(), dEpsilon); + CHECK_CLOSE(9.0, contact.geom.depth, dEpsilon); + + dGeomDestroy(convex); + dGeomDestroy(ray); + } + } + } diff --git a/demo-cpp/src/test/java/org/ode4j/tests/TestOdeMath.java b/demo-cpp/src/test/java/org/ode4j/tests/TestOdeMath.java index a0d13139..c16fd64e 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/TestOdeMath.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/TestOdeMath.java @@ -145,8 +145,7 @@ public class TestOdeMath { v3.set( 9999999999.0, 9999.0, 9.0 ); v3.normalize(); - CHECK_EQUAL(v3.length(), 1.0); - + CHECK_CLOSE(v3.length(), 1.0, 0.001); } diff --git a/demo-cpp/src/test/java/org/ode4j/tests/math/OdeMathTZ.java b/demo-cpp/src/test/java/org/ode4j/tests/math/OdeMathTZ.java index d79689d3..4e6b0b92 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/math/OdeMathTZ.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/math/OdeMathTZ.java @@ -154,8 +154,7 @@ public class OdeMathTZ { v3.set(9999999999.0, 9999.0, 9.0); v3.normalize(); - CHECK_EQUAL(v3.length(), 1.0); - + CHECK_CLOSE(v3.length(), 1.0, 0.001); } @Test public void test_dOrthogonalizeR() { From 54a381c328af1f16014fc20f1469e8f0cbecf3a3 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Tue, 2 May 2023 19:25:01 +0200 Subject: [PATCH 02/27] Upwards including joints done --- CHANGELOG.txt | 8 ++ .../java/org/ode4j/ode/internal/Common.java | 32 ++++--- .../java/org/ode4j/ode/internal/DxWorld.java | 88 +++++++++---------- .../java/org/ode4j/ode/internal/Step.java | 9 -- .../ode4j/ode/internal/processmem/DxUtil.java | 31 ++++--- .../processmem/DxWorldProcessContext.java | 24 +++-- .../processmem/DxWorldProcessMemArena.java | 4 +- .../java/org/ode4j/ode/threading/Atomics.java | 10 ++- 8 files changed, 109 insertions(+), 97 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 67ba6ff8..254ef670 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -44,6 +44,14 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col ===== - Port updates until 16.2. TODO FIX prism dependency in ColliksionTest.test_collision_ray_convex() + Not ported: + - resource_control.* + - simple_cooperation.* + - Updates to DxWorldProcessContext + - threaded_solver.ldlt.h + + DONE: backwards up until quickstep.cpp + - Added GutHub Actions CI builds for Java 8 and 9. [#95](https://github.com/tzaeschke/ode4j/pull/95) - Added default logger for demos and tests. [#94](https://github.com/tzaeschke/ode4j/pull/94) - Added Android API compliance checker, now for API level 24 (the lowest that ode4j passed without changes) diff --git a/core/src/main/java/org/ode4j/ode/internal/Common.java b/core/src/main/java/org/ode4j/ode/internal/Common.java index 991b7028..3634d90c 100644 --- a/core/src/main/java/org/ode4j/ode/internal/Common.java +++ b/core/src/main/java/org/ode4j/ode/internal/Common.java @@ -680,23 +680,21 @@ enum { public static int SIZE_MAX = Integer.MAX_VALUE; -//#ifndef offsetof -//#define offsetof(s, m) ((size_t)&(((s *)8)->m) - (size_t)8) -// #endif -//#ifndef membersize -//#define membersize(s, m) (sizeof(((s *)8)->m)) -// #endif -//#ifndef endoffsetof -//#define endoffsetof(s, m) ((size_t)((size_t)&(((s *)8)->m) - (size_t)8) + sizeof(((s *)8)->m)) -// #endif - -//#define dMACRO_MAX(a, b) ((a) > (b) ? (a) : (b)) -// #define dMACRO_MIN(a, b) ((a) < (b) ? (a) : (b)) - public static int dMACRO_MIN(int a, int b) { - return Math.min(a, b); - } -// -// #define dMAKE_PADDING_SIZE(DataType, ElementType) ((sizeof(DataType) + sizeof(ElementType) - 1) / sizeof(ElementType)) + //#ifndef offsetof + //#define offsetof(s, m) ((size_t)&(((s *)8)->m) - (size_t)8) + // #endif + //#ifndef membersize + //#define membersize(s, m) (sizeof(((s *)8)->m)) + // #endif + //#ifndef endoffsetof + //#define endoffsetof(s, m) ((size_t)((size_t)&(((s *)8)->m) - (size_t)8) + sizeof(((s *)8)->m)) + // #endif + + //#define dMACRO_MAX(a, b) ((a) > (b) ? (a) : (b)) + // #define dMACRO_MIN(a, b) ((a) < (b) ? (a) : (b)) + // public static int dMACRO_MIN(int a, int b) { + // return Math.min(a, b); + // } // template diff --git a/core/src/main/java/org/ode4j/ode/internal/DxWorld.java b/core/src/main/java/org/ode4j/ode/internal/DxWorld.java index 62ca30f3..0364870a 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxWorld.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxWorld.java @@ -281,50 +281,50 @@ int dWorldGetStepIslandsProcessingMaxThreadCount() return islands_max_threads; } - /** - * - * @param policyinfo - * @return x - * @deprecated Not used anymore: remove TODO - */ - @Deprecated - boolean dWorldSetStepMemoryReservationPolicy(final DWorldStepReserveInfo policyinfo) - { - dUASSERT (policyinfo==null || (policyinfo.struct_size >= DxUtil.sizeof(policyinfo) && policyinfo.reserve_factor >= 1.0f), "Bad policy info"); - - boolean result = false; - - //(TZ) DxStepWorkingMemory wmem = policyinfo!=null ? AllocateOnDemand(this.wmem) : this.wmem; - DxStepWorkingMemory wmem; - if (policyinfo!=null) { - if (this.wmem == null) { - this.wmem = new DxStepWorkingMemory(); - } - wmem = this.wmem; - } else { - wmem = this.wmem; - } - - if (wmem!=null) - { - if (policyinfo!=null) - { - wmem.SetMemoryReserveInfo(policyinfo.reserve_factor, policyinfo.reserve_minimum); - result = wmem.GetMemoryReserveInfo() != null; - } - else - { - wmem.ResetMemoryReserveInfoToDefault(); - result = true; - } - } - else if (policyinfo==null) - { - result = true; - } - - return result; - } + // /** + // * + // * @param policyinfo + // * @return x + // * @deprecated Not used anymore + // */ + // @Deprecated + // boolean dWorldSetStepMemoryReservationPolicy(final DWorldStepReserveInfo policyinfo) + // { + // dUASSERT (policyinfo==null || (policyinfo.struct_size >= DxUtil.sizeof(policyinfo) && policyinfo.reserve_factor >= 1.0f), "Bad policy info"); + // + // boolean result = false; + // + // //(TZ) DxStepWorkingMemory wmem = policyinfo!=null ? AllocateOnDemand(this.wmem) : this.wmem; + // DxStepWorkingMemory wmem; + // if (policyinfo!=null) { + // if (this.wmem == null) { + // this.wmem = new DxStepWorkingMemory(); + // } + // wmem = this.wmem; + // } else { + // wmem = this.wmem; + // } + // + // if (wmem!=null) + // { + // if (policyinfo!=null) + // { + // wmem.SetMemoryReserveInfo(policyinfo.reserve_factor, policyinfo.reserve_minimum); + // result = wmem.GetMemoryReserveInfo() != null; + // } + // else + // { + // wmem.ResetMemoryReserveInfoToDefault(); + // result = true; + // } + // } + // else if (policyinfo==null) + // { + // result = true; + // } + // + // return result; + // } boolean dWorldStep (double stepsize) diff --git a/core/src/main/java/org/ode4j/ode/internal/Step.java b/core/src/main/java/org/ode4j/ode/internal/Step.java index 9eea11a6..062ce09c 100644 --- a/core/src/main/java/org/ode4j/ode/internal/Step.java +++ b/core/src/main/java/org/ode4j/ode/internal/Step.java @@ -1582,23 +1582,14 @@ void dxStepIsland_Stage3(dxStepperStage3CallContext stage3CallContext) stage3CallContext = null; // WARNING! stage3CallContext is not valid after this point! dIVERIFY(stage3CallContext == null); // To suppress unused variable assignment warnings - double[] invI = localContext.m_invI; - dJointWithInfo1[] jointinfosA = localContext.m_jointinfosA; - int jointinfosP = localContext.m_jointinfosOfs; - int nj = localContext.m_nj; int m = localContext.m_m; int nub = localContext.m_nub; //const unsigned int *mindex = localContext.m_mindex; int[] findex = localContext.m_findex; - double[] J = localContext.m_J; double[] A = localContext.m_A; double[] pairsRhsLambda = localContext.m_pairsRhsCfm; // Reuse cfm buffer for lambdas as the former values are not needed any more double[] pairsLoHi = localContext.m_pairsLoHi; - DxBody[] bodyA = callContext.m_islandBodiesStartA(); - int bodyP = callContext.m_islandBodiesStartOfs(); - int nb = callContext.m_islandBodiesCount(); - if (m > 0) { BlockPointer lcpstate = memarena.BEGIN_STATE_SAVE(); { diff --git a/core/src/main/java/org/ode4j/ode/internal/processmem/DxUtil.java b/core/src/main/java/org/ode4j/ode/internal/processmem/DxUtil.java index 2d050f3a..1fc067b2 100644 --- a/core/src/main/java/org/ode4j/ode/internal/processmem/DxUtil.java +++ b/core/src/main/java/org/ode4j/ode/internal/processmem/DxUtil.java @@ -58,23 +58,22 @@ public class DxUtil { 1.2f, //dWORLDSTEP_RESERVEFACTOR_DEFAULT, 65536);// dWORLDSTEP_RESERVESIZE_DEFAULT); - - static final int sizeof(Class cls) { - if (cls == DxWorldProcessMemArena.class) { - return -1; - } - return -1; - } - - public static final int sizeof(Object o) { - if (o instanceof Class) { - return sizeof((Class)o); - } - return sizeof(o.getClass()); - } - + + /* the efficient alignment. most platforms align data structures to some + * number of bytes, but this is not always the most efficient alignment. + * for example, many x86 compilers align to 4 bytes, but on a pentium it + * is important to align doubles to 8 byte boundaries (for speed), and + * the 4 floats in a SIMD register to 16 byte boundaries. many other + * platforms have similar behavior. setting a larger alignment can waste + * a (very) small amount of memory. NOTE: this number must be a power of + * two. this is set to 16 by default. + */ public static final int EFFICIENT_ALIGNMENT = 16; - + + /* ********************************************************************************************************* */ + /* ************************* TZ: This has been move here from Common because it is mostly required here **** */ + /* ********************************************************************************************************* */ + // #define dEFFICIENT_SIZE(x) (((x)+(EFFICIENT_ALIGNMENT-1)) & ~((size_t)(EFFICIENT_ALIGNMENT-1))) static final int dEFFICIENT_SIZE(int x) { return x; diff --git a/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessContext.java b/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessContext.java index 794a637d..39653abe 100644 --- a/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessContext.java +++ b/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessContext.java @@ -105,6 +105,14 @@ public void DESTRUCTOR() { Common.dIASSERT((m_pswObjectsAllocWorld != null) == (m_pmgStepperMutexGroup != null)); + // TODO TZ: Ignored for migration to 0.16.2 + // if (m_pswObjectsAllocWorld != null) + // { + // throw new UnsupportedOperationException("This has not been ported yet from ODE"); + // // TODO m_pswObjectsAllocWorld->FreeMutexGroup(m_pmgStepperMutexGroup); + // // m_pswObjectsAllocWorld->FreeThreadedCallWait(m_pcwIslandsSteppingWait); -- The stock call wait can not be freed + // } + DxWorldProcessMemArena pmaStepperArenas = m_pmaStepperArenas.get(); if (pmaStepperArenas != null) { @@ -396,14 +404,16 @@ public static boolean dxReallocateWorldProcessContext (DxWorld world, DxWorldPro //TODO this is just wrong!!!! (TZ) int stepperReqWithCallContext = stepperReq + DxUtil.dEFFICIENT_SIZE(1);//DxSingleIslandCallContext.class); - int islandThreadsCount = world.GetThreadingIslandsMaxThreadsCount(null); - if (!context.ReallocateStepperMemArenas(world, islandThreadsCount, stepperReqWithCallContext, - memmgr, reserveInfo.m_fReserveFactor, reserveInfo.m_uiReserveMinimum)) - { - break; - } + // TODO TZ: This has not been migrfated from ODE 0.16.2 + // throw new UnsupportedOperationException("This has not been ported yet from ODE"); + int islandThreadsCount = world.GetThreadingIslandsMaxThreadsCount(null); + if (!context.ReallocateStepperMemArenas(world, islandThreadsCount, stepperReqWithCallContext, + memmgr, reserveInfo.m_fReserveFactor, reserveInfo.m_uiReserveMinimum)) + { + break; + } - result = true; + result = true; } while (false); diff --git a/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessMemArena.java b/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessMemArena.java index 7ab6ce57..2de04472 100644 --- a/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessMemArena.java +++ b/core/src/main/java/org/ode4j/ode/internal/processmem/DxWorldProcessMemArena.java @@ -36,8 +36,8 @@ public final class DxWorldProcessMemArena { // public: // #define BUFFER_TO_ARENA_EXTRA (EFFICIENT_ALIGNMENT + dEFFICIENT_SIZE(sizeof(dxWorldProcessMemArena))) private final static int BUFFER_TO_ARENA_EXTRA () { - return (DxUtil.EFFICIENT_ALIGNMENT + DxUtil.dEFFICIENT_SIZE( - DxUtil.sizeof(DxWorldProcessMemArena.class))); + return 0; //(DxUtil.EFFICIENT_ALIGNMENT + DxUtil.dEFFICIENT_SIZE( + //DxUtil.sizeof(DxWorldProcessMemArena.class))); } static boolean IsArenaPossible(int nBufferSize) diff --git a/core/src/main/java/org/ode4j/ode/threading/Atomics.java b/core/src/main/java/org/ode4j/ode/threading/Atomics.java index 759ee060..7206fb02 100644 --- a/core/src/main/java/org/ode4j/ode/threading/Atomics.java +++ b/core/src/main/java/org/ode4j/ode/threading/Atomics.java @@ -57,7 +57,10 @@ public static int ThrsafeIncrementIntUpToLimit(AtomicInteger storagePointer, int int resultValue; while (true) { resultValue = storagePointer.get(); - if (resultValue == limitValue) { + // The ">=" comparison is used here to allow continuing incrementing the destination + // without waiting for all the threads to pass the barrier of checking its value + if (resultValue >= limitValue) { + resultValue = limitValue; break; } if (ThrsafeCompareExchange(storagePointer, resultValue, resultValue + 1)) { @@ -72,7 +75,10 @@ public static int ThrsafeIncrementSizeUpToLimit(AtomicInteger storagePointer, in int resultValue; while (true) { resultValue = storagePointer.get(); - if (resultValue == limitValue) { + // The ">=" comparison is not required here at present ("==" could be used). + // It is just used this way to match the other function above. + if (resultValue >= limitValue) { + resultValue = limitValue; break; } //if (ThrsafeCompareExchangePointer((volatile atomicptr *)storagePointer, (atomicptr)resultValue, (atomicptr)(resultValue + 1))) { From 4c8bb88a33ced55df4eff5b6a95329a201b188ca Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 14:53:11 +0200 Subject: [PATCH 03/27] Upwards including joints done + libCCD --- CHANGELOG.txt | 5 +- .../ode4j/cpp/internal/ApiCppMathMatrix.java | 16 +++- core/src/main/java/org/ode4j/ode/DWorld.java | 4 +- .../ode4j/ode/internal/CollisionLibccd.java | 16 ++-- .../org/ode4j/ode/internal/libccd/CCD.java | 16 ++-- .../ode/internal/libccd/CCDCustomQuat.java | 59 ++++++++++++ .../ode/internal/libccd/CCDCustomVec3.java | 86 +++++++++++++++++ .../org/ode4j/ode/internal/libccd/CCDMPR.java | 96 +++++++++++++------ .../ode4j/ode/internal/libccd/CCDQuat.java | 21 ++-- .../ode4j/ode/internal/libccd/CCDVec3.java | 46 +-------- .../org/ode4j/tests/libccd/CCDTestBench.java | 2 +- .../org/ode4j/tests/libccd/CCDTestBench2.java | 2 +- 12 files changed, 258 insertions(+), 111 deletions(-) create mode 100644 core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomQuat.java create mode 100644 core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomVec3.java diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 254ef670..d49acac2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -42,7 +42,8 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col 0.5.0 (unreleased) ===== -- Port updates until 16.2. +- Port updates until 0.16.2. + THis includes some libCCD updates missing fro the 0.15.1 update. TODO FIX prism dependency in ColliksionTest.test_collision_ray_convex() Not ported: - resource_control.* @@ -65,7 +66,7 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col (Cleanup, part of this was done with the move to 0.15.1) - Update to ODE 0.15.1 [#86](https://github.com/tzaeschke/ode4j/pull/86) - This includes increased stability, e.g. the DemoCards won't collapse anymore when 30 levels high. - - **** WARNING **** : Still missing: libccd and trimesh collider updates. + - **** WARNING **** : Still missing: trimesh collider updates. - Changed CI build requirements: - Removed openjdk7: Not required. source compatibility is still set to 7, but should be safe to change to 8 now (Android Nougat is mostly 8 compatible), this covers > 80% users. diff --git a/core-cpp/src/main/java/org/ode4j/cpp/internal/ApiCppMathMatrix.java b/core-cpp/src/main/java/org/ode4j/cpp/internal/ApiCppMathMatrix.java index 819e875f..1e8d94d4 100644 --- a/core-cpp/src/main/java/org/ode4j/cpp/internal/ApiCppMathMatrix.java +++ b/core-cpp/src/main/java/org/ode4j/cpp/internal/ApiCppMathMatrix.java @@ -218,11 +218,21 @@ void dSolveL1T (final DMatrix3C L, DVector3 b, int n, int nskip) { throw new UnsupportedOperationException(); } + /* in matlab syntax: a(1:n) = a(1:n) .* d(1:n) + */ - /** in matlab syntax: a(1:n) = a(1:n) .* d(1:n) */ + // ODE_API void dScaleVector (dReal *a, const dReal *d, int n); + void dScaleVector (DVector3 a, final DVector3C d, int n) { + throw new UnsupportedOperationException(); + } - //ODE_API - // void dVectorScale (double *a, final double *d, int n) { + /* The function is an alias for @c dScaleVector. + * It has been deprecated because of a wrong naming schema used. + */ + //ODE_API_DEPRECATED + // ODE_API + // void dVectorScale (dReal *a, const dReal *d, int n) + @Deprecated void dVectorScale (DVector3C a, final DVector3 d, int n) { throw new UnsupportedOperationException(); } diff --git a/core/src/main/java/org/ode4j/ode/DWorld.java b/core/src/main/java/org/ode4j/ode/DWorld.java index 24d5e0f3..510c223c 100644 --- a/core/src/main/java/org/ode4j/ode/DWorld.java +++ b/core/src/main/java/org/ode4j/ode/DWorld.java @@ -185,7 +185,9 @@ public interface DWorld { */ double getCFM() ; - public static int dWORLDSTEP_THREADCOUNT_UNLIMITED = 0; + // TZ: This should be in threading.h + static int dTHREADING_THREAD_COUNT_UNLIMITED = 0; + public static int dWORLDSTEP_THREADCOUNT_UNLIMITED = dTHREADING_THREAD_COUNT_UNLIMITED; /** * Set maximum threads to be used for island stepping diff --git a/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java b/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java index 15844f09..982fc314 100644 --- a/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java +++ b/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java @@ -42,6 +42,8 @@ import static org.ode4j.ode.internal.CommonEnums.*; import static org.ode4j.ode.internal.DxCollisionUtil.dQuatTransform; import static org.ode4j.ode.internal.libccd.CCD.*; +import static org.ode4j.ode.internal.libccd.CCDCustomQuat.ccdQuatRotVec2; +import static org.ode4j.ode.internal.libccd.CCDCustomVec3.*; import static org.ode4j.ode.internal.libccd.CCDMPR.*; import static org.ode4j.ode.internal.libccd.CCDQuat.*; import static org.ode4j.ode.internal.libccd.CCDVec3.*; @@ -197,9 +199,8 @@ static void ccdGeomToCyl(final DxCylinder g, ccd_cyl_t cyl) { ccdQuatRotVec(cyl.axis, cyl.rot); ccdVec3Copy(cyl.p1, cyl.axis); ccdVec3Copy(cyl.p2, cyl.axis); - boolean cylAxisNormalizationResult = ccdVec3Normalize(cyl.axis); - dUVERIFY(!cylAxisNormalizationResult, "Invalid cylinder has been passed"); - ccdVec3Normalize(cyl.axis); + int cylAxisNormalizationResult = ccdVec3SafeNormalize(cyl.axis); + dUVERIFY(cylAxisNormalizationResult != 0, "Invalid cylinder has been passed"); ccdVec3Scale(cyl.p2, -1.0); ccdVec3Add(cyl.p1, cyl.pos); ccdVec3Add(cyl.p2, cyl.pos); @@ -696,10 +697,9 @@ static boolean correctTriangleContactNormal(ccd_triangle_t t, DContactGeom conta // Triangle face normal ccd_vec3_t triNormal = new ccd_vec3_t(); ccdVec3Cross(triNormal, edges[dMTV_FIRST], edges[dMTV_SECOND]); - // if (ccdVec3Normalize(triNormal)) { - // anyFault = true; - // } - anyFault |= ccdVec3Normalize(triNormal); + if (ccdVec3SafeNormalize(triNormal) != 0) { + anyFault = true; + } // Check the edges to see if one of them is involved for (int testEdgeIndex = !anyFault ? dMTV__MIN : dMTV__MAX; testEdgeIndex != dMTV__MAX; ++testEdgeIndex) { @@ -707,7 +707,7 @@ static boolean correctTriangleContactNormal(ccd_triangle_t t, DContactGeom conta ccd_vec3_t edgeAxis = edges[testEdgeIndex]; // Edge axis - if (ccdVec3Normalize(edgeAxis)) { + if (ccdVec3SafeNormalize(edgeAxis) != 0) { // This should not happen normally as in the case on of edges is degenerated // the triangle normal calculation would have to fail above. If for some // reason the above calculation succeeds and this one would not, it is diff --git a/core/src/main/java/org/ode4j/ode/internal/libccd/CCD.java b/core/src/main/java/org/ode4j/ode/internal/libccd/CCD.java index feb15e65..d9415dfb 100644 --- a/core/src/main/java/org/ode4j/ode/internal/libccd/CCD.java +++ b/core/src/main/java/org/ode4j/ode/internal/libccd/CCD.java @@ -26,6 +26,7 @@ import org.ode4j.ode.internal.libccd.CCDSimplex.ccd_simplex_t; import org.ode4j.ode.internal.libccd.CCDVec3.ccd_vec3_t; +import static org.ode4j.ode.internal.libccd.CCDCustomVec3.ccdVec3SafeNormalize; import static org.ode4j.ode.internal.libccd.CCDPolyTope.*; import static org.ode4j.ode.internal.libccd.CCDSimplex.*; import static org.ode4j.ode.internal.libccd.CCDSupport.*; @@ -242,7 +243,7 @@ public static int ccdGJKPenetration(final Object obj1, final Object obj2, final RefDouble depth, ccd_vec3_t dir, ccd_vec3_t pos) { ccd_pt_t polytope = new ccd_pt_t(); - final Ref> nearestRef = new Ref>(); + final Ref> nearestRef = new Ref<>(); int ret; ccdPtInit(polytope); @@ -251,15 +252,16 @@ public static int ccdGJKPenetration(final Object obj1, final Object obj2, final // set separation vector if (ret == 0 && nearestRef.get() != null){ - // compute depth of penetration - depth.set( CCD_SQRT(nearestRef.get().dist) ); - // store normalized direction vector ccdVec3Copy(dir, nearestRef.get().witness); - ccdVec3Normalize(dir); + ret = ccdVec3SafeNormalize(dir); - // compute position - penEPAPos(polytope, nearestRef.get(), pos); + if (ret == 0) { + // compute depth of penetration + depth.d = CCD_SQRT(nearestRef.get().dist); + // compute position + penEPAPos(polytope, nearestRef.get(), pos); + } } ccdPtDestroy(polytope); diff --git a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomQuat.java b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomQuat.java new file mode 100644 index 00000000..50479a92 --- /dev/null +++ b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomQuat.java @@ -0,0 +1,59 @@ +/*** + * libccd + * --------------------------------- + * Copyright (c)2010 Daniel Fiser + * Java-port: Copyright (c) 2009-2014 Tilmann Zaeschke + * + * + * This file is part of libccd. + * + * Distributed under the OSI-approved BSD License (the "License"); + * see accompanying file BDS-LICENSE for details or see + * . + * + * This software is distributed WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the License for more information. + */ +package org.ode4j.ode.internal.libccd; + +import static org.ode4j.ode.internal.libccd.CCDQuat.*; +import static org.ode4j.ode.internal.libccd.CCDVec3.*; + +public class CCDCustomQuat { + + /** + * Rotate vector s by quaternion q and put result into d. + */ + // _ccd_inline void ccdQuatRotVec2(ccd_vec3_t *d, const ccd_vec3_t *s, const ccd_quat_t *q); + public static void ccdQuatRotVec2(ccd_vec3_t d, final ccd_vec3_t s, final ccd_quat_t q) { +//#ifndef dLIBCCD_USE_SYSTEM +// // original version: 31 mul + 21 add +// // optimized version: 18 mul + 12 add +// // formula: d = s + 2 * cross(q.xyz, cross(q.xyz, v) + q.w * s) +// ccd_real_t cross1_x, cross1_y, cross1_z, cross2_x, cross2_y, cross2_z; +// ccd_real_t x, y, z, w; +// ccd_real_t vx, vy, vz; +// +// vx = ccdVec3X(s); +// vy = ccdVec3Y(s); +// vz = ccdVec3Z(s); +// +// w = q->q[3]; +// x = q->q[0]; +// y = q->q[1]; +// z = q->q[2]; +// +// cross1_x = y * vz - z * vy + w * vx; +// cross1_y = z * vx - x * vz + w * vy; +// cross1_z = x * vy - y * vx + w * vz; +// cross2_x = y * cross1_z - z * cross1_y; +// cross2_y = z * cross1_x - x * cross1_z; +// cross2_z = x * cross1_y - y * cross1_x; +// ccdVec3Set(d, vx + 2 * cross2_x, vy + 2 * cross2_y, vz + 2 * cross2_z); +//#else + ccdVec3Copy(d, s); + ccdQuatRotVec(d, q); +//#endif + } +} diff --git a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomVec3.java b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomVec3.java new file mode 100644 index 00000000..7f245fe8 --- /dev/null +++ b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDCustomVec3.java @@ -0,0 +1,86 @@ +/*** + * libccd + * --------------------------------- + * Copyright (c)2010,2011 Daniel Fiser + * Java-port: Copyright (c) 2009-2014 Tilmann Zaeschke + * + * + * This file is part of libccd. + * + * Distributed under the OSI-approved BSD License (the "License"); + * see accompanying file BDS-LICENSE for details or see + * . + * + * This software is distributed WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the License for more information. + */ +package org.ode4j.ode.internal.libccd; + +import static org.ode4j.ode.internal.libccd.CCDVec3.*; + +public class CCDCustomVec3 { + + // # define CCD_ATAN2(x, y) (atan2((x), (y))) /*!< atan2 of two floats */ + public static double CCD_ATAN2(double x, double y) { + return Math.atan2(x, y); + } + + /** + * d = v + w + */ + public static void ccdVec3Add2(ccd_vec3_t d, final ccd_vec3_t v, final ccd_vec3_t w) { +//#ifndef dLIBCCD_USE_SYSTEM +// d->v[0] = v->v[0] + w->v[0]; +// d->v[1] = v->v[1] + w->v[1]; +// d->v[2] = v->v[2] + w->v[2]; +//#else + ccdVec3Copy(d, v); + ccdVec3Add(d, w); +//#endif + } + + /** + * d = s * k; + */ + public static void ccdVec3CopyScaled(ccd_vec3_t d, final ccd_vec3_t s, double k) { +//#ifndef dLIBCCD_USE_SYSTEM +// d->v[0] = s->v[0] * k; +// d->v[1] = s->v[1] * k; +// d->v[2] = s->v[2] * k; +//#else + ccdVec3Copy(d, s); + ccdVec3Scale(d, k); +//#endif + } + + /** + * d = v + s * k; + */ + public static void ccdVec3AddScaled(ccd_vec3_t d, final ccd_vec3_t v, final ccd_vec3_t s, double k) { +//#ifndef dLIBCCD_USE_SYSTEM +// d->v[0] = v->v[0] + s->v[0] * k; +// d->v[1] = v->v[1] + s->v[1] * k; +// d->v[2] = v->v[2] + s->v[2] * k; +//#else + ccdVec3Copy(d, s); + ccdVec3Scale(d, k); + ccdVec3Add(d, v); +//#endif + } + + /** + * Normalizes given vector to unit length. + */ + public static int ccdVec3SafeNormalize(ccd_vec3_t d) { + int result = -1; + + double len = CCD_SQRT(ccdVec3Len2(d)); + if (len >= CCD_EPS) { + ccdVec3Scale(d, CCD_ONE / len); + result = 0; + } + + return result; + } +} diff --git a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDMPR.java b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDMPR.java index d6433d07..036bff51 100644 --- a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDMPR.java +++ b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDMPR.java @@ -20,6 +20,7 @@ import org.ode4j.ode.internal.cpp4j.java.RefDouble; import org.ode4j.ode.internal.libccd.CCD.ccd_t; +import static org.ode4j.ode.internal.libccd.CCDCustomVec3.ccdVec3SafeNormalize; import static org.ode4j.ode.internal.libccd.CCDSimplex.*; import static org.ode4j.ode.internal.libccd.CCDSupport.*; import static org.ode4j.ode.internal.libccd.CCDVec3.*; @@ -86,22 +87,27 @@ public static int ccdMPRPenetration(final Object obj1, final Object obj2, final // Origin isn't inside portal - no collision. return -1; - }else if (res == 1){ + } else if (res == 1) { // Touching contact on portal's v1. findPenetrTouch(obj1, obj2, ccd, portal, depth, dir, pos); - }else if (res == 2){ + } else if (res == 2) { // Origin lies on v0-v1 segment. - findPenetrSegment(obj1, obj2, ccd, portal, depth, dir, pos); + if (findPenetrSegment(obj1, obj2, ccd, portal, depth, dir, pos) != 0) { + return -1; + } - }else if (res == 0){ + } else if (res == 0) { // Phase 2: Portal refinement res = refinePortal(obj1, obj2, ccd, portal); - if (res < 0) - return -1; + if (res < 0) { + return -1; + } // Phase 3. Penetration info - findPenetr(obj1, obj2, ccd, portal, depth, dir, pos); + if (findPenetr(obj1, obj2, ccd, portal, depth, dir, pos) != 0) { + return -1; + } } return 0; @@ -152,8 +158,10 @@ private static int discoverPortal(final Object obj1, final Object obj2, // vertex 1 = support in direction of origin ccdVec3Copy(dir, ccdSimplexPoint0(portal).v); ccdVec3Scale(dir, (-1.)); - ccdVec3Normalize(dir); - __ccdSupport(obj1, obj2, dir, ccd, ccdSimplexPointW1(portal)); + if (ccdVec3SafeNormalize(dir) != 0) { + return -1; + } + __ccdSupport(obj1, obj2, dir, ccd, ccdSimplexPointW1(portal)); ccdSimplexSetSize(portal,2); // test if origin isn't outside of v1 @@ -175,11 +183,14 @@ private static int discoverPortal(final Object obj1, final Object obj2, } } - ccdVec3Normalize(dir); + if (ccdVec3SafeNormalize(dir) != 0) { + return -1; + } __ccdSupport(obj1, obj2, dir, ccd, ccdSimplexPointW2(portal)); dot = ccdVec3Dot(ccdSimplexPoint2(portal).v, dir); - if (ccdIsZero(dot) || dot < CCD_ZERO) - return -1; + if (ccdIsZero(dot) || dot < CCD_ZERO) { + return -1; + } ccdSimplexSetSize(portal, 3); @@ -189,7 +200,9 @@ private static int discoverPortal(final Object obj1, final Object obj2, ccdVec3Sub2(vb, ccdSimplexPoint2(portal).v, ccdSimplexPoint0(portal).v); ccdVec3Cross(dir, va, vb); - ccdVec3Normalize(dir); + if (ccdVec3SafeNormalize(dir) != 0) { + return -1; + } // it is better to form portal faces to be oriented "outside" origin dot = ccdVec3Dot(dir, ccdSimplexPoint0(portal).v); @@ -201,8 +214,9 @@ private static int discoverPortal(final Object obj1, final Object obj2, while (ccdSimplexSize(portal) < 4){ __ccdSupport(obj1, obj2, dir, ccd, ccdSimplexPointW3(portal)); dot = ccdVec3Dot(ccdSimplexPoint3(portal).v, dir); - if (ccdIsZero(dot) || dot < CCD_ZERO) - return -1; + if (ccdIsZero(dot) || dot < CCD_ZERO) { + return -1; + } cont = 0; @@ -234,8 +248,10 @@ private static int discoverPortal(final Object obj1, final Object obj2, ccdVec3Sub2(vb, ccdSimplexPoint2(portal).v, ccdSimplexPoint0(portal).v); ccdVec3Cross(dir, va, vb); - ccdVec3Normalize(dir); - }else{ + if (ccdVec3SafeNormalize(dir) != 0) { + return -1; + } + } else { ccdSimplexSetSize(portal, 4); } } @@ -255,7 +271,9 @@ private static int refinePortal(final Object obj1, final Object obj2, while (true){ // compute direction outside the portal (from v0 throught v1,v2,v3 // face) - portalDir(portal, dir); + if (portalDir(portal, dir) != 0) { + return -1; + } // test if origin is inside the portal if (portalEncapsulesOrigin(portal, dir)) @@ -282,7 +300,7 @@ private static int refinePortal(final Object obj1, final Object obj2, /** Finds penetration info by expanding provided portal. */ - private static void findPenetr(final Object obj1, final Object obj2, final ccd_t ccd, + private static int findPenetr(final Object obj1, final Object obj2, final ccd_t ccd, ccd_simplex_t portal, RefDouble depth, ccd_vec3_t pdir, ccd_vec3_t pos) { @@ -293,8 +311,11 @@ private static void findPenetr(final Object obj1, final Object obj2, final ccd_t iterations = 0L; while (true){ // compute portal direction and obtain next support point - portalDir(portal, dir); - __ccdSupport(obj1, obj2, dir, ccd, v4); + if (portalDir(portal, dir) != 0) { + return -1; + } + + __ccdSupport(obj1, obj2, dir, ccd, v4); // reached tolerance . find penetration info if (portalReachTolerance(portal, v4, dir, ccd) @@ -305,12 +326,16 @@ private static void findPenetr(final Object obj1, final Object obj2, final ccd_t ccdSimplexPoint3(portal).v, pdir)); depth.set( CCD_SQRT(depth.get())); - ccdVec3Normalize(pdir); + if (ccdVec3SafeNormalize(pdir) != 0) { + return -1; + } // barycentric coordinates: - findPos(obj1, obj2, ccd, portal, pos); + if (findPos(obj1, obj2, ccd, portal, pos) != 0) { + return -1; + } - return; + return 0; } expandPortal(portal, v4); @@ -336,7 +361,7 @@ private static void findPenetrTouch(final Object obj1, final Object obj2, final } /** Find penetration info if origin lies on portal's segment v0-v1 */ - private static void findPenetrSegment(final Object obj1, final Object obj2, final ccd_t ccd, + private static int findPenetrSegment(final Object obj1, final Object obj2, final ccd_t ccd, ccd_simplex_t portal, RefDouble depth, ccd_vec3_t dir, ccd_vec3_t pos) { @@ -364,13 +389,16 @@ private static void findPenetrSegment(final Object obj1, final Object obj2, fina ccdVec3Copy(dir, ccdSimplexPoint1(portal).v); depth.set( CCD_SQRT(ccdVec3Len2(dir)) ); - ccdVec3Normalize(dir); + if (ccdVec3SafeNormalize(dir) != 0) { + return -1; + } + return 0; } /** Finds position vector from fully established portal */ - private static void findPos(final Object obj1, final Object obj2, final ccd_t ccd, + private static int findPos(final Object obj1, final Object obj2, final ccd_t ccd, final ccd_simplex_t portal, ccd_vec3_t pos) { final ccd_vec3_t dir = new ccd_vec3_t(); @@ -379,7 +407,9 @@ private static void findPos(final Object obj1, final Object obj2, final ccd_t cc double sum, inv; final ccd_vec3_t vec = new ccd_vec3_t(), p1 = new ccd_vec3_t(), p2 = new ccd_vec3_t(); - portalDir(portal, dir); + if (portalDir(portal, dir) != 0) { + return -1; + } // use barycentric coordinates of tetrahedron to find origin ccdVec3Cross(vec, ccdSimplexPoint1(portal).v, @@ -458,12 +488,13 @@ private static void findPos(final Object obj1, final Object obj2, final ccd_t cc ccdVec3Copy(pos, p1); ccdVec3Add(pos, p2); ccdVec3Scale(pos, 0.5); + return 0; } /** Extends portal with new support point. * Portal must have face v1-v2-v3 arranged to face outside portal. */ - private static final void expandPortal(ccd_simplex_t portal, + private static void expandPortal(ccd_simplex_t portal, final ccd_support_t v4) { double dot; @@ -491,7 +522,7 @@ private static final void expandPortal(ccd_simplex_t portal, /** Fill dir with direction outside portal. Portal's v1-v2-v3 face must be * arranged in correct order! */ - private static final void portalDir(final ccd_simplex_t portal, ccd_vec3_t dir) + private static int portalDir(final ccd_simplex_t portal, ccd_vec3_t dir) { final ccd_vec3_t v2v1 = new ccd_vec3_t(), v3v1 = new ccd_vec3_t(); @@ -500,7 +531,10 @@ private static final void portalDir(final ccd_simplex_t portal, ccd_vec3_t dir) ccdVec3Sub2(v3v1, ccdSimplexPoint3(portal).v, ccdSimplexPoint1(portal).v); ccdVec3Cross(dir, v2v1, v3v1); - ccdVec3Normalize(dir); + if (ccdVec3SafeNormalize(dir) != 0) { + return -1; + } + return 0; } /** Returns true if portal encapsules origin (0,0,0), dir is direction of diff --git a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDQuat.java b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDQuat.java index 00e415a6..b02f3c4a 100644 --- a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDQuat.java +++ b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDQuat.java @@ -198,19 +198,19 @@ public static final int ccdQuatInvert2(ccd_quat_t dest, final ccd_quat_t src) } /** - * Rotate vector s by quaternion q and put result into d. + * Rotate vector v by quaternion q. */ - public static void ccdQuatRotVec2(ccd_vec3_t d, final ccd_vec3_t s, final ccd_quat_t q) { + public static void ccdQuatRotVec(ccd_vec3_t v, final ccd_quat_t q) { // original version: 31 mul + 21 add // optimized version: 18 mul + 12 add - // formula: d = s + 2 * cross(q.xyz, cross(q.xyz, v) + q.w * s) + // formula: v = v + 2 * cross(q.xyz, cross(q.xyz, v) + q.w * v) double cross1_x, cross1_y, cross1_z, cross2_x, cross2_y, cross2_z; double x, y, z, w; double vx, vy, vz; - vx = ccdVec3X(s); - vy = ccdVec3Y(s); - vz = ccdVec3Z(s); + vx = ccdVec3X(v); + vy = ccdVec3Y(v); + vz = ccdVec3Z(v); w = q.q3; x = q.q0; @@ -223,14 +223,7 @@ public static void ccdQuatRotVec2(ccd_vec3_t d, final ccd_vec3_t s, final ccd_qu cross2_x = y * cross1_z - z * cross1_y; cross2_y = z * cross1_x - x * cross1_z; cross2_z = x * cross1_y - y * cross1_x; - ccdVec3Set(d, vx + 2 * cross2_x, vy + 2 * cross2_y, vz + 2 * cross2_z); - } - - /** - * Rotate vector v by quaternion q. - */ - public static void ccdQuatRotVec(ccd_vec3_t v, final ccd_quat_t q) { - ccdQuatRotVec2(v, v, q); + ccdVec3Set(v, vx + 2 * cross2_x, vy + 2 * cross2_y, vz + 2 * cross2_z); } } diff --git a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDVec3.java b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDVec3.java index 22f98452..2cbbe656 100644 --- a/core/src/main/java/org/ode4j/ode/internal/libccd/CCDVec3.java +++ b/core/src/main/java/org/ode4j/ode/internal/libccd/CCDVec3.java @@ -39,10 +39,6 @@ public class CCDVec3 { /* minimum of two floats */ static double CCD_FMIN(double x, double y) { return Math.min(x, y); } - public static double CCD_ATAN2(double x, double y) { - return Math.atan2(x, y); - } - //#define CCD_ONE CCD_REAL(1.) public static final double CCD_ONE = 1; //#define CCD_ZERO CCD_REAL(0.) @@ -262,15 +258,6 @@ public static void ccdVec3Sub2(ccd_vec3_t d, final ccd_vec3_t v, final ccd_vec3_ d.v2 = v.v2 - w.v2; } - /** - * d = v + w - */ - public static void ccdVec3Add2(ccd_vec3_t d, final ccd_vec3_t v, final ccd_vec3_t w) { - d.v0 = v.v0 + w.v0; - d.v1 = v.v1 + w.v1; - d.v2 = v.v2 + w.v2; - } - /** * d = d * k; * @@ -283,40 +270,13 @@ public static void ccdVec3Scale(ccd_vec3_t d, double k) { d.v2 *= k; } - /** - * d = s * k; - */ - public static void ccdVec3CopyScaled(ccd_vec3_t d, final ccd_vec3_t s, double k) { - d.v0 = s.v0 * k; - d.v1 = s.v1 * k; - d.v2 = s.v2 * k; - } - - /** - * d = v + s * k; - */ - static void ccdVec3AddScaled(ccd_vec3_t d, final ccd_vec3_t v, final ccd_vec3_t s, double k) { - d.v0 = v.v0 + s.v0 * k; - d.v1 = v.v1 + s.v1 * k; - d.v2 = v.v2 + s.v2 * k; - } - /** * Normalizes given vector to unit length. - * - * WARNING: This returns TRUE for a failure! - * - * @param d d - * @return 'true' if normalization failed. */ - public static boolean ccdVec3Normalize(ccd_vec3_t d) + public static void ccdVec3Normalize(ccd_vec3_t d) { - double len = CCD_SQRT(ccdVec3Len2(d)); - if (len > CCD_EPS) { - ccdVec3Scale(d, CCD_ONE / len); - return false; - } - return true; + double k = CCD_ONE / CCD_SQRT(ccdVec3Len2(d)); + ccdVec3Scale(d, k); } /** diff --git a/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench.java b/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench.java index 50cb3623..48a09129 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench.java @@ -273,7 +273,7 @@ public static void main(String[] args) { cycles = Integer.parseInt(args[0]); } -// fprintf(stdout, "Cycles: %u\n", cycles); +// fprintf(stdout, "Cycles: %zu\n", cycles); // fprintf(stdout, "\n"); boxbox(); diff --git a/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench2.java b/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench2.java index c980fe81..3e5d28cd 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench2.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/libccd/CCDTestBench2.java @@ -285,7 +285,7 @@ public static void main(String[] args) { cycles = Integer.parseInt(args[0]); } -// fprintf(stdout, "Cycles: %u\n", cycles); +// fprintf(stdout, "Cycles: %zu\n", cycles); // fprintf(stdout, "\n"); boxbox(); From e1064f4269fd1111402789d984e7198b585c3115 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 14:56:03 +0200 Subject: [PATCH 04/27] Upwards including joints done + libCCD --- core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java b/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java index 982fc314..84af0c36 100644 --- a/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java +++ b/core/src/main/java/org/ode4j/ode/internal/CollisionLibccd.java @@ -200,7 +200,7 @@ static void ccdGeomToCyl(final DxCylinder g, ccd_cyl_t cyl) { ccdVec3Copy(cyl.p1, cyl.axis); ccdVec3Copy(cyl.p2, cyl.axis); int cylAxisNormalizationResult = ccdVec3SafeNormalize(cyl.axis); - dUVERIFY(cylAxisNormalizationResult != 0, "Invalid cylinder has been passed"); + dUVERIFY(cylAxisNormalizationResult == 0, "Invalid cylinder has been passed"); ccdVec3Scale(cyl.p2, -1.0); ccdVec3Add(cyl.p1, cyl.pos); ccdVec3Add(cyl.p2, cyl.pos); From 8f0be64a8a184cadfbe4fe135652da41dbeb3d9e Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 15:08:00 +0200 Subject: [PATCH 05/27] Upwards including joints done + libCCD + Demos --- .../java/org/ode4j/demo/ConvexCubeGeom.java | 24 +++++++ .../main/java/org/ode4j/demo/ConvexPrism.java | 60 ++++++++++++++++++ .../java/org/ode4j/demo/DemoCollision.java | 63 +++++++++++++++---- 3 files changed, 135 insertions(+), 12 deletions(-) create mode 100644 demo/src/main/java/org/ode4j/demo/ConvexPrism.java diff --git a/demo/src/main/java/org/ode4j/demo/ConvexCubeGeom.java b/demo/src/main/java/org/ode4j/demo/ConvexCubeGeom.java index deaa5ecd..838a98c4 100644 --- a/demo/src/main/java/org/ode4j/demo/ConvexCubeGeom.java +++ b/demo/src/main/java/org/ode4j/demo/ConvexCubeGeom.java @@ -1,3 +1,27 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * Open Dynamics Engine 4J, Copyright (C) 2009-2014 Tilmann Zaeschke * + * All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT, ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT for more * + * details. * + * * + *************************************************************************/ package org.ode4j.demo; class ConvexCubeGeom { diff --git a/demo/src/main/java/org/ode4j/demo/ConvexPrism.java b/demo/src/main/java/org/ode4j/demo/ConvexPrism.java new file mode 100644 index 00000000..181f0d62 --- /dev/null +++ b/demo/src/main/java/org/ode4j/demo/ConvexPrism.java @@ -0,0 +1,60 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * Open Dynamics Engine 4J, Copyright (C) 2009-2014 Tilmann Zaeschke * + * All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT, ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT for more * + * details. * + * * + *************************************************************************/ +package org.ode4j.demo; + + +public class ConvexPrism { + + public static int prism_pointcount = 8; + + public static int prism_planecount = 6; + public static double[] prism_points = { // [24]= { + 10.0, 1.0, -1.0, + 10.0, -1.0, -1.0, + -10.0, -1.0, -1.0, + -10.0, 1.0, -1.0, + 10.0, 1.0, 1.0, + 10.0, -1.0, 1.0, + -10.0, -1.0, 1.0, + -10.0, 1.0, 1.0 + }; + + public static int[] prism_polygons = { + 4, 0, 1, 2, 3, + 4, 4, 7, 6, 5, + 4, 0, 4, 5, 1, + 4, 1, 5, 6, 2, + 4, 2, 6, 7, 3, + 4, 4, 0, 3, 7, + }; + public static double[] prism_planes = { + 0.0, 0.0, -1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + 1.0, 0.0, 0.0, 10.0, + 0.0, -1.0, 0.0, 1.0, + -1.0, 0.0, -0.0, 10.0, + 0.0, 1.0, 0.0, 1.0, + }; +} \ No newline at end of file diff --git a/demo/src/main/java/org/ode4j/demo/DemoCollision.java b/demo/src/main/java/org/ode4j/demo/DemoCollision.java index 4f137bbe..a78bc5e2 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoCollision.java +++ b/demo/src/main/java/org/ode4j/demo/DemoCollision.java @@ -1105,27 +1105,66 @@ private static boolean edgeIntersectsRect (DVector3 v1, DVector3 v2, DVector3 p1, DVector3 p2, DVector3 p3) { DVector3 u1=new DVector3(),u2=new DVector3(),n=new DVector3(),tmp=new DVector3(); + //for (k=0; k<3; k++) u1[k] = p3[k]-p1[k]; u1.eqDiff(p3, p1); //for (k=0; k<3; k++) u2[k] = p2[k]-p1[k]; u2.eqDiff(p2, p1); + double d1 = dSqrt(u1.dot(u1)); double d2 = dSqrt(u2.dot(u2)); u1.normalize(); u2.normalize(); - if (dFabs(u1.dot(u2)) > 1e-6) dDebug (0,"bad u1/u2"); - n.eqCross(u1, u2); - //for (k=0; k<3; k++) tmp[k] = v2[k]-v1[k]; - tmp.eqDiff(v2, v1); - double d = -n.dot(p1); - if (dFabs(n.dot(p1)+d) > 1e-8) dDebug (0,"bad n wrt p1"); - if (dFabs(n.dot(p2)+d) > 1e-8) dDebug (0,"bad n wrt p2"); - if (dFabs(n.dot(p3)+d) > 1e-8) dDebug (0,"bad n wrt p3"); - double alpha = -(d+n.dot(v1))/n.dot(tmp); - //for (k=0; k<3; k++) tmp[k] = v1[k]+alpha*(v2[k]-v1[k]); + + double error; + // #ifdef dSINGLE + // const dReal uEpsilon = 1e-5, pEpsilon = 1e-6, tmpEpsilon = 1.5e-4; + // #else + final double uEpsilon = 1e-6, pEpsilon = 1e-8, tmpEpsilon = 1e-6; + // #endif + +// if (dFabs(u1.dot(u2)) > 1e-6) dDebug (0,"bad u1/u2"); +// n.eqCross(u1, u2); +// //for (k=0; k<3; k++) tmp[k] = v2[k]-v1[k]; +// tmp.eqDiff(v2, v1); +// double d = -n.dot(p1); +// if (dFabs(n.dot(p1)+d) > 1e-8) dDebug (0,"bad n wrt p1"); +// if (dFabs(n.dot(p2)+d) > 1e-8) dDebug (0,"bad n wrt p2"); +// if (dFabs(n.dot(p3)+d) > 1e-8) dDebug (0,"bad n wrt p3"); +// double alpha = -(d+n.dot(v1))/n.dot(tmp); +// //for (k=0; k<3; k++) tmp[k] = v1[k]+alpha*(v2[k]-v1[k]); +// tmp.eqDiff(v2, v1); +// tmp.eqSum(v1, tmp.scale(alpha)); +// if (dFabs(n.dot(tmp)+d) > 1e-6) dDebug (0,"bad tmp"); + + + + error = dFabs(dCalcVectorDot3(u1, u2)); + if (error > uEpsilon) dDebug(0, "bad u1/u2"); + + dCalcVectorCross3(n, u1, u2); + + // for (k=0; k < 3; k++) tmp[k] = v2[k] - v1[k]; tmp.eqDiff(v2, v1); - tmp.eqSum(v1, tmp.scale(alpha)); - if (dFabs(n.dot(tmp)+d) > 1e-6) dDebug (0,"bad tmp"); + + double d = -dCalcVectorDot3(n, p1); + + error = dFabs(dCalcVectorDot3(n, p1) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p1"); + + error = dFabs(dCalcVectorDot3(n, p2) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p2"); + + error = dFabs(dCalcVectorDot3(n, p3) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p3"); + + double alpha = -(d + dCalcVectorDot3(n, v1)) / dCalcVectorDot3(n, tmp); + // for (k=0; k < 3; k++) tmp[k] = v1[k] + alpha * (v2[k] - v1[k]); + tmp.eqDiff(v2, v1).scale(alpha).add(v1); + + error = dFabs(dCalcVectorDot3(n, tmp) + d); + if (error > tmpEpsilon) dDebug(0, "bad tmp"); + if (alpha < 0) return false; if (alpha > 1) return false; //for (k=0; k<3; k++) tmp[k] -= p1[k]; From d33072112cd1889dcb6c2521fd38f287ca1c295d Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 18:10:30 +0200 Subject: [PATCH 06/27] Upwards including joints done + libCCD + Demos + Halton --- .../java/org/ode4j/demo/DemoCollision.java | 18 +- .../main/java/org/ode4j/demo/DemoConvex.java | 330 +++ .../java/org/ode4j/demo/DemoFeedback.java | 8 +- .../main/java/org/ode4j/demo/DemoJoints.java | 2 +- .../src/main/java/org/ode4j/demo/DemoOde.java | 115 +- .../java/org/ode4j/demo/Halton235Geom.java | 2299 +++++++++++++++++ .../org/ode4j/tests/DemoCollisionTest.java | 48 +- .../java/org/ode4j/tests/DemoJointsTest.java | 2 +- .../java/org/ode4j/tests/DemoOdeTest.java | 95 +- 9 files changed, 2815 insertions(+), 102 deletions(-) create mode 100644 demo/src/main/java/org/ode4j/demo/DemoConvex.java create mode 100644 demo/src/main/java/org/ode4j/demo/Halton235Geom.java diff --git a/demo/src/main/java/org/ode4j/demo/DemoCollision.java b/demo/src/main/java/org/ode4j/demo/DemoCollision.java index a78bc5e2..4fb97615 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoCollision.java +++ b/demo/src/main/java/org/ode4j/demo/DemoCollision.java @@ -1123,22 +1123,6 @@ private static boolean edgeIntersectsRect (DVector3 v1, DVector3 v2, final double uEpsilon = 1e-6, pEpsilon = 1e-8, tmpEpsilon = 1e-6; // #endif -// if (dFabs(u1.dot(u2)) > 1e-6) dDebug (0,"bad u1/u2"); -// n.eqCross(u1, u2); -// //for (k=0; k<3; k++) tmp[k] = v2[k]-v1[k]; -// tmp.eqDiff(v2, v1); -// double d = -n.dot(p1); -// if (dFabs(n.dot(p1)+d) > 1e-8) dDebug (0,"bad n wrt p1"); -// if (dFabs(n.dot(p2)+d) > 1e-8) dDebug (0,"bad n wrt p2"); -// if (dFabs(n.dot(p3)+d) > 1e-8) dDebug (0,"bad n wrt p3"); -// double alpha = -(d+n.dot(v1))/n.dot(tmp); -// //for (k=0; k<3; k++) tmp[k] = v1[k]+alpha*(v2[k]-v1[k]); -// tmp.eqDiff(v2, v1); -// tmp.eqSum(v1, tmp.scale(alpha)); -// if (dFabs(n.dot(tmp)+d) > 1e-6) dDebug (0,"bad tmp"); - - - error = dFabs(dCalcVectorDot3(u1, u2)); if (error > uEpsilon) dDebug(0, "bad u1/u2"); @@ -1167,11 +1151,13 @@ private static boolean edgeIntersectsRect (DVector3 v1, DVector3 v2, if (alpha < 0) return false; if (alpha > 1) return false; + //for (k=0; k<3; k++) tmp[k] -= p1[k]; tmp.sub(p1); double a1 = u1.dot(tmp); double a2 = u2.dot(tmp); if (a1<0 || a2<0 || a1>d1 || a2>d2) return false; + return true; } diff --git a/demo/src/main/java/org/ode4j/demo/DemoConvex.java b/demo/src/main/java/org/ode4j/demo/DemoConvex.java new file mode 100644 index 00000000..3b451cb7 --- /dev/null +++ b/demo/src/main/java/org/ode4j/demo/DemoConvex.java @@ -0,0 +1,330 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT and LICENSE-BSD.TXT for more details. * + * * + *************************************************************************/ +package org.ode4j.demo; + +import org.ode4j.drawstuff.DrawStuff; +import org.ode4j.math.DMatrix3C; +import org.ode4j.math.DQuaternion; +import org.ode4j.math.DVector3; +import org.ode4j.math.DVector3C; +import org.ode4j.ode.*; + +import static org.ode4j.drawstuff.DrawStuff.*; +import static org.ode4j.drawstuff.DrawStuff.DS_TEXTURE_NUMBER.DS_NONE; +import static org.ode4j.ode.OdeConstants.*; +import static org.ode4j.ode.internal.Common.M_PI; +import static org.ode4j.demo.Halton235Geom.*; + +/** Convex demo. + * Serves as a test for the convex geometry. + * By Bram Stolk. + */ +public class DemoCOnvex extends DrawStuff.dsFunctions { + + +//# #include "texturepath.h" + +// #include "halton235_geom.h" + + + +// Height at which we drop the composite block. + private static final double H = 4.20; + + private static DWorld world; + private static DSpace space; + + private static DBody mbody; + + private static DBody hbody[halton_numc ]; + private static DGeom hgeom[halton_numc ]; + + private static DJointGroup contactgroup; + + private static boolean drawpos = false; + private static boolean solidkernel = false; + + + private DGeom.DNearCallback nearCallback = new DGeom.DNearCallback() { + @Override + public void call(Object data, DGeom o1, DGeom o2) { + nearCallback(data, o1, o2); + } + }; + + // this is called by dSpaceCollide when two objects in space are + // potentially colliding. + + private void nearCallback(Object data, DGeom o1, DGeom o2) { + assert (o1 != null); + assert (o2 != null); + if (o1 instanceof DSpace || o2 instanceof DSpace) { + // colliding a space with something + OdeHelper.spaceCollide2(o1, o2, data, nearCallback); + // Note we do not want to test intersections within a space, + // only between spaces. + return; + } + + final int N = 32; + DContactBuffer contacts = new DContactBuffer(N); + int n = OdeHelper.collide(o1, o2, N, contacts.getGeomBuffer()); + if (n > 0) { + for (int i = 0; i < n; i++) { + DContact contact = contacts.get(i); + contact.surface.slip1 = 0.7; + contact.surface.slip2 = 0.7; + contact.surface.mode = dContactSoftERP | dContactSoftCFM | dContactApprox1 | dContactSlip1 | dContactSlip2; + contact.surface.mu = 500.0; // was: dInfinity + contact.surface.soft_erp = 0.50; + contact.surface.soft_cfm = 0.03; + DJoint c = OdeHelper.createContactJoint(world, contactgroup, contact); + c.attach( + contact.geom.g1.getBody(), + contact.geom.g2.getBody() + ); + } + } + } + + + // start simulation - set viewpoint + @Override + public void start() { + //dAllocateODEDataForThread(dAllocateMaskAll); + dsSetViewpoint(xyz, hpr); + System.err.printf("Press SPACE to reset the simulation.\n"); + } + private static float[] xyz = { // [ 3] ={ + -8, 0, 5 + }; + private static float[] hpr = { // [ 3] ={ + 0.0f, -29.5000f, 0.0000f + }; + + + private static void reset() { + DQuaternion q = new DQuaternion(); + // TODO remove +// dQSetIdentity(q); +// dBodySetPosition(mbody, 0, 0, 0 + H); +// dBodySetQuaternion(mbody, q); +// dBodySetLinearVel(mbody, 0, 0, 0); +// dBodySetAngularVel(mbody, 0, 0, 0); +// dBodyEnable(mbody); + q.setIdentity(); + mbody.setPosition(0, 0, 0 + H); + mbody.setQuaternion(q); + mbody.setLinearVel(0, 0, 0); + mbody.setAngularVel(0, 0, 0); + mbody.enable(); + for (int i = 0; i < halton_numc; ++i) { + DBody body = hbody[i]; + if (body == null) continue; + // TODO remove +// dBodySetPosition(body, halton_pos[i][0], halton_pos[i][1], halton_pos[i][2] + H); +// dBodySetQuaternion(body, q); +// dBodySetLinearVel(body, 0, 0, 0); +// dBodySetAngularVel(body, 0, 0, 0); +// dBodyEnable(body); + body.setPosition(); + body.setQuaternion(q); + body.setLinearVel(0, 0, 0); + body.setAngularVel(0, 0, 0); + body.enable(); + } + } + + + // called when a key pressed + @Override + public void command(char cmd) { + switch (cmd) { + case ' ': + reset(); + break; + default: + break; + } + } + + @Override + public void step(boolean pause) { + double simstep = 1 / 240.0; + double dt = dsElapsedTime(); + + int nrofsteps = (int) Math.ceil(dt / simstep); + nrofsteps = nrofsteps > 8 ? 8 : nrofsteps; + + for (int i = 0; i < nrofsteps && !pause; i++) { + OdeHelper.spaceCollide(space, 0, nearCallback); + world.quickStep(simstep); + contactgroup.empty(); + } + + dsSetColor(1, 1, 1); + // Draw the convex objects. + for (int i = 0; i < halton_numc; ++i) { + DGeom geom = hgeom[i]; + DBody body = geom.getBody(); + //const dReal *pos = dBodyGetPosition(body); + //const dReal *rot = dBodyGetRotation(body); + DVector3C pos = geom.getPosition(); + DMatrix3C rot = geom.getRotation(); + dsDrawConvex + ( + pos, rot, + halton_planes[i], + halton_numf[i], + halton_verts[i], + halton_numv[i], + halton_faces[i] + ); + } + + if (drawpos) { + dsSetColor(1, 0, 0.2); + dsSetTexture(DS_NONE); + final double l = 0.35; + for (int i = 0; i < halton_numc; ++i) { + DBody body = hbody[i]; + DVector3C pos = body.getPosition(); + DVector3 x0 ={ + pos[0] - l, pos[1], pos[2] + } ; + DVector3 x1 ={ + pos[0] + l, pos[1], pos[2] + } ; + DVector3 y0 ={ + pos[0], pos[1] - l, pos[2] + } ; + DVector3 y1 ={ + pos[0], pos[1] + l, pos[2] + } ; + DVector3 z0 ={ + pos[0], pos[1], pos[2] - l + } ; + DVector3 z1 ={ + pos[0], pos[1], pos[2] + l + } ; + dsDrawLine(x0, x1); + dsDrawLine(y0, y1); + dsDrawLine(z0, z1); + } + } + } + + public static void main(final String[] args) { + new DemoCOnvex().demo(args); + } + + private void demo(String[] args) { + DMass m; + + // setup pointers to drawstuff callback functions + // dsFunctions fn; + // fn.version = DS_VERSION; + // fn.start = &start; + // fn.step = &simLoop; + // fn.command = &command; + // fn.stop = 0; + // fn.path_to_textures = DRAWSTUFF_TEXTURE_PATH; + + // create world + OdeHelper.initODE2(0); + world = OdeHelper.createWorld(); + space = OdeHelper.createHashSpace(); + ((DHashSpace)space).setLevels(-3, 5); + OdeHelper.createPlane(space, 0, 0, 1, 0); // Add a ground plane. + + contactgroup = OdeHelper.createJointGroup(); + world.setGravity(0, 0, -9.8); + world.setQuickStepNumIterations(32); + world.setContactMaxCorrectingVel(40); + world.setMaxAngularSpeed(62.8); + world.setERP(0.7); + world.setQuickStepW(0.75); // For increased stability. + + world.setAutoDisableFlag(true); + world.setAutoDisableLinearThreshold(0.01); + world.setAutoDisableAngularThreshold(0.03); + world.setAutoDisableTime(0.15f); + + final float kernelrad = 0.7f; + + mbody = OdeHelper.createBody(world); + mbody.setPosition(0, 0, 0 + H); + m.setSphere(5, kernelrad ); + mbody.setMass( m ); + + for (int i = 0; i < halton_numc; ++i) { + DGeom geom = OdeHelper.createConvex( + space, + halton_planes[i], + halton_numf[i], + halton_verts[i], + halton_numv[i], + halton_faces[i] + ); + hgeom[i] = geom; + final double x = halton_pos[i][0]; + final double y = halton_pos[i][1]; + final double z = halton_pos[i][2]; + final double dsqr = x * x + y * y + z * z; + + if (dsqr < kernelrad * kernelrad && solidkernel) { + geom.setBody(mbody); + geom.setOffsetPosition(x, y, z); + } else { + DBody body = OdeHelper.createBody(world); + hbody[i] = body; + body.setPosition(x, y, z + H); + double volu = halton_volu[i]; + double rad = Math.pow(volu * 3 / (4 * M_PI), (1 / 3.0)); + m.setSphere( 5, rad ); + body.setMass( m ); +//#if 1 + body.setLinearDamping(0.0005); + body.setAngularDamping(0.0300); +//#edif + geom.setBody(body); + } + } + + // run simulation + final int w = 1280; + final int h = 720; + dsSimulationLoop(args, w, h, this); + + contactgroup.empty (); + contactgroup.destroy (); + space.destroy (); + world.destroy (); + OdeHelper.closeODE(); + } + + @Override + public void stop() { + // Nothing + } + +} diff --git a/demo/src/main/java/org/ode4j/demo/DemoFeedback.java b/demo/src/main/java/org/ode4j/demo/DemoFeedback.java index 80af8685..f21fb758 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoFeedback.java +++ b/demo/src/main/java/org/ode4j/demo/DemoFeedback.java @@ -120,8 +120,8 @@ private void nearCallback (Object data, DGeom o1, DGeom o2) } - private static float[] xyz = { -6, 8, 6}; - private static float[] hpr = { -65.0f, -27.0f, 0.0f}; + private static final float[] xyz = { -6, 8, 6}; + private static final float[] hpr = { -65.0f, -27.0f, 0.0f}; // start simulation - set viewpoint @Override public void start() @@ -160,7 +160,7 @@ private void drawGeom (DGeom g) private static void inspectJoints() { - final double forcelimit = 2000.0; + final double forcelimit = 4000.0; int i; for (i=0; i 1e-6) dDebug(0, "bad u1/u2"); - n.eqCross(u1, u2); - //for (k=0; k<3; k++) tmp[k] = v2[k]-v1[k]; - tmp.eqDiff(v2, v1); - double d = -n.dot(p1); - if (dFabs(n.dot(p1) + d) > 1e-8) dDebug(0, "bad n wrt p1"); - if (dFabs(n.dot(p2) + d) > 1e-8) dDebug(0, "bad n wrt p2"); - if (dFabs(n.dot(p3) + d) > 1e-8) dDebug(0, "bad n wrt p3"); - double alpha = -(d + n.dot(v1)) / n.dot(tmp); - //for (k=0; k<3; k++) tmp[k] = v1[k]+alpha*(v2[k]-v1[k]); + + double error; + // #ifdef dSINGLE + // const dReal uEpsilon = 1e-5, pEpsilon = 1e-6, tmpEpsilon = 1.5e-4; + // #else + final double uEpsilon = 1e-6, pEpsilon = 1e-8, tmpEpsilon = 1e-6; + // #endif + + error = dFabs(dCalcVectorDot3(u1, u2)); + if (error > uEpsilon) dDebug(0, "bad u1/u2"); + + dCalcVectorCross3(n, u1, u2); + + // for (k=0; k < 3; k++) tmp[k] = v2[k] - v1[k]; tmp.eqDiff(v2, v1); - tmp.eqSum(v1, tmp.scale(alpha)); - if (dFabs(n.dot(tmp) + d) > 1e-6) dDebug(0, "bad tmp"); + + double d = -dCalcVectorDot3(n, p1); + + error = dFabs(dCalcVectorDot3(n, p1) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p1"); + + error = dFabs(dCalcVectorDot3(n, p2) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p2"); + + error = dFabs(dCalcVectorDot3(n, p3) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p3"); + + double alpha = -(d + dCalcVectorDot3(n, v1)) / dCalcVectorDot3(n, tmp); + // for (k=0; k < 3; k++) tmp[k] = v1[k] + alpha * (v2[k] - v1[k]); + tmp.eqDiff(v2, v1).scale(alpha).add(v1); + + error = dFabs(dCalcVectorDot3(n, tmp) + d); + if (error > tmpEpsilon) dDebug(0, "bad tmp"); if (alpha < 0) return false; if (alpha > 1) return false; + //for (k=0; k<3; k++) tmp[k] -= p1[k]; tmp.sub(p1); double a1 = u1.dot(tmp); double a2 = u2.dot(tmp); if (a1 < 0 || a2 < 0 || a1 > d1 || a2 > d2) return false; + return true; } diff --git a/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java b/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java index 709924f8..e6afa5b9 100644 --- a/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java +++ b/demo/src/test/java/org/ode4j/tests/DemoJointsTest.java @@ -87,7 +87,7 @@ public class DemoJointsTest { private static DUniversalJoint jointUniversal; - private static int cmd_occasional_error = 0; // perturb occasionally + private static int cmd_occasional_error = 1; // perturb occasionally // info about the current test diff --git a/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java b/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java index 1e7236c3..6402ccd3 100644 --- a/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java +++ b/demo/src/test/java/org/ode4j/tests/DemoOdeTest.java @@ -47,8 +47,28 @@ import static org.ode4j.ode.internal.ErrorHandler.*; import static org.ode4j.ode.internal.ErrorHandler.dSetDebugHandler; - public class DemoOdeTest { + //**************************************************************************** + // matrix sizes + + // #define dALIGN_SIZE(buf_size, alignment) (((buf_size) + (alignment - 1)) & (int)(~(alignment - 1))) // Casting the mask to int ensures sign-extension to larger integer sizes + // #define dALIGN_PTR(buf_ptr, alignment) ((void *)(((duintptr)(buf_ptr) + ((alignment) - 1)) & (int)(~(alignment - 1)))) // Casting the mask to int ensures sign-extension to larger integer sizes + // + // #define MSIZE 21 + // #define MSIZE4 dALIGN_SIZE(MSIZE, 4) // MSIZE rounded up to 4 + private static final int MSIZE = 21; + private static final int MSIZE4 = 24; // MSIZE rounded up to 4 + + + + + + //**************************************************************************** + // matrix accessors + + // #define _A(i,j) A[(i)*4+(j)] + // #define _I(i,j) I[(i)*4+(j)] + // #define _R(i,j) R[(i)*4+(j)] //**************************************************************************** @@ -268,12 +288,6 @@ public void testPlaneSpace() { //**************************************************************************** // test matrix functions - //#define MSIZE 21 - //#define MSIZE4 24 // MSIZE rounded up to 4 - private static final int MSIZE = 21; - private static final int MSIZE4 = 24; // MSIZE rounded up to 4 - - @Test public void testMatrixMultiply() { // A is 2x3, B is 3x4, B2 is B except stored columnwise, C is 2x4 @@ -352,8 +366,10 @@ public void testSmallMatrixMultiply() { @Test public void testCholeskyFactorization() { - double[] A = new double[MSIZE4 * MSIZE], B = new double[MSIZE4 * MSIZE]; - double[] C = new double[MSIZE4 * MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + double[] A = new double[matrixSize]; + double[] B = new double[matrixSize]; + double[] C = new double[matrixSize]; double diff; dMakeRandomMatrix(A, MSIZE, MSIZE, 1.0); dMultiply2(B, A, A, MSIZE, MSIZE, MSIZE); @@ -368,7 +384,8 @@ public void testCholeskyFactorization() { @Test public void testCholeskyFactorizationM3() { - DMatrix3 A = new DMatrix3(), B = new DMatrix3(); + DMatrix3 A = new DMatrix3(); + DMatrix3 B = new DMatrix3(); DMatrix3 C = new DMatrix3(); double diff; dMakeRandomMatrix(A, 1.0); @@ -384,8 +401,10 @@ public void testCholeskyFactorizationM3() { @Test public void testCholeskySolve() { - double[] A = new double[MSIZE4 * MSIZE], L = new double[MSIZE4 * MSIZE]; - double[] b = new double[MSIZE], x = new double[MSIZE], btest = new double[MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + int vectorSize = MSIZE; + double[] A = new double[matrixSize], L = new double[matrixSize]; + double[] b = new double[vectorSize],x = new double[vectorSize],btest = new double[vectorSize]; double diff; // get A,L = PD matrix @@ -445,8 +464,9 @@ public void testCholeskySolveM3() { @Test public void testInvertPDMatrix() { int i, j, ok; - double[] A = new double[MSIZE4 * MSIZE], Ainv = new double[MSIZE4 * MSIZE]; - double[] I = new double[MSIZE4 * MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + double[] A = new double[matrixSize], Ainv = new double[matrixSize]; + double[] I = new double[matrixSize]; dMakeRandomMatrix(A, MSIZE, MSIZE, 1.0); dMultiply2(Ainv, A, A, MSIZE, MSIZE, MSIZE); @@ -501,7 +521,8 @@ public void testInvertPDMatrixM3() { @Test public void testIsPositiveDefinite() { - double[] A = new double[MSIZE4 * MSIZE], B = new double[MSIZE4 * MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + double[] A = new double[matrixSize], B = new double[matrixSize]; dMakeRandomMatrix(A, MSIZE, MSIZE, 1.0); dMultiply2(B, A, A, MSIZE, MSIZE, MSIZE); assertFalse(dIsPositiveDefinite(A, MSIZE)); @@ -520,9 +541,11 @@ public void testIsPositiveDefiniteM3() { @Test public void testFastLDLTFactorization() { int i, j; - double[] A = new double[MSIZE4 * MSIZE], L = new double[MSIZE4 * MSIZE]; - double[] DL = new double[MSIZE4 * MSIZE]; - double[] ATEST = new double[MSIZE4 * MSIZE], d = new double[MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + int vectorSize = MSIZE; + double[] A = new double[matrixSize], L = new double[matrixSize]; + double[] DL = new double[matrixSize]; + double[] ATEST = new double[matrixSize], d = new double[vectorSize]; double diff; dMakeRandomMatrix(A, MSIZE, MSIZE, 1.0); dMultiply2(L, A, A, MSIZE, MSIZE, MSIZE); @@ -546,9 +569,11 @@ public void testFastLDLTFactorization() { @Test public void testSolveLDLT() { - double[] A = new double[MSIZE4 * MSIZE], L = new double[MSIZE4 * MSIZE]; - double[] d = new double[MSIZE], x = new double[MSIZE]; - double[] b = new double[MSIZE], btest = new double[MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + int vectorSize = MSIZE; + double[] A = new double[matrixSize], L = new double[matrixSize]; + double[] d = new double[vectorSize], x = new double[vectorSize]; + double[] b = new double[vectorSize], btest = new double[vectorSize]; double diff; dMakeRandomMatrix(A, MSIZE, MSIZE, 1.0); @@ -571,9 +596,11 @@ public void testSolveLDLT() { @Test public void testLDLTAddTL() { int i, j; - double[] A = new double[MSIZE4 * MSIZE], L = new double[MSIZE4 * MSIZE]; - double[] d = new double[MSIZE], a = new double[MSIZE]; - double[] DL = new double[MSIZE4 * MSIZE], ATEST = new double[MSIZE4 * MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + int vectorSize = MSIZE; + double[] A = new double[matrixSize], L = new double[matrixSize]; + double[] d = new double[vectorSize], a = new double[vectorSize]; + double[] DL = new double[matrixSize], ATEST = new double[matrixSize]; double diff; dMakeRandomMatrix(A, MSIZE, MSIZE, 1.0); @@ -609,15 +636,17 @@ public void testLDLTAddTL() { @Test public void testLDLTRemove() { int i, j, r; - int[] p = new int[MSIZE]; - double[] A = new double[MSIZE4 * MSIZE]; - double[] L = new double[MSIZE4 * MSIZE]; - double[] d = new double[MSIZE]; - double[] L2 = new double[MSIZE4 * MSIZE]; - double[] d2 = new double[MSIZE]; - double[] DL2 = new double[MSIZE4 * MSIZE]; - double[] Atest1 = new double[MSIZE4 * MSIZE]; - double[] Atest2 = new double[MSIZE4 * MSIZE]; + int matrixSize = MSIZE4 * MSIZE; + int vectorSize = MSIZE; + int[] p = new int[vectorSize]; + double[] A = new double[matrixSize]; + double[] L = new double[matrixSize]; + double[] L2 = new double[matrixSize]; + double[] DL2 = new double[matrixSize]; + double[] Atest1 = new double[matrixSize]; + double[] Atest2 = new double [matrixSize]; + double[] d = new double[vectorSize]; + double[] d2 = new double[vectorSize]; double diff, maxdiff; // make array of A row pointers From ac5b8b2b593608105d378ce4e7a674cc1e426110 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 18:28:30 +0200 Subject: [PATCH 07/27] Upwards including joints done + libCCD + Demos + Halton --- .../main/java/org/ode4j/demo/DemoConvex.java | 29 ++- .../java/org/ode4j/demo/Halton235Geom.java | 240 +++++++++--------- 2 files changed, 135 insertions(+), 134 deletions(-) diff --git a/demo/src/main/java/org/ode4j/demo/DemoConvex.java b/demo/src/main/java/org/ode4j/demo/DemoConvex.java index 3b451cb7..058d7b19 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoConvex.java +++ b/demo/src/main/java/org/ode4j/demo/DemoConvex.java @@ -38,7 +38,7 @@ * Serves as a test for the convex geometry. * By Bram Stolk. */ -public class DemoCOnvex extends DrawStuff.dsFunctions { +public class DemoConvex extends DrawStuff.dsFunctions { //# #include "texturepath.h" @@ -55,8 +55,8 @@ public class DemoCOnvex extends DrawStuff.dsFunctions { private static DBody mbody; - private static DBody hbody[halton_numc ]; - private static DGeom hgeom[halton_numc ]; + private static DBody[] hbody = new DBody[halton_numc ]; + private static DGeom[] hgeom = new DGeom[halton_numc ]; private static DJointGroup contactgroup; @@ -146,7 +146,7 @@ private static void reset() { // dBodySetLinearVel(body, 0, 0, 0); // dBodySetAngularVel(body, 0, 0, 0); // dBodyEnable(body); - body.setPosition(); + body.setPosition(halton_pos[i][0], halton_pos[i][1], halton_pos[i][2] + H); body.setQuaternion(q); body.setLinearVel(0, 0, 0); body.setAngularVel(0, 0, 0); @@ -204,26 +204,27 @@ public void step(boolean pause) { if (drawpos) { dsSetColor(1, 0, 0.2); dsSetTexture(DS_NONE); - final double l = 0.35; + final float l = 0.35f; for (int i = 0; i < halton_numc; ++i) { DBody body = hbody[i]; - DVector3C pos = body.getPosition(); - DVector3 x0 ={ + DVector3C pos2 = body.getPosition(); + float[] pos = pos2.toFloatArray(); + float[] x0 ={ pos[0] - l, pos[1], pos[2] } ; - DVector3 x1 ={ + float[] x1 ={ pos[0] + l, pos[1], pos[2] } ; - DVector3 y0 ={ + float[] y0 ={ pos[0], pos[1] - l, pos[2] } ; - DVector3 y1 ={ + float[] y1 ={ pos[0], pos[1] + l, pos[2] } ; - DVector3 z0 ={ + float[] z0 ={ pos[0], pos[1], pos[2] - l } ; - DVector3 z1 ={ + float[] z1 ={ pos[0], pos[1], pos[2] + l } ; dsDrawLine(x0, x1); @@ -234,11 +235,11 @@ public void step(boolean pause) { } public static void main(final String[] args) { - new DemoCOnvex().demo(args); + new DemoConvex().demo(args); } private void demo(String[] args) { - DMass m; + DMass m = OdeHelper.createMass(); // setup pointers to drawstuff callback functions // dsFunctions fn; diff --git a/demo/src/main/java/org/ode4j/demo/Halton235Geom.java b/demo/src/main/java/org/ode4j/demo/Halton235Geom.java index 88e5e48c..fa42fca4 100644 --- a/demo/src/main/java/org/ode4j/demo/Halton235Geom.java +++ b/demo/src/main/java/org/ode4j/demo/Halton235Geom.java @@ -1327,11 +1327,11 @@ public class Halton235Geom { public static final int h51_numv = 20; public static final int h51_numf = 12; public static final double h51_volu = 0.097496; -public static final double h51_pos[3] = { 0.796238,0.092236,-0.101631 }; -public static final double h51_verts[ h51_numv * 3 ] = { +public static final double[] h51_pos = { 0.796238,0.092236,-0.101631 }; +public static final double[] h51_verts = { // [ h51_numv * 3 ] = { -0.221011,0.347408,0.061823, -0.319697,0.291705,0.052616, 0.203762,-0.222678,0.367837, -0.200562,0.357460,0.033830, 0.203762,0.194344,-0.275142, -0.239620,-0.263171,-0.163444, 0.152653,-0.230111,0.360793, 0.203762,0.321480,-0.157424, -0.337380,0.280442,0.025237, -0.327866,0.285347,0.016786, -0.028332,0.052718,-0.315616, 0.203762,-0.298399,-0.021674, -0.257234,-0.233077,-0.141083, -0.157288,-0.354755,-0.091207, 0.203762,0.006585,0.328526, -0.156637,-0.352438,-0.079683, 0.030926,0.103995,0.283692, -0.036002,0.060886,0.280191, -0.157223,-0.222560,-0.236947, -0.067033,-0.350976,-0.126852, }; -public static final int h51_faces[] = { +public static final int[] h51_faces = { // [] = { 4, 17,16,0,1, 5, 0,3,9,8,1, 6, 8,12,15,6,17,1, @@ -1345,18 +1345,18 @@ public class Halton235Geom { 4, 13,15,12,5, 6, 12,8,9,10,18,5, }; -public static final double h51_planes[ h51_numf * 4 ] = { +public static final double[] h51_planes = { // [ h51_numf * 4 ] = { -0.322885,0.43293,0.841615,0.273796,-0.488006,0.871758,-0.0434538,0.408025,-0.73548,-0.309929,0.602505,0.176424,-0.158394,0.166869,0.973173,0.288536,0.11569,-0.975032,0.189546,0.310413,1,0,0,0.203762,-0.275531,0.653109,-0.705359,0.26486,0.315015,0.796483,0.516121,0.238991,0.398278,-0.419585,-0.815673,0.224036,-0.228161,-0.721101,-0.654183,0.351367,-0.794108,-0.585614,0.162633,0.31782,-0.693474,0.121763,-0.710118,0.250191 }; // h52 public static final int h52_numv = 16; public static final int h52_numf = 10; public static final double h52_volu = 0.084293; -public static final double h52_pos[3] = { 0.513157,0.018456,0.067444 }; -public static final double h52_verts[ h52_numv * 3 ] = { +public static final double[] h52_pos = { 0.513157,0.018456,0.067444 }; +public static final double[] h52_verts = { // [ h52_numv * 3 ] = { -0.347114,0.063132,0.028301, -0.352265,0.254404,-0.145548, 0.247079,0.134666,0.111116, -0.336736,0.277388,0.070106, 0.126444,-0.278658,-0.248758, -0.340226,0.344736,-0.015651, 0.295476,-0.245782,0.289096, -0.054299,0.354222,-0.143838, 0.053738,-0.364926,0.150631, -0.036616,0.365485,-0.116459, 0.025847,-0.159297,-0.310158, -0.357928,0.152948,-0.176308, 0.019058,0.098592,0.213176, 0.435734,-0.156331,0.191718, -0.340348,0.344248,-0.017196, -0.236518,0.326242,-0.134679, }; -public static final int h52_faces[] = { +public static final int[] h52_faces = { // [] = { 3, 14,15,1, 5, 15,7,10,11,1, 6, 11,0,3,5,14,1, @@ -1368,18 +1368,18 @@ public class Halton235Geom { 5, 8,0,11,10,4, 5, 9,7,15,14,5, }; -public static final double h52_planes[ h52_numf * 4 ] = { +public static final double[] h52_planes = { // [ h52_numf * 4 ] = { -0.425203,0.759567,-0.4922,0.41466,-0.0929092,0.293639,-0.951391,0.245904,-0.997066,0.0350131,0.0680664,0.350232,0.309646,0.434949,0.84554,0.229033,0.73548,0.309929,-0.602505,0.156511,0.148211,0.780702,0.607074,0.209209,-0.433652,-0.152285,0.888119,0.166047,0.485104,-0.868795,-0.0993492,0.328149,-0.66261,-0.69806,-0.271405,0.17825,-0.159459,0.944944,-0.285751,0.38448 }; // h53 public static final int h53_numv = 16; public static final int h53_numf = 10; public static final double h53_volu = 0.086476; -public static final double h53_pos[3] = { -0.781555,0.807509,0.197497 }; -public static final double h53_verts[ h53_numv * 3 ] = { +public static final double[] h53_pos = { -0.781555,0.807509,0.197497 }; +public static final double[] h53_verts = { // [ h53_numv * 3 ] = { 0.291496,-0.156419,-0.091704, -0.218445,0.192491,0.461269, -0.218445,0.192491,-0.255541, -0.218445,-0.397567,0.047987, 0.027292,-0.381663,-0.020188, -0.218445,-0.373860,0.169935, 0.033835,-0.380512,-0.018262, 0.352556,0.192491,0.043056, 0.162589,-0.213103,-0.139928, 0.191640,-0.261360,-0.072549, 0.238502,0.192491,-0.291089, 0.253338,0.013015,-0.278399, 0.326334,-0.087525,-0.081781, 0.317517,-0.112633,-0.111918, 0.238502,0.081667,-0.310092, 0.153590,0.192491,-0.346370, }; -public static final int h53_faces[] = { +public static final int[] h53_faces = { // [] = { 7, 5,6,9,0,12,7,1, 5, 7,10,15,2,1, 4, 2,3,5,1, @@ -1391,18 +1391,18 @@ public class Halton235Geom { 3, 14,15,10, 3, 0,13,12, }; -public static final double h53_planes[ h53_numf * 4 ] = { +public static final double[] h53_planes = { // [ h53_numf * 4 ] = { 0.545755,-0.383303,0.745138,0.150709,-0,1,0,0.192491,-1,0,-0,0.218445,-0.212159,-0.447018,-0.869002,0.182363,0.11569,-0.975032,0.189546,0.371464,0.311731,-0.703731,-0.638425,0.289984,0.944939,0.0553043,-0.322539,0.329903,0.49733,-0.589429,-0.636582,0.295545,0.540055,0.142236,-0.829524,0.397648,0.877441,-0.462191,0.128357,0.316295 }; // h54 public static final int h54_numv = 20; public static final int h54_numf = 12; public static final double h54_volu = 0.089003; -public static final double h54_pos[3] = { -0.845912,0.679404,-0.140778 }; -public static final double h54_verts[ h54_numv * 3 ] = { +public static final double[] h54_pos = { -0.845912,0.679404,-0.140778 }; +public static final double[] h54_verts = { // [ h54_numv * 3 ] = { 0.317695,0.141120,0.059877, 0.091649,-0.253558,0.318087, -0.154088,0.080768,-0.359617, -0.152707,-0.484157,0.192529, -0.154088,0.320596,0.082735, 0.078976,0.204301,-0.281846, -0.154088,-0.269462,0.386262, -0.154088,0.320596,-0.236248, -0.154088,-0.484416,0.192760, 0.226946,-0.084997,0.198347, 0.060656,0.320596,-0.223141, 0.161719,-0.084997,-0.120143, 0.217947,0.320596,-0.008094, -0.049829,0.124065,-0.330981, -0.154088,-0.230098,-0.199706, -0.019141,-0.278134,-0.109104, 0.160374,0.124065,-0.228342, 0.234799,0.071081,-0.164747, 0.302859,0.209772,0.028184, 0.317695,0.159603,0.012337, }; -public static final int h54_faces[] = { +public static final int[] h54_faces = { // [] = { 4, 6,8,3,1, 5, 3,15,11,9,1, 7, 9,0,18,12,4,6,1, @@ -1416,18 +1416,18 @@ public class Halton235Geom { 5, 11,17,19,0,9, 3, 0,19,18, }; -public static final double h54_planes[ h54_numf * 4 ] = { +public static final double[] h54_planes = { // [ h54_numf * 4 ] = { 0.242073,-0.64915,0.721114,0.41616,0.717787,-0.680568,-0.147003,0.191588,0.212159,0.447018,0.869002,0.182518,0.0541955,0.456759,-0.887938,0.347858,0.398278,-0.419585,-0.815673,0.19807,-1,0,0,0.154088,0.066237,-0.837367,-0.542613,0.290833,0,1,0,0.320596,0.742791,0.391264,-0.543299,0.291725,0.433652,-0.152285,-0.888119,0.253448,0.870583,-0.45858,-0.178295,0.201189,0.962317,0.253449,0.0985412,0.34739 }; // h55 public static final int h55_numv = 16; public static final int h55_numf = 10; public static final double h55_volu = 0.055290; -public static final double h55_pos[3] = { 0.087136,0.788999,0.139771 }; -public static final double h55_verts[ h55_numv * 3 ] = { +public static final double[] h55_pos = { 0.087136,0.788999,0.139771 }; +public static final double[] h55_verts = { // [ h55_numv * 3 ] = { 0.076080,-0.416095,-0.083059, -0.323951,0.211001,0.286715, 0.205112,0.211001,-0.185127, 0.076081,0.211001,-0.405639, -0.148237,0.211001,0.332473, 0.101171,-0.226374,0.192117, -0.006832,-0.085411,0.277812, 0.205111,-0.223849,0.038561, -0.274823,0.078877,0.258729, 0.035595,0.211001,-0.415523, 0.074576,-0.413789,-0.064275, 0.079238,-0.416513,-0.077447, 0.107256,-0.249478,0.168347, 0.117855,-0.236273,0.172768, 0.029258,-0.402186,-0.087713, 0.035598,-0.405195,-0.098549, }; -public static final int h55_faces[] = { +public static final int[] h55_faces = { // [] = { 4, 8,6,4,1, 5, 4,2,3,9,1, 5, 9,15,14,8,1, @@ -1439,18 +1439,18 @@ public class Halton235Geom { 5, 13,12,10,11,7, 5, 14,15,0,11,10, }; -public static final double h55_planes[ h55_numf * 4 ] = { +public static final double[] h55_planes = { // [ h55_numf * 4 ] = { -0.241471,-0.286187,0.927248,0.283694,0,1,0,0.211001,-0.866617,-0.228251,-0.443708,0.105363,0.835368,-0.251447,-0.48881,0.20878,0.793214,0.278548,0.541501,0.121225,0.212159,-0.447018,-0.869002,0.274321,0.443092,-0.583496,0.68059,0.307669,-0.463507,-0.691764,0.553737,0.216086,0.66062,-0.653782,0.368986,0.296077,-0.292039,-0.95183,0.0934524,0.366071 }; // h56 public static final int h56_numv = 20; public static final int h56_numf = 12; public static final double h56_volu = 0.096963; -public static final double h56_pos[3] = { -0.186579,0.800379,0.005269 }; -public static final double h56_verts[ h56_numv * 3 ] = { +public static final double[] h56_pos = { -0.186579,0.800379,0.005269 }; +public static final double[] h56_verts = { // [ h56_numv * 3 ] = { 0.004502,-0.334912,-0.018030, 0.302973,-0.413566,0.046788, 0.309310,0.199621,-0.281021, -0.242420,0.199621,0.235284, -0.121421,0.199621,0.412527, 0.172708,0.199621,-0.357250, -0.050236,0.199621,0.421217, -0.341638,0.020145,-0.086171, -0.356474,0.199621,-0.098861, 0.097656,0.085128,-0.340236, -0.001108,0.067497,0.393231, -0.356474,0.088797,-0.117864, -0.277459,-0.105503,0.080310, 0.309314,-0.416575,0.035953, 0.106078,-0.385531,-0.020510, 0.188512,-0.404604,-0.037617, -0.268642,-0.080395,0.110447, -0.118494,0.123210,0.393231, -0.341638,0.038628,-0.133710, -0.322853,0.025254,-0.145176, }; -public static final int h56_faces[] = { +public static final int[] h56_faces = { // [] = { 4, 14,15,13,1, 5, 13,2,6,10,1, 7, 10,17,16,12,0,14,1, @@ -1464,18 +1464,18 @@ public class Halton235Geom { 3, 11,18,7, 5, 15,14,0,19,9, }; -public static final double h56_planes[ h56_numf * 4 ] = { +public static final double[] h56_planes = { // [ h56_numf * 4 ] = { -0.191593,-0.968844,0.156953,0.349977,0.866617,0.228251,0.443708,0.188925,-0.322183,-0.678838,0.659831,0.214003,0.444511,-0.409753,-0.796563,0.279548,4.04497e-16,1,-1.19541e-16,0.199621,-0.813673,-0.17144,0.555468,0.293719,-0.944939,-0.0553043,0.322539,0.29392,-0.117405,-0.247371,0.961782,0.361636,-0.433652,0.152285,-0.888119,0.272785,-0.662611,-0.698059,-0.271405,0.235698,-0.962317,-0.253449,-0.0985412,0.33215,-0.289106,-0.541462,-0.789453,0.194274 }; // h57 public static final int h57_numv = 16; public static final int h57_numf = 10; public static final double h57_volu = 0.081294; -public static final double h57_pos[3] = { 0.851151,0.533342,0.098902 }; -public static final double h57_verts[ h57_numv * 3 ] = { +public static final double[] h57_pos = { 0.851151,0.533342,0.098902 }; +public static final double[] h57_verts = { // [ h57_numv * 3 ] = { -0.184097,0.265595,0.004922, 0.148849,0.009818,-0.380153, 0.148849,-0.049459,0.325702, -0.275924,-0.093697,-0.138710, 0.148849,-0.119626,-0.357957, -0.275924,0.137573,0.059567, -0.112901,0.343928,0.059438, -0.249462,0.157589,0.121951, 0.148849,-0.434521,0.127992, 0.148849,0.447452,0.070089, 0.148849,-0.343521,0.212252, -0.023987,-0.337111,0.083159, -0.018406,-0.089149,0.305285, -0.008312,-0.125079,0.291731, -0.255475,-0.083645,-0.166703, -0.157047,0.040928,-0.236124, }; -public static final int h57_faces[] = { +public static final int[] h57_faces = { // [] = { 4, 4,14,15,1, 5, 15,0,6,9,1, 6, 9,2,10,8,4,1, @@ -1487,18 +1487,18 @@ public class Halton235Geom { 4, 7,6,0,5, 4, 10,13,11,8, }; -public static final double h57_planes[ h57_numf * 4 ] = { +public static final double[] h57_planes = { // [ h57_numf * 4 ] = { -0.433652,-0.152285,-0.888119,0.271577,-0.247318,0.694798,-0.675344,0.226742,1,0,-0,0.148849,-0.0284606,-0.359798,0.932596,0.317307,-0.212159,0.447018,0.869002,0.229347,-0.315015,-0.796483,-0.516121,0.233139,-0.792041,-0.39734,0.463457,0.191487,-0.805488,0.385717,-0.449902,0.248519,-0.777693,0.614473,0.132726,0.307026,-0.49733,-0.589428,0.636583,0.26357 }; // h58 public static final int h58_numv = 20; public static final int h58_numf = 12; public static final double h58_volu = 0.077812; -public static final double h58_pos[3] = { 0.374418,0.849026,0.291935 }; -public static final double h58_verts[ h58_numv * 3 ] = { +public static final double[] h58_pos = { 0.374418,0.849026,0.291935 }; +public static final double[] h58_verts = { // [ h58_numv * 3 ] = { -0.082171,-0.283876,-0.113603, 0.200809,-0.178111,-0.133466, -0.082170,0.150974,-0.337291, 0.089508,-0.034332,0.259248, 0.146093,0.150974,0.326019, 0.410849,0.150974,-0.104898, -0.435519,0.150974,0.180309, -0.294114,-0.145438,0.125648, 0.292636,-0.050089,-0.188111, 0.183309,0.150974,-0.304884, 0.227271,-0.158095,-0.071082, 0.363832,0.028244,-0.133595, -0.169427,-0.296300,0.020604, 0.087144,-0.178878,0.139171, 0.071270,-0.146859,0.192458, -0.429747,0.150974,0.185433, -0.186111,-0.286401,0.039952, 0.048213,-0.131812,0.221308, -0.268420,-0.171352,0.132706, -0.212551,-0.233071,0.128708, }; -public static final int h58_faces[] = { +public static final int[] h58_faces = { // [] = { 5, 10,13,12,0,1, 5, 0,2,9,8,1, 4, 8,11,10,1, @@ -1512,18 +1512,18 @@ public class Halton235Geom { 4, 16,19,18,7, 6, 13,14,17,19,16,12, }; -public static final double h58_planes[ h58_numf * 4 ] = { +public static final double[] h58_planes = { // [ h58_numf * 4 ] = { 0.35532,-0.923345,0.145539,0.216384,0.107916,-0.45476,-0.884052,0.220658,0.777693,-0.614473,-0.132726,0.283326,-0.793214,-0.278548,-0.541501,0.205768,0,1,-0,0.150974,-0.228531,-0.267508,0.936063,0.231401,0.535431,-0.493566,0.685351,0.242546,0.777334,-0.409459,0.477594,0.20745,0.658203,-0.077045,-0.748888,0.337347,-0.604377,-0.413861,0.68077,0.323484,-0.722579,-0.66608,0.18498,0.332636,0.131611,-0.83191,0.539078,0.235303 }; // h59 public static final int h59_numv = 12; public static final int h59_numf = 8; public static final double h59_volu = 0.098632; -public static final double h59_pos[3] = { 0.795288,0.838821,-0.270144 }; -public static final double h59_verts[ h59_numv * 3 ] = { +public static final double[] h59_pos = { 0.795288,0.838821,-0.270144 }; +public static final double[] h59_verts = { // [ h59_numv * 3 ] = { -0.010021,0.161179,0.457181, -0.356162,0.161179,-0.206090, 0.204712,-0.152000,-0.380610, 0.204712,0.161179,-0.434310, -0.057037,0.038449,0.428484, -0.237561,0.161179,0.257195, -0.256523,-0.089455,-0.203657, -0.128234,-0.039885,0.373968, 0.204712,-0.295661,-0.011106, -0.101183,-0.264551,0.132922, 0.204712,0.141973,0.439135, 0.204712,0.161179,0.444075, }; -public static final int h59_faces[] = { +public static final int[] h59_faces = { // [] = { 4, 3,2,6,1, 5, 6,9,7,5,1, 5, 5,0,11,3,1, @@ -1533,18 +1533,18 @@ public class Halton235Geom { 4, 0,5,7,4, 5, 7,9,8,10,4, }; -public static final double h59_planes[ h59_numf * 4 ] = { +public static final double[] h59_planes = { // [ h59_numf * 4 ] = { -0.372229,-0.156858,-0.91479,0.29582,-0.90476,-0.357438,0.231619,0.216895,0,1,0,0.161178,1,1.92688e-15,-1.87292e-15,0.204712,-0.256529,-0.900844,-0.350247,0.217721,0.0590083,-0.248661,0.966792,0.401329,-0.658203,0.077045,0.748888,0.361391,0.247318,-0.694798,0.675344,0.248554 }; // h60 public static final int h60_numv = 22; public static final int h60_numf = 13; public static final double h60_volu = 0.091310; -public static final double h60_pos[3] = { 0.415485,0.715407,-0.130668 }; -public static final double h60_verts[ h60_numv * 3 ] = { +public static final double[] h60_pos = { 0.415485,0.715407,-0.130668 }; +public static final double[] h60_verts = { // [ h60_numv * 3 ] = { -0.064779,0.284593,-0.364069, 0.142242,0.284593,0.117719, -0.242554,-0.352215,0.182461, 0.061056,-0.331466,0.081653, 0.180191,-0.265711,0.062868, 0.251569,0.083531,0.234492, -0.123237,0.284593,0.085312, -0.123238,-0.150257,0.309000, 0.159742,-0.044491,0.289138, 0.278619,-0.141137,-0.006553, -0.252268,0.284593,-0.135200, 0.123280,0.033960,-0.343133, 0.052142,0.000197,-0.360501, 0.023641,0.284593,-0.345566, 0.159742,-0.275763,0.090860, -0.138846,-0.370709,0.063434, -0.249111,-0.342921,0.192992, -0.046519,-0.292460,-0.089523, -0.252269,-0.342503,0.187380, -0.242676,-0.352703,0.180916, 0.052887,-0.337824,0.045824, 0.043373,-0.342729,0.054274, }; -public static final int h60_faces[] = { +public static final int[] h60_faces = { // [] = { 5, 5,9,11,13,1, 5, 13,0,10,6,1, 5, 6,7,8,5,1, @@ -1559,18 +1559,18 @@ public class Halton235Geom { 4, 12,0,13,11, 4, 17,20,21,15, }; -public static final double h60_planes[ h60_numf * 4 ] = { +public static final double[] h60_planes = { // [ h60_numf * 4 ] = { 0.90476,0.357438,-0.231619,0.203154,8.63556e-17,1,-5.05304e-17,0.284593,-0.107916,0.45476,0.884052,0.218141,-0.60243,-0.746152,0.283435,0.460644,0.159459,-0.944944,0.285751,0.346285,0.284317,-0.624015,0.727852,0.28363,0.488006,-0.871758,0.0434538,0.322301,0.46199,-0.681388,-0.567693,0.228609,0.805488,-0.385717,0.449902,0.275915,-0.835368,0.251447,0.48881,0.21621,-0.73548,-0.309929,-0.602505,0.178793,0.204299,0.0717432,-0.976276,0.362615,0.120149,-0.911351,-0.393704,0.29619 }; // h61 public static final int h61_numv = 24; public static final int h61_numf = 14; public static final double h61_volu = 0.075853; -public static final double h61_pos[3] = { 0.499694,0.403970,0.252554 }; -public static final double h61_verts[ h61_numv * 3 ] = { +public static final double[] h61_pos = { 0.499694,0.403970,0.252554 }; +public static final double[] h61_verts = { // [ h61_numv * 3 ] = { 0.101994,0.286961,-0.031701, -0.294704,0.148756,0.059985, -0.023153,-0.020028,-0.301569, 0.156136,0.037589,0.286475, -0.323273,-0.108125,-0.115004, 0.032521,-0.286922,0.028066, -0.038132,0.266178,0.178552, 0.260541,-0.250848,-0.073994, 0.327470,-0.207739,-0.070493, 0.075532,0.266945,-0.094084, 0.075532,0.035675,-0.292362, 0.343145,0.004293,0.138079, 0.231743,0.048354,0.251404, 0.045317,0.188205,0.223756, -0.087937,-0.209333,0.181412, -0.330859,-0.089605,0.055955, 0.333052,0.040223,0.151633, 0.236542,0.052068,0.247099, -0.339382,-0.095975,-0.073501, -0.326763,-0.040778,-0.200761, -0.207448,0.161180,-0.074222, -0.333320,-0.031483,-0.190230, -0.305302,0.135551,0.055565, -0.337982,-0.028760,-0.177059, }; -public static final int h61_faces[] = { +public static final int[] h61_faces = { // [] = { 5, 20,21,23,22,1, 7, 22,15,14,3,13,6,1, 5, 6,0,9,20,1, @@ -1586,18 +1586,18 @@ public class Halton235Geom { 4, 16,17,12,11, 4, 22,23,18,15, }; -public static final double h61_planes[ h61_numf * 4 ] = { +public static final double[] h61_planes = { // [ h61_numf * 4 ] = { -0.66062,0.653782,-0.368986,0.269808,-0.438192,0.051293,0.897417,0.190598,-0.35532,0.923345,-0.145539,0.233338,-0.148211,-0.780702,-0.607074,0.202142,-0.284317,0.624015,-0.727852,0.213583,0.322885,-0.43293,-0.841615,0.255,0.391463,-0.659847,0.641373,0.220056,0.289106,0.541462,0.789453,0.291652,-0.900933,-0.358346,-0.24476,0.358143,-0.471464,-0.878752,0.0742736,0.238885,0.496382,0.766976,0.406636,0.25783,0.792041,0.39734,-0.463457,0.209497,0.696788,-0.0734069,0.713511,0.337305,-0.991833,0.112685,0.0597434,0.321404 }; // h62 public static final int h62_numv = 18; public static final int h62_numf = 11; public static final double h62_volu = 0.089635; -public static final double h62_pos[3] = { -0.412607,-0.798932,0.393221 }; -public static final double h62_verts[ h62_numv * 3 ] = { +public static final double[] h62_pos = { -0.412607,-0.798932,0.393221 }; +public static final double[] h62_verts = { // [ h62_numv * 3 ] = { 0.143743,0.178906,-0.080212, -0.336591,-0.057070,0.045432, -0.365487,-0.201068,0.063069, -0.043446,-0.201068,0.325146, -0.118881,0.178753,-0.144486, -0.152818,-0.201068,-0.248459, 0.205095,-0.201068,-0.388268, 0.337853,-0.164947,-0.214818, 0.038585,0.368996,0.228990, 0.242459,-0.068737,-0.310888, -0.200495,0.172297,-0.114599, -0.231981,0.184967,-0.066303, 0.334110,-0.201068,-0.227916, 0.209245,-0.110463,-0.361925, 0.145031,0.335652,0.325145, 0.169974,0.297178,0.268816, -0.151147,0.272981,0.102025, 0.044821,0.272804,-0.007759, }; -public static final int h62_faces[] = { +public static final int[] h62_faces = { // [] = { 5, 11,10,5,2,1, 6, 2,3,14,8,16,1, 3, 16,11,1, @@ -1610,18 +1610,18 @@ public class Halton235Geom { 4, 9,0,15,7, 5, 14,15,0,17,8, }; -public static final double h62_planes[ h62_numf * 4 ] = { +public static final double[] h62_planes = { // [ h62_numf * 4 ] = { -0.822068,0.096228,-0.561199,0.245712,-0.616244,0.216405,0.75724,0.229475,-0.870583,0.45858,0.178295,0.27496,4.16641e-16,-1,1.84056e-16,0.201068,0.793214,-0.278548,0.541501,0.197612,-0.20808,0.904248,-0.372879,0.24025,0.167754,0.706913,-0.687119,0.205699,-0.349687,0.276295,-0.895198,0.220304,0.770892,0.145024,-0.620237,0.369765,0.799798,0.547681,-0.245698,0.232657,0.526505,0.792388,-0.308081,0.242156 }; // h63 public static final int h63_numv = 20; public static final int h63_numf = 12; public static final double h63_volu = 0.065070; -public static final double h63_pos[3] = { -0.683722,-0.408459,0.881106 }; -public static final double h63_verts[ h63_numv * 3 ] = { +public static final double[] h63_pos = { -0.683722,-0.408459,0.881106 }; +public static final double[] h63_verts = { // [ h63_numv * 3 ] = { 0.408763,0.050375,-0.050997, 0.001643,0.372246,0.104787, -0.316278,-0.373443,0.118894, -0.000569,0.379463,0.118894, -0.316278,-0.303582,-0.012874, 0.413107,-0.090210,0.118894, 0.072977,-0.026465,-0.250457, -0.316278,0.104758,0.118894, -0.133134,0.036421,-0.232486, -0.316278,-0.061367,-0.137470, 0.406500,0.014459,-0.083368, 0.416439,0.055265,0.118894, 0.411396,0.069115,-0.001513, 0.370009,0.144956,0.118894, 0.377753,0.036235,-0.132875, 0.381520,0.034894,-0.130346, 0.374104,0.031050,-0.138388, 0.376042,0.032985,-0.136218, 0.383396,0.034505,-0.128411, 0.385682,0.029196,-0.126410, }; -public static final int h63_faces[] = { +public static final int[] h63_faces = { // [] = { 5, 8,9,7,3,1, 8, 3,13,12,0,18,15,14,1, 6, 14,17,16,6,8,1, @@ -1635,18 +1635,18 @@ public class Halton235Geom { 3, 15,17,14, 5, 18,19,16,17,15, }; -public static final double h63_planes[ h63_numf * 4 ] = { +public static final double[] h63_planes = { // [ h63_numf * 4 ] = { -0.589724,0.677749,-0.439183,0.2053,0.50496,0.797961,-0.32905,0.263387,0.141863,0.672536,-0.72634,0.174471,0.324513,-0.835692,-0.443069,0.156769,2.1681e-17,-2.49173e-17,1,0.118894,-1,0,0,0.316278,-0.212159,-0.447018,-0.869002,0.213995,0.998749,-0.0228741,-0.044466,0.409367,0.901569,0.256913,-0.348094,0.399222,0.887955,0.459664,0.015677,0.397046,0.604872,0.393584,-0.692258,0.334738,0.721996,0.0507074,-0.690036,0.367169 }; // h64 public static final int h64_numv = 14; public static final int h64_numf = 9; public static final double h64_volu = 0.063334; -public static final double h64_pos[3] = { -0.862240,-0.589074,0.504780 }; -public static final double h64_verts[ h64_numv * 3 ] = { +public static final double[] h64_pos = { -0.862240,-0.589074,0.504780 }; +public static final double[] h64_verts = { // [ h64_numv * 3 ] = { -0.034062,-0.410926,-0.010011, 0.045384,0.217035,0.143840, 0.295955,0.147819,0.066170, 0.251495,0.154150,0.125869, -0.137760,-0.410926,0.116573, -0.137760,0.324258,-0.236366, -0.137760,0.210059,-0.342106, -0.137760,-0.122967,0.363452, -0.137760,-0.410926,-0.022669, 0.298486,0.063123,-0.009534, -0.137760,0.298525,-0.037806, 0.113042,-0.266928,-0.066127, -0.137760,0.119248,0.238856, 0.217652,-0.024891,-0.177862, }; -public static final int h64_faces[] = { +public static final int[] h64_faces = { // [] = { 3, 10,12,1, 4, 12,7,3,1, 5, 3,2,5,10,1, @@ -1657,18 +1657,18 @@ public class Halton235Geom { 5, 13,11,0,8,6, 3, 11,13,9, }; -public static final double h64_planes[ h64_numf * 4 ] = { +public static final double[] h64_planes = { // [ h64_numf * 4 ] = { -0.163718,0.827886,0.536471,0.249417,0.212159,0.447018,0.869002,0.231645,0.299389,0.946218,0.12263,0.23659,0.619037,0.533581,-0.576268,0.223949,0.679728,-0.477395,0.556833,0.167446,-1,0,0,0.13776,-0,-1,0,0.410926,0.107916,-0.45476,-0.884052,0.192047,0.870583,-0.45858,-0.178295,0.23261 }; // h65 public static final int h65_numv = 22; public static final int h65_numf = 13; public static final double h65_volu = 0.115639; -public static final double h65_pos[3] = { -0.632833,-0.759826,0.781144 }; -public static final double h65_verts[ h65_numv * 3 ] = { +public static final double[] h65_pos = { -0.632833,-0.759826,0.781144 }; +public static final double[] h65_verts = { // [ h65_numv * 3 ] = { -0.367167,-0.022076,0.218856, 0.176779,-0.240174,-0.062777, -0.145261,-0.240174,-0.324854, -0.367167,-0.240174,-0.159791, -0.367167,-0.240174,0.218856, 0.229214,-0.240174,0.218856, -0.367167,0.047785,0.087088, 0.379478,0.318313,-0.027451, 0.258810,0.329890,-0.158933, 0.022088,0.324902,-0.150495, -0.263470,-0.240174,-0.286375, -0.116365,-0.096176,-0.342491, 0.384007,0.200623,0.218856, 0.365257,0.296546,-0.062778, 0.323215,0.382417,-0.038426, 0.362218,0.261157,0.218856, 0.374110,0.331198,-0.022696, 0.069079,0.233875,-0.285898, 0.066548,0.318571,-0.210194, 0.259984,0.356129,-0.135062, 0.334793,0.380563,-0.026448, 0.355611,0.365826,0.016594, }; -public static final int h65_faces[] = { +public static final int[] h65_faces = { // [] = { 5, 13,7,12,5,1, 6, 5,4,3,10,2,1, 6, 2,11,17,8,13,1, @@ -1683,18 +1683,18 @@ public class Halton235Geom { 4, 14,19,18,9, 3, 20,21,16, }; -public static final double h65_planes[ h65_numf * 4 ] = { +public static final double[] h65_planes = { // [ h65_numf * 4 ] = { 0.929286,-0.326334,-0.173016,0.253517,5.14845e-16,-1,8.60294e-16,0.240174,0.616244,-0.216405,-0.75724,0.208451,-0.309078,-0.0542691,-0.949487,0.366376,-0.679728,0.477395,-0.556833,0.223893,-1,0,0,0.367167,-0,0,1,0.218856,-0.324513,0.835692,0.443069,0.19767,0.664689,0.486283,-0.567201,0.422595,0.931229,0.335191,0.143037,0.45615,0.156805,0.660773,-0.734024,0.375226,-0.11569,0.975032,-0.189546,0.34276,0.777249,0.606249,-0.168364,0.495386 }; // h66 public static final int h66_numv = 12; public static final int h66_numf = 8; public static final double h66_volu = 0.090843; -public static final double h66_pos[3] = { 0.194452,-0.846656,0.702344 }; -public static final double h66_verts[ h66_numv * 3 ] = { +public static final double[] h66_pos = { 0.194452,-0.846656,0.702344 }; +public static final double[] h66_verts = { // [ h66_numv * 3 ] = { 0.144722,0.221953,-0.171396, 0.354760,-0.153344,-0.123136, 0.229722,0.177289,-0.118776, -0.077080,-0.093853,-0.442151, -0.263367,-0.153344,0.297656, 0.293204,-0.153344,0.297656, -0.291202,0.163722,0.297656, 0.229722,0.015381,0.297656, -0.072437,-0.153344,-0.456885, -0.246539,0.275009,-0.021290, -0.133324,-0.153344,-0.464317, -0.137311,-0.122439,-0.456854, }; -public static final int h66_faces[] = { +public static final int[] h66_faces = { // [] = { 5, 8,3,0,2,1, 4, 2,7,5,1, 5, 5,4,10,8,1, @@ -1704,18 +1704,18 @@ public class Halton235Geom { 5, 6,9,11,10,4, 4, 5,7,6,4, }; -public static final double h66_planes[ h66_numf * 4 ] = { +public static final double[] h66_planes = { // [ h66_numf * 4 ] = { 0.598205,0.236328,-0.765702,0.270266,0.927293,0.348894,0.13565,0.258762,2.17789e-18,-1,-1.78413e-17,0.153344,0.256529,0.900843,0.350248,0.17704,0.117405,0.247372,-0.961781,0.392986,-0.167754,0.706913,-0.687119,0.250394,-0.982077,-0.0862167,-0.167608,0.221978,0,0,1,0.297657 }; // h67 public static final int h67_numv = 14; public static final int h67_numf = 9; public static final double h67_volu = 0.073139; -public static final double h67_pos[3] = { -0.182450,-0.819619,0.699488 }; -public static final double h67_verts[ h67_numv * 3 ] = { +public static final double[] h67_pos = { -0.182450,-0.819619,0.699488 }; +public static final double[] h67_verts = { // [ h67_numv * 3 ] = { 0.085699,0.136685,0.300512, -0.221169,-0.180381,0.300512, -0.273604,-0.180381,0.018878, 0.130363,0.247972,-0.018435, -0.085126,0.356339,0.018877, 0.113535,-0.180381,0.300512, -0.066376,0.260416,0.300512, -0.060183,0.317865,-0.037452, 0.103953,-0.180381,-0.534183, 0.107696,-0.144260,-0.521085, 0.239592,-0.149476,-0.453999, 0.243578,-0.180381,-0.461462, -0.070905,0.378106,0.054205, -0.032656,0.358692,0.028913, }; -public static final int h67_faces[] = { +public static final int[] h67_faces = { // [] = { 5, 6,12,4,2,1, 5, 2,8,11,5,1, 4, 5,0,6,1, @@ -1726,18 +1726,18 @@ public class Halton235Geom { 4, 12,13,7,4, 4, 9,10,11,8, }; -public static final double h67_planes[ h67_numf * 4 ] = { +public static final double[] h67_planes = { // [ h67_numf * 4 ] = { -0.929286,0.326334,0.173016,0.198658,4.99955e-17,-1,-5.73911e-19,0.180381,0,0,1,0.300512,-0.793214,0.278548,-0.541501,0.156559,0.32928,0.737152,-0.590069,0.236597,0.59399,0.730061,0.337914,0.25224,0.982077,0.0862167,0.167608,0.146316,0.0662371,0.837367,-0.542614,0.282505,0.445543,0.264025,-0.855443,0.455654 }; // h68 public static final int h68_numv = 24; public static final int h68_numf = 14; public static final double h68_volu = 0.110178; -public static final double h68_pos[3] = { 0.194790,-0.476753,0.823942 }; -public static final double h68_verts[ h68_numv * 3 ] = { +public static final double[] h68_pos = { 0.194790,-0.476753,0.823942 }; +public static final double[] h68_verts = { // [ h68_numv * 3 ] = { -0.387371,0.030890,-0.107289, 0.221446,0.021860,-0.353469, -0.465405,-0.021917,0.176058, -0.291540,-0.206181,0.176058, 0.076464,0.334736,-0.007133, 0.229384,-0.354523,0.176058, 0.292644,0.032441,-0.334080, -0.452945,0.146290,0.025179, 0.246219,0.093034,-0.297244, 0.229037,0.025757,-0.352826, 0.107091,0.321655,0.176058, 0.390186,-0.018723,0.176058, 0.312682,0.010704,-0.315910, 0.229384,-0.192615,-0.240374, 0.144384,-0.147950,-0.292995, -0.246877,-0.094895,-0.142888, -0.409896,0.015825,-0.095540, -0.443616,-0.082450,0.176058, -0.462073,0.123559,0.176058, -0.472012,0.082753,-0.026204, -0.453513,0.048124,-0.065494, -0.448145,0.035240,-0.070249, -0.469749,0.118668,0.006167, -0.467116,0.137408,0.055651, }; -public static final int h68_faces[] = { +public static final int[] h68_faces = { // [] = { 5, 14,15,16,0,1, 9, 0,20,19,22,7,4,8,9,1, 6, 9,6,12,13,14,1, @@ -1753,18 +1753,18 @@ public class Halton235Geom { 3, 22,23,7, 4, 21,20,0,16, }; -public static final double h68_planes[ h68_numf * 4 ] = { +public static final double[] h68_planes = { // [ h68_numf * 4 ] = { -0.372229,-0.156856,-0.91479,0.237492,-0.27553,0.653111,-0.705358,0.202583,0.296224,-0.4369,-0.849335,0.35626,-0.931229,-0.335191,-0.143037,0.415561,-0,0,1,0.176058,-0.998749,0.0228741,0.044466,0.472149,-0.59399,-0.730061,-0.337914,0.264205,-0.256529,-0.900843,-0.350248,0.198862,0.766208,0.637263,-0.0825892,0.272492,-0.326272,0.937436,0.121492,0.287979,0.88947,-0.425933,-0.165603,0.325878,0.16676,0.602337,-0.780629,0.329134,-0.777217,0.601031,-0.186267,0.435271,-0.512456,0.101226,-0.852726,0.293125 }; // h69 public static final int h69_numv = 18; public static final int h69_numf = 11; public static final double h69_volu = 0.150904; -public static final double h69_pos[3] = { 0.751581,-0.668854,0.749549 }; -public static final double h69_verts[ h69_numv * 3 ] = { +public static final double[] h69_pos = { 0.751581,-0.668854,0.749549 }; +public static final double[] h69_verts = { // [ h69_numv * 3 ] = { 0.248419,0.357221,0.250451, -0.263925,-0.331146,0.250451, 0.248419,0.283773,-0.306518, 0.248419,-0.331146,0.009798, 0.000203,0.129153,-0.348181, 0.248419,-0.331146,0.250451, -0.202369,-0.331146,-0.170342, -0.161439,-0.331146,-0.190328, 0.248419,0.424683,-0.270088, -0.087381,0.269445,-0.329471, -0.149648,0.251714,-0.296027, -0.327407,-0.162422,0.250451, -0.166605,0.173379,0.250451, -0.045433,0.301175,-0.321470, -0.327407,-0.000512,-0.165981, -0.244109,0.202806,-0.241517, 0.223596,0.415674,-0.285417, 0.248419,0.419976,-0.283164, }; -public static final int h69_faces[] = { +public static final int[] h69_faces = { // [] = { 4, 11,14,6,1, 5, 6,7,3,5,1, 5, 5,0,12,11,1, @@ -1777,18 +1777,18 @@ public class Halton235Geom { 3, 10,13,9, 4, 12,15,14,11, }; -public static final double h69_planes[ h69_numf * 4 ] = { +public static final double[] h69_planes = { // [ h69_numf * 4 ] = { -0.927293,-0.348894,-0.13565,0.326296,0,-1,-0,0.331146,8.48822e-17,-4.06468e-17,1,0.250451,0.0600487,0.168696,-0.983837,0.364353,1,-0,0,0.248419,0.398278,-0.419585,-0.815673,0.229892,-0.433652,-0.152285,-0.888119,0.28947,-0.131169,0.932758,-0.335793,0.454236,-0.402198,0.907959,0.117672,0.2539,-0.469026,0.741177,-0.480283,0.39893,-0.88947,0.425933,0.165603,0.263513 }; // h70 public static final int h70_numv = 8; public static final int h70_numf = 6; public static final double h70_volu = 0.052841; -public static final double h70_pos[3] = { 0.870032,-0.820199,0.384721 }; -public static final double h70_verts[ h70_numv * 3 ] = { +public static final double[] h70_pos = { 0.870032,-0.820199,0.384721 }; +public static final double[] h70_verts = { // [ h70_numv * 3 ] = { 0.129968,-0.179801,0.374626, 0.129968,-0.179801,-0.351943, -0.279890,-0.179801,0.174500, 0.129968,0.435118,0.058310, -0.112815,-0.179801,-0.233397, -0.118249,0.280498,0.016648, 0.129968,-0.066134,-0.371433, -0.064784,-0.043027,-0.280302, }; -public static final int h70_faces[] = { +public static final int[] h70_faces = { // [] = { 4, 4,7,6,1, 4, 6,3,0,1, 4, 0,2,4,1, @@ -1796,18 +1796,18 @@ public class Halton235Geom { 4, 0,3,5,2, 4, 6,7,5,3, }; -public static final double h70_planes[ h70_numf * 4 ] = { +public static final double[] h70_planes = { // [ h70_numf * 4 ] = { -0.433652,-0.152285,-0.888119,0.283587,1,0,0,0.129968,0,-1,0,0.179801,-0.908278,0.191373,-0.372031,0.154889,-0.398278,0.419585,0.815673,0.178367,-0.267862,0.627092,-0.731441,0.195395 }; // h71 public static final int h71_numv = 16; public static final int h71_numf = 10; public static final double h71_volu = 0.078575; -public static final double h71_pos[3] = { -0.715618,-0.146967,0.614144 }; -public static final double h71_verts[ h71_numv * 3 ] = { +public static final double[] h71_pos = { -0.715618,-0.146967,0.614144 }; +public static final double[] h71_verts = { // [ h71_numv * 3 ] = { -0.284382,-0.099249,-0.355298, 0.407938,-0.228507,0.130744, -0.284382,-0.117849,-0.345730, 0.406000,-0.230442,0.128574, 0.033539,0.110754,0.371749, 0.104873,-0.287957,0.016505, -0.197952,0.422046,0.249299, -0.284382,0.237452,0.048837, -0.101238,-0.225072,0.034476, -0.284382,-0.143582,-0.147170, 0.149333,-0.294288,-0.043194, 0.409649,-0.225257,0.134087, 0.147525,0.085239,-0.239307, 0.183419,0.150542,-0.169689, 0.342769,-0.256730,0.031938, 0.344779,-0.242424,0.025560, }; -public static final int h71_faces[] = { +public static final int[] h71_faces = { // [] = { 4, 3,14,15,1, 5, 15,12,13,11,1, 6, 11,4,8,5,3,1, @@ -1819,18 +1819,18 @@ public class Halton235Geom { 5, 6,7,9,8,4, 5, 13,12,0,7,6, }; -public static final double h71_planes[ h71_numf * 4 ] = { +public static final double[] h71_planes = { // [ h71_numf * 4 ] = { 0.830322,-0.320028,-0.456232,0.352199,0.848621,0.0894025,-0.521393,0.257586,-0.141863,-0.672536,0.72634,0.190772,0.398278,-0.419585,-0.815673,0.218187,-0.299389,-0.946218,-0.12263,0.239048,-1,-0,0,0.284382,0.11569,-0.975032,0.189546,0.296029,0.727925,0.639055,0.248465,0.187558,-0.735479,-0.309932,0.602505,0.164988,-0.1544,0.759081,-0.632422,0.193269 }; // h72 public static final int h72_numv = 24; public static final int h72_numf = 14; public static final double h72_volu = 0.135103; -public static final double h72_pos[3] = { -0.469590,0.119774,0.755853 }; -public static final double h72_verts[ h72_numv * 3 ] = { +public static final double[] h72_pos = { -0.469590,0.119774,0.755853 }; +public static final double[] h72_verts = { // [ h72_numv * 3 ] = { -0.212489,-0.155987,0.230040, -0.214701,-0.148769,0.244147, -0.443980,0.155306,0.107590, 0.375305,0.040715,-0.139275, -0.004437,0.090870,-0.389509, 0.311360,0.156806,0.046426, -0.480672,0.247962,0.244147, -0.005314,0.363706,-0.137567, 0.163621,-0.491997,-0.007622, 0.213688,0.055724,0.244147, -0.495580,0.247143,0.161130, -0.499540,0.269230,0.219387, 0.144703,0.290282,-0.088352, 0.355676,0.140088,-0.062598, -0.062609,-0.116199,-0.311398, -0.088334,0.254773,-0.303291, 0.356369,0.017480,-0.175583, 0.155877,-0.383277,0.244147, 0.169264,-0.493727,-0.003158, 0.197264,-0.459118,0.123740, 0.194631,-0.477857,0.074256, 0.211435,-0.450236,0.093267, 0.167388,-0.493339,-0.005093, 0.169626,-0.492143,-0.004615, }; -public static final int h72_faces[] = { +public static final int[] h72_faces = { // [] = { 8, 0,8,22,18,20,19,17,1, 4, 17,9,6,1, 6, 6,11,10,2,0,1, @@ -1846,18 +1846,18 @@ public class Halton235Geom { 3, 22,23,18, 3, 20,21,19, }; -public static final double h72_planes[ h72_numf * 4 ] = { +public static final double[] h72_planes = { // [ h72_numf * 4 ] = { -0.50496,-0.797961,0.32905,0.307465,0,0,1,0.244147,-0.820856,-0.550308,0.152828,0.29542,-0.751031,-0.0376746,-0.659191,0.256669,-0.727925,-0.639055,-0.248465,0.197203,0.49733,0.589429,-0.636582,0.299309,0.913105,-0.120244,0.389591,0.283536,0.892822,-0.397939,-0.210981,0.348263,0.398278,-0.419584,-0.815674,0.277818,0.568103,0.816132,0.105771,0.30977,0.226312,0.817437,0.529699,0.223235,-0.411928,0.842404,-0.347377,0.356365,0.474458,-0.651966,-0.591464,0.404071,0.777217,-0.601031,0.186267,0.452309 }; // h73 public static final int h73_numv = 16; public static final int h73_numf = 10; public static final double h73_volu = 0.036032; -public static final double h73_pos[3] = { -0.912743,-0.085439,0.831075 }; -public static final double h73_verts[ h73_numv * 3 ] = { +public static final double[] h73_pos = { -0.912743,-0.085439,0.831075 }; +public static final double[] h73_verts = { // [ h73_numv * 3 ] = { 0.095887,-0.286600,-0.182455, -0.087257,0.175924,-0.168094, -0.087257,-0.205110,-0.364101, 0.230664,0.049226,0.154818, -0.037519,0.453174,0.168925, 0.228452,0.056443,0.168925, -0.087257,0.484247,0.168925, -0.000826,0.360518,0.032367, -0.087257,-0.218262,0.168925, -0.087257,-0.384387,-0.087440, -0.087257,0.485343,0.150329, -0.064760,0.476158,0.168925, -0.052427,0.452355,0.085908, -0.087257,0.457669,0.073457, -0.056387,0.474442,0.144165, -0.056885,0.474757,0.144652, }; -public static final int h73_faces[] = { +public static final int[] h73_faces = { // [] = { 4, 13,12,7,1, 5, 7,3,0,2,1, 7, 2,9,8,6,10,13,1, @@ -1869,18 +1869,18 @@ public class Halton235Geom { 4, 11,15,10,6, 5, 15,14,12,13,10, }; -public static final double h73_planes[ h73_numf * 4 ] = { +public static final double[] h73_planes = { // [ h73_numf * 4 ] = { 0.347582,0.610296,-0.711847,0.196695,0.735479,0.309932,-0.602505,0.091627,-1,0,0,0.0872566,0.163718,-0.827886,-0.536471,0.350852,0.589724,-0.677749,0.439183,0.170659,0.820856,0.550308,-0.152828,0.192771,0.636259,0.754085,0.162882,0.345375,3.43778e-17,-3.95092e-17,1,0.168925,0.337828,0.939579,0.0553497,0.434861,0.255819,0.909579,-0.327448,0.369911 }; // h74 public static final int h74_numv = 22; public static final int h74_numf = 13; public static final double h74_volu = 0.115647; -public static final double h74_pos[3] = { -0.806688,0.162223,0.365754 }; -public static final double h74_verts[ h74_numv * 3 ] = { +public static final double[] h74_pos = { -0.806688,0.162223,0.365754 }; +public static final double[] h74_verts = { // [ h74_numv * 3 ] = { -0.106882,0.112856,0.497689, -0.158482,0.204693,0.551229, 0.218764,0.243174,-0.153679, 0.270615,-0.014193,-0.214570, -0.193312,-0.071737,0.297227, 0.312298,0.070592,-0.150604, -0.069795,-0.227826,-0.358730, 0.248765,0.212323,0.086808, -0.193312,-0.408439,-0.106908, -0.193312,0.210007,0.538778, 0.301657,0.087464,-0.177940, -0.191931,0.033024,-0.314003, -0.193312,0.271426,0.001678, 0.058968,0.264774,-0.186519, -0.193312,0.247719,-0.120270, 0.052425,0.263623,-0.188445, 0.332661,0.048420,0.000590, 0.274489,-0.158648,0.078702, 0.238595,-0.223951,0.009084, 0.229318,-0.111676,-0.252511, -0.193312,-0.302733,-0.342536, -0.193312,0.032765,-0.313772, }; -public static final int h74_faces[] = { +public static final int[] h74_faces = { // [] = { 6, 7,2,13,12,9,1, 4, 9,4,0,1, 5, 0,17,16,7,1, @@ -1895,18 +1895,18 @@ public class Halton235Geom { 4, 21,14,15,11, 4, 13,15,14,12, }; -public static final double h74_planes[ h74_numf * 4 ] = { +public static final double[] h74_planes = { // [ h74_numf * 4 ] = { 0.110273,0.987466,0.11292,0.246896,-0.347582,-0.610296,0.711847,0.322553,0.751031,0.0376746,0.659191,0.252053,0.878502,0.475257,-0.0486263,0.315228,0.228531,0.267508,-0.936063,0.258898,0.929286,-0.326334,-0.173016,0.293234,0.897445,-0.121213,-0.424146,0.335592,-1,0,0,0.193312,0.1544,-0.759081,0.632422,0.21258,-0.179474,0.0840327,-0.980167,0.344997,0.446963,-0.816184,-0.366152,0.286102,-0.242073,0.64915,-0.721114,0.29433,-0.11569,0.975032,-0.189546,0.286695 }; // h75 public static final int h75_numv = 18; public static final int h75_numf = 11; public static final double h75_volu = 0.089620; -public static final double h75_pos[3] = { 0.052817,0.072055,0.868740 }; -public static final double h75_verts[ h75_numv * 3 ] = { +public static final double[] h75_pos = { 0.052817,0.072055,0.868740 }; +public static final double[] h75_verts = { // [ h75_numv * 3 ] = { 0.433734,0.123433,0.131260, 0.005775,0.176863,-0.278988, 0.218437,-0.214071,-0.051932, -0.366530,-0.335558,0.131260, -0.308719,0.103443,0.131260, -0.147102,0.088434,-0.252162, -0.310972,-0.402518,-0.019619, -0.003079,0.231496,-0.237914, 0.112171,0.347564,-0.006639, 0.302595,-0.019353,-0.141822, 0.235603,0.353295,0.131260, 0.077918,0.377107,0.131260, 0.249063,-0.227153,0.131260, -0.166731,0.187806,-0.175486, -0.093909,0.310921,0.131260, -0.211047,0.204525,-0.066461, -0.325143,-0.411399,0.010853, -0.320100,-0.425249,0.131260, }; -public static final int h75_faces[] = { +public static final int[] h75_faces = { // [] = { 6, 7,8,10,0,9,1, 5, 9,2,6,5,1, 4, 5,13,7,1, @@ -1919,18 +1919,18 @@ public class Halton235Geom { 6, 13,15,14,11,8,7, 3, 11,10,8, }; -public static final double h75_planes[ h75_numf * 4 ] = { +public static final double[] h75_planes = { // [ h75_numf * 4 ] = { 0.619037,0.533582,-0.576267,0.258718,0.107917,-0.454758,-0.884053,0.166834,-0.421977,0.500122,-0.756183,0.296982,0.326272,-0.937436,-0.121492,0.278257,0.870584,-0.458578,-0.178296,0.297595,-0.887955,-0.459664,-0.015677,0.477648,0,0,1,0.13126,-0.913105,0.120244,-0.389591,0.243193,-0.694517,0.719058,0.0245236,0.292011,-0.345296,0.896431,-0.277815,0.27468,0.14709,0.974029,-0.172138,0.356179 }; // h76 public static final int h76_numv = 24; public static final int h76_numf = 14; public static final double h76_volu = 0.095138; -public static final double h76_pos[3] = { 0.088788,-0.142804,0.576459 }; -public static final double h76_verts[ h76_numv * 3 ] = { +public static final double[] h76_pos = { 0.088788,-0.142804,0.576459 }; +public static final double[] h76_verts = { // [ h76_numv * 3 ] = { 0.352221,-0.240915,-0.049761, -0.386828,-0.236459,0.178237, 0.182466,0.000788,0.240349, -0.006268,0.044860,-0.340368, 0.298110,0.182836,0.102163, -0.389114,-0.231150,0.176236, -0.030195,0.391722,0.013292, -0.363747,-0.215280,0.253650, -0.388752,-0.229565,0.174779, -0.101327,0.289860,-0.170144, 0.328315,-0.307617,-0.113256, -0.079254,0.048914,-0.283309, 0.094387,-0.120263,-0.302438, -0.281369,-0.303059,0.140194, 0.335039,-0.308192,-0.105343, 0.327448,-0.312089,-0.105986, 0.022142,0.379302,-0.133650, -0.346943,-0.187659,0.272661, -0.202009,0.280058,0.003811, -0.183073,0.303293,0.040119, 0.266624,0.195506,0.150459, -0.022476,0.325632,-0.215723, -0.347511,-0.285824,0.181989, -0.366010,-0.251196,0.221279, }; -public static final int h76_faces[] = { +public static final int[] h76_faces = { // [] = { 3, 22,23,1, 4, 23,7,5,1, 8, 5,8,11,3,12,13,22,1, @@ -1946,18 +1946,18 @@ public class Halton235Geom { 3, 14,15,10, 4, 15,13,12,10, }; -public static final double h76_planes[ h76_numf * 4 ] = { +public static final double[] h76_planes = { // [ h76_numf * 4 ] = { -0.777249,-0.606249,0.168364,0.474024,-0.901569,-0.256913,0.348094,0.471545,-0.553104,-0.49165,-0.672575,0.210334,0.27553,-0.653111,0.705358,0.219292,0.822068,-0.096228,0.561199,0.284807,-0.107917,0.454758,0.884053,0.193148,-0.576312,0.303571,-0.758755,0.275486,0.73548,0.309929,-0.602505,0.214367,0.512085,0.851811,0.110395,0.319678,-0.892822,0.397939,0.210981,0.292608,-0.517294,0.817451,-0.253339,0.332466,-0.859244,0.150868,-0.488814,0.213964,0.440632,-0.78713,-0.431589,0.435681,-0.226312,-0.817437,-0.529699,0.237148 }; // h77 public static final int h77_numv = 26; public static final int h77_numf = 15; public static final double h77_volu = 0.087804; -public static final double h77_pos[3] = { 0.390778,-0.073451,0.362494 }; -public static final double h77_verts[ h77_numv * 3 ] = { +public static final double[] h77_pos = { 0.390778,-0.073451,0.362494 }; +public static final double[] h77_verts = { // [ h77_numv * 3 ] = { -0.003880,0.113483,0.316128, 0.315369,-0.294228,0.065585, -0.206158,-0.189928,-0.093832, 0.020979,0.268088,0.071472, -0.324466,0.256279,-0.001758, -0.230465,0.381445,-0.183441, 0.426887,-0.187811,0.054869, 0.211155,-0.343689,0.091028, -0.224735,0.155039,-0.266749, 0.077733,0.119939,0.286241, 0.026325,-0.376970,0.100709, -0.297695,-0.031084,-0.153195, 0.009520,-0.343472,-0.067504, 0.155269,-0.307156,-0.121769, -0.207604,-0.189616,-0.088472, -0.308258,-0.024493,-0.126403, 0.050231,-0.310268,0.164204, 0.176117,-0.273019,-0.144419, 0.417855,-0.153875,-0.005953, 0.273422,-0.325958,0.057585, 0.096656,-0.370860,0.127368, 0.033049,-0.377545,0.108622, -0.214357,0.369295,-0.224944, 0.141437,0.190499,-0.081874, -0.279848,0.309949,0.080316, -0.221943,0.387815,-0.053985, }; -public static final int h77_faces[] = { +public static final int[] h77_faces = { // [] = { 6, 19,13,17,18,6,1, 7, 6,9,0,16,20,7,1, 3, 7,19,1, @@ -1974,18 +1974,18 @@ public class Halton235Geom { 5, 22,23,18,17,8, 3, 21,20,16, }; -public static final double h77_planes[ h77_numf * 4 ] = { +public static final double[] h77_planes = { // [ h77_numf * 4 ] = { 0.590109,-0.664552,-0.458413,0.351567,0.349687,-0.276295,0.895198,0.250286,0.469026,-0.741177,0.480283,0.397491,-0.818514,-0.542417,-0.189261,0.289522,-0.212159,-0.447018,-0.869002,0.21018,-0.568104,-0.816131,-0.105771,0.28205,0.131611,0.83191,0.539077,0.264315,0.727924,0.639056,0.248465,0.204352,0.471464,0.878752,-0.0742736,0.240165,-0.784459,0.61982,0.0211391,0.41334,-0.913105,0.120244,-0.389591,0.327772,-0.73548,-0.309929,0.602505,0.158151,0.162747,-0.964426,-0.208316,0.346865,0.433652,0.152285,-0.888119,0.163058,-0.16676,-0.602337,0.780629,0.306692 }; // h78 public static final int h78_numv = 20; public static final int h78_numf = 12; public static final double h78_volu = 0.126407; -public static final double h78_pos[3] = { 0.652845,-0.171711,0.785711 }; -public static final double h78_verts[ h78_numv * 3 ] = { +public static final double[] h78_pos = { 0.652845,-0.171711,0.785711 }; +public static final double[] h78_verts = { // [ h78_numv * 3 ] = { -0.350965,0.016612,0.214289, 0.347155,-0.072460,-0.306250, -0.381591,0.029695,0.031097, 0.347155,-0.139922,0.214289, 0.322332,-0.081469,-0.321579, -0.265947,0.211743,-0.107089, -0.020631,0.312250,-0.000249, 0.347155,0.151286,0.214289, 0.347155,-0.036860,-0.269624, -0.184333,0.218199,-0.136976, -0.297433,0.224413,-0.058793, -0.211836,-0.212008,-0.259013, -0.050911,-0.245429,-0.332189, -0.067869,-0.323764,0.214289, -0.166294,0.367199,0.214289, -0.026282,0.399418,0.214289, -0.145373,-0.294337,-0.277679, -0.165410,-0.272600,-0.295849, 0.053302,-0.195968,-0.357632, 0.164820,-0.089551,-0.368349, }; -public static final int h78_faces[] = { +public static final int[] h78_faces = { // [] = { 7, 3,13,16,12,18,4,1, 6, 4,19,9,6,8,1, 4, 8,7,3,1, @@ -1999,18 +1999,18 @@ public class Halton235Geom { 4, 15,7,8,6, 3, 16,17,12, }; -public static final double h78_planes[ h78_numf * 4 ] = { +public static final double[] h78_planes = { // [ h78_numf * 4 ] = { 0.402198,-0.907959,-0.117672,0.241453,0.167754,0.706913,-0.687119,0.217444,1,-0,0,0.347155,-0.766208,-0.637263,0.0825892,0.276023,-0.870584,0.458578,0.178296,0.351369,-0.822068,0.096228,-0.561199,0.2991,0,-0,1,0.214289,0.280943,-0.383024,-0.879979,0.404745,-0.20808,0.904248,-0.372879,0.286737,-0.349687,0.276295,-0.895198,0.247367,0.526505,0.792388,-0.308081,0.236638,-0.071473,-0.677671,-0.731884,0.413083 }; // h79 public static final int h79_numv = 20; public static final int h79_numf = 12; public static final double h79_volu = 0.069132; -public static final double h79_pos[3] = { 0.747670,0.086302,0.441993 }; -public static final double h79_verts[ h79_numv * 3 ] = { +public static final double[] h79_pos = { 0.747670,0.086302,0.441993 }; +public static final double[] h79_verts = { // [ h79_numv * 3 ] = { 0.252330,0.012519,-0.215098, 0.012566,0.066820,-0.263433, 0.201221,-0.224177,-0.182831, 0.095169,0.321961,-0.051360, -0.091840,0.355257,0.097036, -0.215455,0.030746,-0.161373, -0.279159,-0.039814,0.206742, 0.060963,-0.313628,-0.085453, -0.115456,0.054238,0.343469, 0.252330,-0.294873,0.074094, -0.016233,0.366022,0.061965, -0.074702,0.310522,0.161887, 0.252330,0.103519,-0.130839, 0.252330,-0.216744,-0.175787, -0.335913,0.108335,-0.008027, 0.079494,0.109929,-0.259932, 0.069995,-0.347564,-0.024631, 0.252330,-0.330473,0.037468, 0.252330,-0.335180,0.024392, 0.227507,-0.339482,0.022139, }; -public static final int h79_faces[] = { +public static final int[] h79_faces = { // [] = { 7, 5,14,4,10,3,15,1, 5, 15,0,13,2,1, 4, 2,7,5,1, @@ -2024,18 +2024,18 @@ public class Halton235Geom { 6, 17,18,13,0,12,9, 3, 19,18,17, }; -public static final double h79_planes[ h79_numf * 4 ] = { +public static final double[] h79_planes = { // [ h79_numf * 4 ] = { -0.391463,0.659847,-0.641373,0.208131,0.158394,-0.166869,-0.973173,0.247207,-0.309646,-0.434949,-0.84554,0.189789,0.191731,-0.844679,-0.499756,0.319309,0.73548,0.309929,0.602505,0.138836,0.49733,0.589428,-0.636583,0.269798,-0.708232,0.479648,0.518021,0.285709,0.131611,0.831909,0.539078,0.335765,-0.727924,-0.639056,-0.248465,0.177281,-0.167754,-0.706913,0.687119,0.217031,1,0,0,0.25233,0.131169,-0.932758,0.335793,0.35393 }; // h80 public static final int h80_numv = 14; public static final int h80_numf = 9; public static final double h80_volu = 0.076324; -public static final double h80_pos[3] = { 0.872729,0.237609,0.718600 }; -public static final double h80_verts[ h80_numv * 3 ] = { +public static final double[] h80_pos = { 0.872729,0.237609,0.718600 }; +public static final double[] h80_verts = { // [ h80_numv * 3 ] = { 0.127271,0.331095,-0.032200, 0.127271,-0.258034,0.281400, 0.127271,-0.446180,-0.202512, -0.199761,0.159215,-0.114719, -0.141292,0.214715,-0.214641, -0.136492,0.218429,-0.218946, -0.240515,-0.097070,0.066863, -0.246166,-0.009903,0.281400, -0.239577,0.050556,0.281400, 0.127271,0.263358,0.281400, 0.127271,0.246274,-0.293996, 0.127271,-0.047788,-0.407445, -0.039983,0.206584,-0.314412, -0.029889,0.170654,-0.327966, }; -public static final int h80_faces[] = { +public static final int[] h80_faces = { // [] = { 4, 7,6,2,1, 6, 2,11,10,0,9,1, 4, 9,8,7,1, @@ -2046,7 +2046,7 @@ public class Halton235Geom { 4, 0,10,12,5, 4, 11,13,12,10, }; -public static final double h80_planes[ h80_numf * 4 ] = { +public static final double[] h80_planes = { // [ h80_numf * 4 ] = { -0.526505,-0.792388,0.308081,0.224148,1,0,0,0.127271,0,0,1,0.281401,-0.73548,-0.309929,-0.602505,0.166694,-0.493234,0.850287,0.183662,0.212838,-0.991673,0.108076,-0.0700326,0.223339,-0.696788,0.0734069,-0.713511,0.267361,-0.184883,0.934913,-0.302912,0.295769,0.0284606,0.359798,-0.932596,0.36641 }; // h81 From 96d35f2ed5cd9c1df57d9c92fd4c9710fc0f2dd2 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 18:32:26 +0200 Subject: [PATCH 08/27] Upwards including joints done + libCCD + Demos + Halton --- .../java/org/ode4j/demo/Halton235Geom.java | 1023 +--------------- .../java/org/ode4j/demo/Halton235Geom40.java | 1050 +++++++++++++++++ 2 files changed, 1052 insertions(+), 1021 deletions(-) create mode 100644 demo/src/main/java/org/ode4j/demo/Halton235Geom40.java diff --git a/demo/src/main/java/org/ode4j/demo/Halton235Geom.java b/demo/src/main/java/org/ode4j/demo/Halton235Geom.java index fa42fca4..22f9ab20 100644 --- a/demo/src/main/java/org/ode4j/demo/Halton235Geom.java +++ b/demo/src/main/java/org/ode4j/demo/Halton235Geom.java @@ -25,1028 +25,9 @@ package org.ode4j.demo; // Generated by ./Tools/mksrc.py +import static org.ode4j.demo.Halton235Geom40.*; + public class Halton235Geom { -// h00 -public static final int h00_numv = 14; -public static final int h00_numf = 9; -public static final double h00_volu = 0.105869; -public static final double[] h00_pos = { -0.801161,-0.825905,-0.503586 }; -public static final double[] h00_verts = { // [ h00_numv * 3 ] = { - -0.198839,-0.174095,-0.496414, -0.198839,-0.073069,-0.496414, 0.355754,-0.174095,0.317906, 0.266263,0.078525,-0.113353, -0.198839,0.418138,0.148658, -0.198839,0.151957,0.285583, -0.004749,-0.165186,-0.496414, -0.198839,0.342511,-0.068863, -0.198839,-0.174095,0.341490, 0.030157,-0.174095,0.397398, -0.005096,-0.174095,-0.496414, 0.428901,-0.174095,0.139324, -0.198839,0.419530,0.145078, -0.111897,0.386202,0.018538, -}; -public static final int[] h00_faces = { - 5, 7,13,3,6,1, - 4, 6,10,0,1, - 7, 0,8,5,4,12,7,1, - 6, 11,3,13,12,4,2, - 4, 4,5,9,2, - 6, 9,8,0,10,11,2, - 4, 11,10,6,3, - 3, 8,9,5, - 3, 12,13,7, -}; -public static final double[] h00_planes = { // [ h00_numf * 4 ] = { - 0.322183,0.678839,-0.659831,0.213885,0,0,-1,0.496414,-1,3.46515e-16,1.34725e-16,0.198839,0.66261,0.69806,0.271405,0.200478,0.212159,0.447018,0.869002,0.273913,-0,-1,0,0.174095,0.825473,-0.0322069,-0.563523,0.281141,-0.233951,0.164312,0.958263,0.34515,-0.131169,0.932758,-0.335793,0.368685 -}; -// h01 -public static final int h01_numv = 16; -public static final int h01_numf = 10; -public static final double h01_volu = 0.123003; -public static final double[] h01_pos = { -0.669502,-0.555335,-0.800913 }; -public static final double[] h01_verts = { // [ h01_numv * 3 ] = { - 0.137874,0.266251,0.316069, -0.136407,-0.435756,-0.199087, -0.330498,0.127352,-0.199087, 0.378917,-0.091301,0.019367, 0.437409,0.033623,-0.016334, 0.038469,0.311615,0.180723, -0.330498,-0.343638,-0.199087, 0.193689,-0.157234,0.188948, 0.276656,-0.200503,-0.199087, 0.399981,0.033623,-0.199087, -0.039317,0.311615,-0.199087, -0.330498,0.071941,0.228464, 0.134604,-0.192045,0.183974, -0.243556,0.115632,0.315865, 0.128360,0.261346,0.324519, -0.053858,0.233367,0.333678, -}; -public static final int[] h01_faces = { - 5, 8,3,7,12,1, - 5, 12,13,11,6,1, - 6, 6,2,10,9,8,1, - 6, 11,13,15,5,10,2, - 3, 6,11,2, - 4, 8,9,4,3, - 5, 4,0,14,7,3, - 5, 9,10,5,0,4, - 4, 15,14,0,5, - 5, 14,15,13,12,7, -}; -public static final double[] h01_planes = { // [ h01_numf * 4 ] = { - 0.485031,-0.851631,0.198669,0.265389,-0.322183,-0.678839,0.659831,0.208392,0,0,-1,0.199087,-0.53156,0.839996,0.108863,0.260981,-1,0,-0,0.330498,0.870584,-0.458578,-0.178296,0.368295,0.693474,-0.121763,0.710118,0.287639,0.531559,0.839996,-0.108863,0.26253,-0.120149,0.911352,0.393704,0.35052,0.0929092,-0.293639,0.951391,0.243929 -}; -// h02 -public static final int h02_numv = 22; -public static final int h02_numf = 13; -public static final double h02_volu = 0.069699; -public static final double[] h02_pos = { -0.226726,-0.554920,-0.490680 }; -public static final double[] h02_verts = { // [ h02_numv * 3 ] = { - 0.092179,-0.226103,0.260087, -0.296734,0.272195,0.041665, -0.063859,-0.091716,-0.290866, 0.291800,-0.116083,-0.104671, -0.005367,0.033207,-0.326567, 0.057499,0.071569,-0.315604, -0.314416,0.260931,0.014286, 0.001987,-0.310858,0.106391, 0.200664,0.041526,0.249449, -0.249087,-0.157649,-0.121285, 0.164143,-0.213455,-0.116915, 0.086533,-0.112211,0.311781, 0.301609,-0.100599,-0.031006, -0.013037,0.041374,0.269240, 0.214238,-0.145305,0.159971, -0.177599,0.337949,0.022880, -0.304902,0.265836,0.005836, 0.151444,0.029502,0.298046, 0.226514,0.065723,0.196331, -0.078156,0.329100,-0.024159, 0.053890,0.084483,0.272741, -0.198047,0.327898,0.050872, -}; -public static final int[] h02_faces = { - 4, 13,20,21,1, - 5, 21,15,16,6,1, - 7, 6,9,7,0,11,13,1, - 5, 9,6,16,4,2, - 5, 4,5,3,10,2, - 4, 10,7,9,2, - 5, 5,19,18,12,3, - 6, 12,14,0,7,10,3, - 5, 16,15,19,5,4, - 7, 18,19,15,21,20,17,8, - 5, 17,11,0,14,8, - 4, 14,12,18,8, - 4, 17,20,13,11, -}; -public static final double[] h02_planes = { // [ h02_numf * 4 ] = { - -0.322885,0.43293,0.841615,0.248718,-0.488006,0.871758,-0.0434537,0.380285,-0.73548,-0.309929,0.602505,0.158984,-0.693474,0.121763,-0.710118,0.239666,0.398278,-0.419584,-0.815674,0.250302,-0.11362,-0.877785,-0.465387,0.223128,0.726907,0.646142,-0.23261,0.161453,0.598819,-0.796079,0.0875987,0.257978,-0.27553,0.653111,-0.705358,0.253514,0.315015,0.796483,0.516121,0.225033,0.709719,-0.26169,0.654077,0.294707,0.913105,-0.120244,0.389591,0.275417,-0.158394,0.166869,0.973173,0.270985 -}; -// h03 -public static final int h03_numv = 18; -public static final int h03_numf = 11; -public static final double h03_volu = 0.069585; -public static final double[] h03_pos = { -0.013871,-0.718833,-0.869565 }; -public static final double[] h03_verts = { // [ h03_numv * 3 ] = { - -0.207492,-0.281167,-0.130435, 0.113468,0.049972,0.264160, -0.007999,0.353837,-0.130435, 0.078945,0.047830,0.274214, -0.003048,-0.281167,0.119131, -0.048711,-0.049541,0.261970, -0.155356,0.235482,0.063281, 0.163083,-0.281167,0.065052, -0.378975,-0.037005,-0.130435, -0.276714,0.072197,0.088019, 0.263172,-0.281167,-0.130435, 0.247851,0.256254,-0.130435, 0.308871,0.008019,-0.130435, 0.268707,0.210552,0.010520, 0.116203,0.335344,-0.130435, 0.263499,0.226082,-0.009852, -0.255650,0.197121,-0.130435, -0.218222,0.197121,0.052318, -}; -public static final int[] h03_faces = { // [] = { - 7, 13,15,14,2,6,3,1, - 5, 3,5,4,7,1, - 5, 7,10,12,13,1, - 4, 16,17,6,2, - 8, 14,11,12,10,0,8,16,2, - 5, 6,17,9,5,3, - 5, 5,9,8,0,4, - 4, 0,10,7,4, - 4, 9,17,16,8, - 3, 14,15,11, - 4, 15,13,12,11, -}; -public static final double[] h03_planes = { // [ h03_numf * 4 ] = { - 0.119725,0.804079,0.582343,0.207598,0.274018,-0.465094,0.841785,0.230216,0.881437,-0.139289,0.451296,0.212269,-0.53156,0.839996,0.108863,0.287274,0,-0,-1,0.130435,-0.398278,0.419584,0.815674,0.212296,-0.679728,-0.477395,0.556833,0.202635,-0,-1,-0,0.281167,-0.870584,0.458578,0.178296,0.289704,0.509459,0.848006,0.146072,0.324522,0.968964,0.238186,-0.066148,0.309823 -}; -// h04 -public static final int h04_numv = 18; -public static final int h04_numf = 11; -public static final double h04_volu = 0.049776; -public static final double[] h04_pos = { 0.037853,-0.892026,-0.431971 }; -public static final double[] h04_verts = { // [ h04_numv * 3 ] = { - -0.100436,0.123651,-0.175624, 0.353999,-0.060233,0.083056, 0.061744,0.223165,-0.173434, -0.054772,-0.107974,-0.318463, 0.079577,0.232813,-0.134685, 0.365414,-0.107974,0.061633, 0.111359,-0.107974,-0.372542, -0.262592,0.026248,0.047682, -0.327682,-0.107974,0.107959, -0.050341,0.191801,0.101262, -0.248632,-0.107974,0.379486, -0.172400,0.111003,0.201378, 0.324182,-0.074827,0.146980, 0.312271,-0.107974,0.174077, -0.248842,-0.086035,0.364515, -0.264984,-0.107974,0.352871, 0.027221,0.221023,-0.163380, 0.037030,0.236507,-0.089715, -}; -public static final int[] h04_faces = { - 4, 12,13,5,1, - 5, 5,6,2,4,1, - 5, 4,17,9,12,1, - 4, 16,17,4,2, - 5, 6,3,0,16,2, - 4, 8,7,0,3, - 7, 6,5,13,10,15,8,3, - 5, 8,15,14,11,7, - 6, 11,9,17,16,0,7, - 6, 11,14,10,13,12,9, - 3, 14,15,10, -}; -public static final double[] h04_planes = { // [ h04_numf * 4 ] = { - 0.903842,0.0244154,0.42717,0.353968,0.79204,0.397342,-0.463457,0.217956,0.496382,0.766976,0.406636,0.163295,-0.11569,0.975032,-0.189546,0.243324,-0.274018,0.465094,-0.841785,0.232868,-0.83085,0.164121,-0.531744,0.197127,0,-1,0,0.107974,-0.837582,0.502473,0.214421,0.243355,-0.598819,0.796079,-0.0875987,0.173963,0.289106,0.541464,0.789452,0.169241,-0.80443,0.32957,0.494242,0.35198 -}; -// h05 -public static final int h05_numv = 12; -public static final int h05_numf = 8; -public static final double h05_volu = 0.060052; -public static final double[] h05_pos = { -0.361440,-0.882680,-0.728709 }; -public static final double[] h05_verts = { // [ h05_numv * 3 ] = { - -0.444817,-0.117320,-0.271291, 0.140076,-0.117320,-0.271291, 0.136701,0.016901,0.344420, -0.031407,0.126842,-0.271291, 0.070855,0.236044,-0.052837, -0.114373,0.170111,0.116744, 0.344521,-0.117320,-0.021725, 0.298857,0.114305,0.121114, -0.444469,-0.108411,-0.271291, 0.071611,-0.117320,0.404697, -0.173458,0.135300,0.111770, -0.010820,-0.117320,0.364447, -}; -public static final int[] h05_faces = { - 5, 3,4,7,6,1, - 5, 6,9,11,0,1, - 4, 0,8,3,1, - 5, 5,10,11,9,2, - 4, 9,6,7,2, - 4, 7,4,5,2, - 5, 8,10,5,4,3, - 4, 0,11,10,8, -}; -public static final double[] h05_planes = { // [ h05_numf * 4 ] = { - 0.679728,0.477395,-0.556833,0.190269,0,-1,0,0.11732,0,0,-1,0.271291,-0.373525,0.524676,0.76498,0.221281,0.83085,-0.164121,0.531744,0.293948,0.11362,0.877785,0.465387,0.190656,-0.485031,0.851631,-0.198669,0.177153,-0.825473,0.0322069,0.563523,0.210527 -}; -// h06 -public static final int h06_numv = 16; -public static final int h06_numf = 10; -public static final double h06_volu = 0.067458; -public static final double[] h06_pos = { 0.885250,-0.616510,-0.689541 }; -public static final double[] h06_verts = { // [ h06_numv * 3 ] = { - -0.230633,-0.043361,0.025874, -0.001305,-0.383490,-0.079103, 0.114750,-0.383490,0.055891, 0.114750,0.141993,-0.310459, 0.042572,0.157183,0.322917, 0.114750,0.349093,0.009138, 0.114750,-0.209139,-0.310459, 0.114750,-0.383490,-0.220772, 0.114750,0.143660,0.326163, -0.023969,0.120047,-0.310459, -0.230634,0.218132,-0.108639, -0.072958,0.349093,0.054965, -0.138827,-0.119612,0.199579, 0.020027,-0.383490,0.025057, -0.041036,-0.038390,0.301047, 0.114750,-0.091790,0.305977, -}; -public static final int[] h06_faces = { - 6, 0,10,9,6,7,1, - 4, 7,2,13,1, - 4, 13,12,0,1, - 5, 15,14,12,13,2, - 7, 7,6,3,5,8,15,2, - 5, 9,10,11,5,3, - 3, 6,9,3, - 4, 14,15,8,4, - 4, 8,5,11,4, - 6, 11,10,0,12,14,4, -}; -public static final double[] h06_planes = { // [ h06_numf * 4 ] = { - -0.735479,-0.309932,-0.602505,0.167476,0,-1,0,0.38349,-0.794108,-0.585614,0.162633,0.212748,-0.239912,-0.631869,0.73701,0.255977,1,-0,0,0.11475,-0.131611,0.831909,-0.539079,0.270385,0,0,-1,0.310459,-0.0606999,-0.0852635,0.994508,0.305158,0.131611,0.831909,0.539078,0.310442,-0.793214,0.278548,0.541501,0.184874 -}; -// h07 -public static final int h07_numv = 18; -public static final int h07_numf = 11; -public static final double h07_volu = 0.100040; -public static final double[] h07_pos = { 0.439796,-0.816642,-0.690430 }; -public static final double[] h07_verts = { // [ h07_numv * 3 ] = { - -0.290584,-0.183358,-0.114083, 0.444149,-0.183358,-0.078214, -0.340199,0.147781,0.085025, -0.036530,-0.183358,0.320092, -0.047944,-0.135617,0.341515, 0.306627,0.080520,0.200468, -0.322367,0.157429,0.123774, 0.465481,-0.183358,0.025945, 0.214820,0.156771,0.026763, -0.144796,0.105827,-0.309570, 0.159858,-0.183358,-0.309570, -0.190496,-0.183358,-0.309570, -0.155412,0.298926,0.091748, -0.184960,0.308361,-0.168615, -0.134267,0.332806,-0.106403, 0.196572,0.110989,0.274357, -0.157992,0.325768,-0.131745, -0.142419,0.333870,-0.095406, -}; -public static final int[] h07_faces = { - 7, 10,9,13,16,14,8,1, - 4, 8,5,7,1, - 6, 7,3,0,11,10,1, - 6, 6,12,17,16,13,2, - 5, 13,9,11,0,2, - 5, 0,3,4,6,2, - 5, 7,5,15,4,3, - 4, 15,12,6,4, - 6, 8,14,17,12,15,5, - 3, 10,11,9, - 3, 16,17,14, -}; -public static final double[] h07_planes = { // [ h07_numf * 4 ] = { - 0.525603,0.55372,-0.645861,0.182432,0.794108,0.585614,-0.162633,0.258045,0,-1,0,0.183358,-0.632147,0.768422,0.0995875,0.337082,-0.881437,0.139289,-0.451296,0.282078,-0.79204,-0.397342,0.463457,0.250137,0.488522,-0.25733,0.833743,0.296212,-0.212159,0.447016,0.869003,0.246326,0.381225,0.903643,0.195187,0.228784,-1.58443e-16,2.50379e-17,-1,0.30957,-0.105626,0.979232,-0.173057,0.35849 -}; -// h08 -public static final int h08_numv = 22; -public static final int h08_numf = 13; -public static final double h08_volu = 0.095115; -public static final double[] h08_pos = { 0.582909,-0.382310,-0.514785 }; -public static final double[] h08_verts = { // [ h08_numv * 3 ] = { - 0.039696,0.333763,-0.114253, -0.040720,0.073975,-0.343437, -0.281418,0.194479,0.107755, 0.071707,-0.016068,-0.283395, 0.071707,-0.277561,-0.148882, 0.163514,-0.353812,0.024824, 0.072380,0.310495,-0.182078, 0.344912,-0.077018,0.148161, 0.229382,0.114893,-0.119790, 0.056106,0.251986,0.176207, 0.261304,-0.272590,0.126291, 0.053460,-0.323343,0.098712, -0.280479,0.198156,0.096008, -0.285532,-0.100462,-0.271051, 0.094134,-0.250952,0.200497, -0.277380,-0.101526,-0.282048, -0.010614,0.002589,0.315575, -0.026292,0.211375,0.249710, 0.146296,0.123570,0.286302, 0.056041,0.119791,0.321947, -0.290185,0.102104,0.127875, -0.298525,-0.135406,-0.083897, -}; -public static final int[] h08_faces = { // [] = { - 6, 15,13,12,0,6,1, - 4, 6,8,3,1, - 4, 3,4,15,1, - 5, 20,16,19,17,2, - 5, 17,9,0,12,2, - 5, 12,13,21,20,2, - 6, 8,7,10,5,4,3, - 6, 5,11,21,13,15,4, - 4, 10,14,11,5, - 6, 0,9,18,7,8,6, - 6, 18,19,16,14,10,7, - 4, 17,19,18,9, - 5, 14,16,20,21,11, -}; -public static final double[] h08_planes = { // [ h08_numf * 4 ] = { - -0.595386,0.627237,-0.502085,0.243079,0.598205,0.236327,-0.765702,0.256094,0.107916,-0.45476,-0.884052,0.265581,-0.484779,0.229821,0.843903,0.272055,-0.215549,0.936705,0.275902,0.272559,-0.995125,0.0827659,-0.053632,0.290362,0.793214,-0.278548,-0.541501,0.214813,-0.381225,-0.903643,-0.195187,0.252539,0.131611,-0.83191,0.539077,0.329242,0.750032,0.646492,0.139642,0.229594,0.364346,-0.255892,0.895417,0.278042,0.228161,0.721101,0.654183,0.30978,-0.595564,-0.522855,0.609857,0.197424 -}; -// h09 -public static final int h09_numv = 16; -public static final int h09_numf = 10; -public static final double h09_volu = 0.059582; -public static final double[] h09_pos = { 0.627742,-0.657906,-0.898694 }; -public static final double[] h09_verts = { // [ h09_numv * 3 ] = { - -0.028087,-0.342094,-0.101306, 0.372258,-0.342094,-0.101306, 0.233539,0.161443,-0.101306, 0.372258,-0.167743,-0.101306, 0.256203,-0.342094,0.130050, 0.372258,-0.342094,-0.011619, -0.322212,0.174071,0.101861, 0.026875,-0.001965,0.235027, -0.098160,0.388838,-0.101306, 0.026875,0.259528,0.100514, -0.332742,-0.052909,-0.101306, -0.085552,0.349571,0.040471, -0.393762,0.195327,-0.101306, -0.372906,0.149626,0.039648, -0.378114,0.165155,0.019276, -0.345937,0.167033,0.076519, -}; -public static final int[] h09_faces = { // [] = { - 7, 0,10,12,8,2,3,1, - 3, 3,5,1, - 4, 5,4,0,1, - 4, 8,11,9,2, - 6, 9,7,4,5,3,2, - 7, 7,6,15,13,10,0,4, - 6, 11,8,12,14,15,6, - 4, 7,9,11,6, - 4, 13,14,12,10, - 3, 15,14,13, -}; -public static final double[] h09_planes = { // [ h09_numf * 4 ] = { - 0,0,-1,0.101306,1,0,0,0.372258,0,-1,0,0.342094,0.55667,0.812007,0.175394,0.243329,0.735479,0.309932,0.602505,0.160762,-0.525603,-0.55372,0.645861,0.138757,-0.527367,0.805591,0.270012,0.337657,-0.107916,0.45476,0.884052,0.203982,-0.968964,-0.238186,0.066148,0.328316,-0.830322,0.320028,0.456232,0.375605 -}; -// h10 -public static final int h10_numv = 18; -public static final int h10_numf = 11; -public static final double h10_volu = 0.082139; -public static final double[] h10_pos = { -0.348593,-0.203405,-0.827574 }; -public static final double[] h10_verts = { // [ h10_numv * 3 ] = { - 0.351136,-0.038001,-0.172426, 0.318157,0.110282,-0.172426, -0.183035,-0.085679,0.342730, -0.360226,-0.040315,-0.172426, 0.190400,0.248876,-0.172426, 0.296736,0.161596,-0.025823, 0.116500,-0.318307,0.010327, -0.282440,-0.040315,0.207384, -0.155944,0.334915,-0.140051, -0.055732,-0.013566,0.359774, 0.296359,0.169251,-0.045236, -0.155944,0.347503,-0.172426, 0.079072,-0.318307,-0.172426, 0.043711,-0.022416,0.312735, 0.326723,-0.161591,-0.172426, 0.179366,-0.279946,0.021290, 0.100706,0.105108,0.263039, 0.042697,0.111008,0.290353, -}; -public static final int[] h10_faces = { // [] = { - 4, 10,5,0,1, - 7, 0,14,12,3,11,4,1, - 3, 4,10,1, - 5, 6,15,13,9,2, - 5, 9,17,8,7,2, - 5, 7,3,12,6,2, - 4, 7,8,11,3, - 7, 11,8,17,16,5,10,4, - 6, 16,13,15,14,0,5, - 4, 12,14,15,6, - 4, 13,16,17,9, -}; -public static final double[] h10_planes = { // [ h10_numf * 4 ] = { - 0.973989,0.216619,0.066491,0.322306,-0,0,-1,0.172426,0.722579,0.66608,-0.18498,0.335245,0.27553,-0.653111,0.705358,0.247274,-0.46199,0.681388,0.567693,0.220745,-0.531559,-0.839996,0.108863,0.206575,-0.870584,0.458578,0.178296,0.264376,0.256529,0.900843,0.350248,0.212649,0.830851,-0.164118,0.531744,0.206291,0.53156,-0.839996,-0.108863,0.328179,0.433652,0.152283,0.888119,0.293288 -}; -// h11 -public static final int h11_numv = 18; -public static final int h11_numf = 11; -public static final double h11_volu = 0.058443; -public static final double[] h11_pos = { -0.902277,0.042835,-0.283464 }; -public static final double[] h11_verts = { // [ h11_numv * 3 ] = { - 0.065494,-0.341848,-0.057123, 0.194525,0.153131,-0.091230, -0.097723,-0.350111,0.163707, 0.194525,-0.144351,0.061796, 0.065493,0.122511,-0.295991, -0.097723,-0.183345,0.306682, -0.097723,0.152153,0.335446, -0.097723,-0.428001,-0.052654, 0.107269,-0.156775,0.196004, -0.097723,0.199975,-0.375687, 0.037223,0.358435,0.033582, -0.097723,0.406471,-0.057020, -0.067761,-0.416891,-0.051054, -0.040073,-0.340339,0.134552, 0.056142,-0.350169,-0.055126, 0.004412,-0.376327,-0.008857, 0.025793,-0.108438,0.290488, -0.096343,0.152412,0.335215, -}; -public static final int[] h11_faces = { // [] = { - 5, 4,9,11,10,1, - 6, 10,17,16,8,3,1, - 4, 3,0,4,1, - 5, 7,12,15,13,2, - 5, 13,8,16,5,2, - 6, 5,6,11,9,7,2, - 6, 8,13,15,14,0,3, - 6, 0,14,12,7,9,4, - 4, 16,17,6,5, - 4, 17,10,11,6, - 3, 14,15,12, -}; -public static final double[] h11_planes = { // [ h11_numf * 4 ] = { - 0.553062,0.69918,-0.453068,0.255983,0.793213,0.278551,0.5415,0.147553,0.835369,-0.251444,-0.48881,0.168589,0.314046,-0.893286,0.321583,0.334705,0.443092,-0.583496,0.68059,0.272405,-1,0,0,0.0977235,0.66062,-0.653782,0.368986,0.245683,0.212159,-0.447018,-0.869002,0.216347,0.179474,-0.0840327,0.980167,0.298468,-0.066237,0.837367,0.542613,0.315898,0.474713,-0.879502,0.0335246,0.332778 -}; -// h12 -public static final int h12_numv = 22; -public static final int h12_numf = 13; -public static final double h12_volu = 0.106128; -public static final double[] h12_pos = { -0.838340,-0.076123,-0.758521 }; -public static final double[] h12_verts = { // [ h12_numv * 3 ] = { - 0.207307,-0.167597,0.138331, 0.129521,-0.167597,-0.241479, -0.161660,0.318933,0.099371, 0.312802,0.272050,-0.241479, -0.161660,-0.330252,0.400013, -0.074718,-0.363580,0.273473, 0.001556,0.241469,0.179066, -0.161660,-0.309043,0.422403, -0.161660,-0.407271,0.186072, -0.161660,-0.351860,-0.241479, -0.007794,-0.231211,0.419931, 0.001557,-0.222890,0.417934, 0.309084,0.269226,-0.210613, -0.161660,0.422173,-0.241479, 0.072963,0.309250,0.057032, -0.161660,0.392766,-0.014569, -0.131698,-0.297933,0.424004, -0.161660,-0.327468,0.404309, 0.114980,-0.245845,0.291286, 0.009169,-0.227496,0.411012, 0.333803,0.207633,-0.209104, 0.333803,0.220221,-0.241479, -}; -public static final int[] h12_faces = { // [] = { - 6, 0,18,5,8,9,1, - 5, 9,13,3,21,1, - 4, 21,20,0,1, - 4, 6,14,15,2, - 8, 15,13,9,8,4,17,7,2, - 6, 7,16,10,11,6,2, - 4, 12,20,21,3, - 5, 13,15,14,12,3, - 7, 5,18,19,10,16,17,4, - 3, 8,5,4, - 8, 11,19,18,0,20,12,14,6, - 3, 17,16,7, - 3, 19,11,10, -}; -public static final double[] h12_planes = { // [ h12_numf * 4 ] = { - 0.53156,-0.839996,-0.108863,0.235917,0,0,-1,0.241479,0.870584,-0.458578,-0.178296,0.23267,0.131611,0.83191,0.539077,0.297616,-1,0,0,0.16166,-0.212159,0.447018,0.869002,0.263219,0.917084,0.371595,0.144476,0.353071,0.299389,0.946218,0.12263,0.321456,0.425203,-0.759567,0.4922,0.378997,0.131169,-0.932758,0.335793,0.421162,0.735479,0.309932,0.602505,0.183872,0.216442,-0.684063,0.696571,0.470649,0.494656,-0.366713,0.787932,0.411811 -}; -// h13 -public static final int h13_numv = 22; -public static final int h13_numf = 13; -public static final double h13_volu = 0.080573; -public static final double[] h13_pos = { -0.579196,0.019592,-0.524795 }; -public static final double[] h13_verts = { // [ h13_numv * 3 ] = { - -0.186181,0.213535,-0.176694, 0.154423,-0.034973,0.266436, 0.105286,0.335497,0.021835, 0.055737,-0.302317,0.075780, -0.128556,-0.121108,0.303127, 0.252786,0.058395,0.170378, -0.257588,0.145754,-0.054660, 0.097995,0.334920,0.024505, 0.093556,-0.038093,0.287537, 0.074659,0.111918,-0.442830, -0.051837,-0.263312,-0.095394, -0.257587,-0.318605,0.184208, 0.273300,-0.111989,-0.012426, 0.049940,0.173511,-0.444339, -0.026589,0.239892,0.129875, -0.128556,0.176374,0.150102, 0.038054,-0.313581,0.048402, 0.047568,-0.308676,0.039952, -0.249976,-0.323211,0.177286, -0.144164,-0.341560,0.057561, 0.174871,-0.236563,0.056995, 0.154423,-0.246614,0.084987, -}; -public static final int[] h13_faces = { // [] = { - 5, 21,20,12,5,1, - 6, 5,2,7,14,8,1, - 7, 8,4,11,18,3,21,1, - 5, 5,12,9,13,2, - 4, 13,0,7,2, - 5, 16,17,20,21,3, - 4, 18,19,16,3, - 4, 8,14,15,4, - 4, 15,6,11,4, - 5, 15,14,7,0,6, - 8, 0,13,9,10,19,18,11,6, - 5, 12,20,17,10,9, - 4, 17,16,19,10, -}; -public static final double[] h13_planes = { // [ h13_numf * 4 ] = { - 0.805487,-0.385719,0.449901,0.257745,0.24653,0.556538,0.793403,0.229997,0.284317,-0.624016,0.727852,0.259655,0.904761,0.357436,-0.231619,0.21012,-0.184883,0.934913,-0.302912,0.287581,0.488006,-0.871758,0.0434537,0.29404,0.159459,-0.944944,0.285751,0.316215,-0.107916,0.45476,0.884052,0.226779,-0.835369,0.251444,0.48881,0.225111,-0.493234,0.850287,0.183662,0.240945,-0.735479,-0.309932,-0.602505,0.17721,0.46199,-0.681388,-0.567693,0.209624,0.120149,-0.911352,-0.393704,0.271298 -}; -// h14 -public static final int h14_numv = 24; -public static final int h14_numf = 14; -public static final double h14_volu = 0.092625; -public static final double[] h14_pos = { 0.037294,-0.326434,-0.629340 }; -public static final double[] h14_verts = { // [ h14_numv * 3 ] = { - 0.244511,-0.164440,-0.192835, -0.034752,0.085028,-0.370660, -0.037506,-0.162763,0.334991, -0.206521,-0.156917,-0.176944, 0.151340,0.267484,0.166363, 0.265137,0.142280,0.210563, 0.260084,-0.156338,-0.156496, -0.285181,0.228137,0.064806, 0.037588,-0.329085,0.107655, -0.342176,0.100614,0.114501, 0.027780,-0.344569,0.033990, -0.089151,0.284625,-0.224057, -0.059164,-0.038562,-0.370660, 0.065038,-0.057055,-0.370660, 0.036995,0.362842,0.085406, 0.062303,-0.342427,0.023935, 0.217542,-0.181847,-0.229705, 0.212334,-0.166317,-0.250077, 0.224212,0.171137,0.236256, 0.080136,-0.332779,0.062684, 0.146779,-0.002116,0.303773, 0.264198,0.138603,0.222310, 0.247091,-0.191282,0.030659, 0.255431,0.046228,0.242430, -}; -public static final int[] h14_faces = { // [] = { - 6, 12,3,9,7,11,1, - 9, 11,14,4,5,6,0,17,13,1, - 3, 13,12,1, - 6, 8,19,22,23,20,2, - 7, 20,18,4,14,7,9,2, - 5, 9,3,10,8,2, - 7, 12,13,17,16,15,10,3, - 4, 18,21,5,4, - 5, 21,23,22,6,5, - 6, 22,19,15,16,0,6, - 3, 14,11,7, - 4, 10,15,19,8, - 3, 17,0,16, - 4, 20,23,21,18, -}; -public static final double[] h14_planes = { // [ h14_numf * 4 ] = { - -0.830851,0.164118,-0.531744,0.239924,0.738081,0.518376,-0.431883,0.178509,0,0,-1,0.37066,0.582463,-0.552262,0.596442,0.267845,-0.240814,0.443968,0.863077,0.225893,-0.726907,-0.646142,0.23261,0.210353,-0.119725,-0.804079,-0.582343,0.253941,0.662611,0.698059,0.271405,0.33215,0.995125,-0.0827659,0.053632,0.263362,0.632147,-0.768422,-0.0995875,0.300129,-0.380333,0.921564,-0.0778922,0.313659,0.11569,-0.975032,0.189546,0.345622,0.830322,-0.320028,-0.456232,0.343625,0.433652,0.152283,0.888119,0.333115 -}; -// h15 -public static final int h15_numv = 16; -public static final int h15_numf = 10; -public static final double h15_volu = 0.047330; -public static final double[] h15_pos = { 0.221274,0.213040,-0.893886 }; -public static final double[] h15_verts = { // [ h15_numv * 3 ] = { - -0.273508,-0.247194,0.021075, -0.214206,0.249387,-0.106114, -0.394680,0.092354,-0.106114, 0.468273,-0.026582,-0.106114, -0.379467,-0.167569,-0.106114, -0.251710,-0.306163,-0.106114, -0.130453,-0.090301,0.212222, 0.215618,0.100683,0.162583, 0.108399,0.111587,0.216806, 0.543500,0.089559,-0.106114, 0.556660,0.080198,-0.106114, 0.496376,0.018888,-0.040935, 0.000444,-0.021162,0.246756, 0.322381,0.024676,0.097420, 0.541635,0.087788,-0.096097, 0.556215,0.081512,-0.106114, -}; -public static final int[] h15_faces = { // [] = { - 5, 2,6,12,8,1, - 5, 8,7,14,9,1, - 8, 9,15,10,3,5,4,2,1, - 4, 4,0,6,2, - 3, 10,11,3, - 7, 11,13,12,6,0,5,3, - 3, 5,0,4, - 6, 13,11,10,15,14,7, - 4, 8,12,13,7, - 3, 14,15,9, -}; -public static final double[] h15_planes = { // [ h15_numf * 4 ] = { - -0.469359,0.539421,0.69909,0.160881,0.201934,0.957321,0.206781,0.173545,0,0,-1,0.106114,-0.781405,-0.0457332,0.622346,0.238142,0.765488,-0.633631,0.11198,0.363418,0.324513,-0.835692,0.443069,0.127159,-0.722579,-0.66608,0.18498,0.366181,0.613049,0.207593,0.762283,0.27702,0.433652,-0.152283,0.888119,0.222564,0.518906,0.82,0.241527,0.329834 -}; -// h16 -public static final int h16_numv = 24; -public static final int h16_numf = 14; -public static final double h16_volu = 0.105221; -public static final double[] h16_pos = { -0.230932,0.200668,-0.677519 }; -public static final double[] h16_verts = { // [ h16_numv * 3 ] = { - 0.072738,-0.155197,-0.322481, 0.178698,-0.234822,-0.195293, -0.074965,-0.293065,0.140297, -0.273605,-0.069158,-0.290106, -0.242978,0.154421,0.174559, 0.321753,-0.077929,-0.004145, 0.331656,-0.130769,0.158361, -0.234281,0.105965,-0.322481, 0.057526,0.104725,-0.322481, -0.070916,0.357222,-0.022485, 0.179075,-0.242477,-0.175878, 0.305221,-0.164260,0.133584, 0.289986,0.017556,0.326217, -0.205442,0.224195,0.181431, -0.273605,-0.056571,-0.322481, -0.016955,-0.298965,0.112984, -0.012263,0.183238,-0.322481, -0.122870,0.351842,-0.002882, -0.294606,-0.004741,-0.322481, -0.298324,-0.007565,-0.291615, 0.354068,-0.072999,0.110530, 0.306083,0.044665,0.287425, 0.072223,0.006072,0.394149, -0.095479,-0.122681,0.323101, -}; -public static final int[] h16_faces = { // [] = { - 7, 10,15,2,3,14,0,1, - 4, 0,8,5,1, - 6, 5,20,6,11,10,1, - 7, 15,11,6,12,22,23,2, - 5, 23,4,19,3,2, - 4, 19,18,14,3, - 4, 23,22,13,4, - 6, 13,17,7,18,19,4, - 6, 8,16,9,21,20,5, - 4, 20,21,12,6, - 4, 17,9,16,7, - 6, 16,8,0,14,18,7, - 6, 17,13,22,12,21,9, - 3, 11,15,10, -}; -public static final double[] h16_planes = { // [ h16_numf * 4 ] = { - -0.256529,-0.900843,-0.350248,0.234098,0.781405,0.0457332,-0.622346,0.250435,0.837582,-0.502473,-0.214421,0.309541,0.247318,-0.694798,0.675344,0.27983,-0.904761,-0.357436,0.231619,0.205073,-0.917084,-0.371595,-0.144476,0.318531,-0.501077,0.186311,0.84511,0.298042,-0.876412,0.477567,-0.0618929,0.275891,0.726908,0.64614,-0.232611,0.184496,0.941719,-0.0992098,0.32144,0.376203,-0.28037,0.805551,-0.521997,0.31938,0,0,-1,0.322481,0.148211,0.780702,0.607074,0.254723,0.380333,-0.921564,0.0778922,0.277867 -}; -// h17 -public static final int h17_numv = 26; -public static final int h17_numf = 15; -public static final double h17_volu = 0.108916; -public static final double[] h17_pos = { 0.335926,-0.094685,-0.795267 }; -public static final double[] h17_verts = { // [ h17_numv * 3 ] = { - 0.319363,0.022871,0.098404, -0.388160,0.060531,-0.077543, 0.353621,0.281144,-0.204733, 0.207729,0.332401,-0.001198, 0.193656,-0.174383,-0.204733, -0.101947,-0.367894,-0.204733, -0.366362,0.001562,-0.204733, -0.261637,0.131093,0.251333, 0.356211,0.239639,0.008049, -0.212790,0.222354,0.228279, -0.038549,-0.388087,0.009431, -0.033495,-0.089469,0.376490, -0.054122,-0.396189,-0.026907, 0.286680,0.046139,0.166229, 0.206263,-0.213650,-0.062955, -0.030396,-0.389151,-0.001566, -0.086298,-0.398066,-0.084150, -0.233594,-0.288804,-0.204733, -0.114208,0.286563,0.148137, -0.245105,0.217424,0.113603, 0.376946,0.258587,-0.036908, 0.381724,0.326613,-0.139554, -0.147292,0.035735,0.332290, -0.235202,0.164584,0.276109, -0.333383,-0.146721,-0.204733, -0.387783,0.052876,-0.058130, -}; -public static final int[] h17_faces = { // [] = { - 4, 6,24,25,1, - 6, 25,7,23,9,19,1, - 7, 19,18,3,21,2,6,1, - 6, 21,20,0,14,4,2, - 6, 4,5,17,24,6,2, - 4, 8,20,21,3, - 8, 18,9,23,22,11,13,8,3, - 6, 14,15,12,16,5,4, - 3, 16,17,5, - 3, 22,23,7, - 9, 25,24,17,16,12,10,11,22,7, - 4, 13,0,20,8, - 3, 18,19,9, - 6, 15,14,0,13,11,10, - 3, 12,15,10, -}; -public static final double[] h17_planes = { // [ h17_numf * 4 ] = { - -0.973989,-0.216619,-0.066491,0.370108,-0.837582,0.502473,0.214421,0.338905,-0.324513,0.835692,-0.443069,0.210905,0.929286,-0.326334,-0.173016,0.27229,-4.07036e-16,-9.05266e-17,-1,0.204733,0.43192,0.742413,0.512121,0.335888,0.289106,0.541464,0.789452,0.239093,0.527367,-0.805591,-0.270012,0.297889,-0.509459,-0.848006,-0.146072,0.39382,-0.621965,-0.0849382,0.778424,0.347238,-0.738081,-0.518376,0.431883,0.2337,0.903842,0.0244154,0.42717,0.331247,-0.485104,0.868795,0.0993492,0.319085,0.595386,-0.627237,0.502085,0.225206,0.105626,-0.979232,0.173057,0.377587 -}; -// h18 -public static final int h18_numv = 18; -public static final int h18_numf = 11; -public static final double h18_volu = 0.081077; -public static final double[] h18_pos = { 0.870716,-0.039183,-0.528244 }; -public static final double[] h18_verts = { // [ h18_numv * 3 ] = { - -0.102809,0.184137,0.110997, 0.129284,0.393063,-0.471756, 0.129284,0.325763,0.151471, 0.124364,0.395398,-0.471756, -0.058424,-0.228234,-0.106332, 0.057106,-0.420144,0.161620, -0.248110,-0.009363,-0.100794, -0.231701,-0.091141,0.189666, 0.129284,-0.228234,-0.152159, 0.129284,-0.433667,0.164866, 0.129284,-0.166980,0.404939, -0.141510,-0.219557,0.299761, 0.129284,0.397646,-0.471756, -0.215427,-0.032631,-0.168619, 0.102902,0.388713,-0.463077, 0.129284,0.404181,-0.453605, -0.178579,0.184137,-0.258974, -0.157844,0.203085,-0.303931, -}; -public static final int[] h18_faces = { // [] = { - 7, 8,4,13,17,14,3,1, - 3, 3,12,1, - 7, 12,15,2,10,9,8,1, - 6, 15,14,17,16,0,2, - 5, 0,7,11,10,2, - 4, 14,15,12,3, - 6, 5,11,7,6,13,4, - 4, 8,9,5,4, - 4, 9,10,11,5, - 4, 16,17,13,6, - 4, 7,0,16,6, -}; -public static final double[] h18_planes = { // [ h18_numf * 4 ] = { - -0.212159,-0.447018,-0.869002,0.206822,0,-0,-1,0.471756,1,0,-0,0.129284,-0.53156,0.839996,0.108863,0.221407,-0.398278,0.419585,0.815673,0.208745,-0.395039,0.86436,-0.311169,0.439434,-0.750032,-0.646492,-0.139642,0.206219,-0.131611,-0.831909,-0.539078,0.25488,-0.156805,-0.660773,0.734024,0.387299,-0.903842,-0.0244154,-0.42717,0.267537,-0.870583,0.45858,0.178295,0.193736 -}; -// h19 -public static final int h19_numv = 16; -public static final int h19_numf = 10; -public static final double h19_volu = 0.057269; -public static final double[] h19_pos = { 0.808301,-0.134672,-0.879100 }; -public static final double[] h19_verts = { // [ h19_numv * 3 ] = { - 0.052980,-0.361791,-0.120900, 0.191699,-0.339845,-0.120900, -0.030366,0.427910,-0.120900, 0.191699,0.488552,-0.120900, -0.118754,0.321131,-0.120900, 0.191699,-0.132745,0.198697, 0.186779,0.490887,-0.120900, 0.003992,-0.132745,0.244524, -0.153012,0.062857,0.182237, -0.153685,-0.263706,0.080920, -0.278719,-0.134396,-0.120900, -0.266112,-0.173663,0.020877, -0.090651,0.366600,-0.055721, -0.095429,0.298574,0.046924, -0.012422,0.433588,-0.120900, 0.165316,0.484202,-0.112221, -}; -public static final int[] h19_faces = { // [] = { - 5, 5,7,9,0,1, - 8, 0,10,4,2,14,6,3,1, - 3, 3,5,1, - 5, 12,13,15,14,2, - 3, 4,12,2, - 7, 6,15,13,8,7,5,3, - 6, 10,11,8,13,12,4, - 3, 14,15,6, - 4, 8,11,9,7, - 4, 11,10,0,9, -}; -public static final double[] h19_planes = { // [ h19_numf * 4 ] = { - 0.131611,-0.831909,0.539079,0.242775,-4.33777e-17,-9.13967e-17,-1,0.1209,1,0,0,0.191699,-0.256638,0.811103,0.525594,0.291328,-0.765488,0.633631,-0.11198,0.307921,0.212159,0.447018,0.869002,0.153999,-0.929286,0.326334,0.173016,0.194234,-0.275992,0.959497,0.0565231,0.412621,-0.598205,-0.236327,0.765702,0.216216,-0.55667,-0.812007,-0.175394,0.28549 -}; -// h20 -public static final int h20_numv = 30; -public static final int h20_numf = 17; -public static final double h20_volu = 0.107509; -public static final double[] h20_pos = { 0.402458,0.140897,-0.404353 }; -public static final double[] h20_verts = { // [ h20_numv * 3 ] = { - -0.100408,0.282050,-0.142576, 0.065914,0.236686,0.319509, -0.125820,0.203801,0.337118, 0.365449,0.004057,-0.012894, 0.056400,0.231781,0.327959, 0.034434,0.172826,-0.326950, -0.072786,0.183730,-0.272727, -0.247229,0.030507,0.295489, 0.136546,-0.281738,0.161639, 0.289679,0.004057,-0.382865, 0.141197,0.096819,-0.392113, -0.100966,-0.328728,-0.002677, -0.140953,-0.296194,0.011269, -0.180740,0.050981,-0.242777, -0.253566,0.024492,0.286206, -0.033492,0.282050,0.184162, 0.236557,-0.271221,0.065774, 0.154159,-0.311832,0.139278, -0.301735,-0.070997,-0.114805, -0.213824,-0.199847,-0.058625, -0.310451,0.100424,0.233258, -0.241567,0.131963,0.326249, -0.062874,0.247232,-0.227963, -0.327109,0.098788,0.164544, -0.279322,-0.013228,-0.162635, -0.343405,0.077327,0.053051, -0.313038,0.127071,0.015013, -0.327307,0.104436,0.014259, -0.100027,-0.325051,-0.014425, 0.220147,-0.189444,-0.224685, -}; -public static final int[] h20_faces = { // [] = { - 8, 3,9,10,5,22,0,15,1, - 4, 15,2,4,1, - 6, 4,8,17,16,3,1, - 7, 15,0,26,23,20,21,2, - 5, 21,7,8,4,2, - 4, 16,29,9,3, - 3, 6,22,5, - 4, 10,13,6,5, - 7, 13,24,27,26,0,22,6, - 6, 14,12,11,17,8,7, - 4, 21,20,14,7, - 8, 29,28,19,18,24,13,10,9, - 5, 28,29,16,17,11, - 4, 12,19,28,11, - 7, 14,20,23,25,18,19,12, - 4, 25,27,24,18, - 4, 26,27,25,23, -}; -public static final double[] h20_planes = { // [ h20_numf * 4 ] = { - 0.531561,0.839995,-0.108864,0.199069,-0.120149,0.911351,0.393704,0.333576,0.693474,-0.121763,0.710118,0.243778,-0.53156,0.839996,0.108863,0.274773,0.0929092,-0.293639,0.951391,0.249197,0.870583,-0.45858,-0.178295,0.318592,-0.320422,0.578682,-0.749971,0.334181,-0.433652,0.152283,-0.888119,0.301757,-0.720506,0.471135,-0.508826,0.277775,-0.322183,-0.678839,0.659831,0.253916,-0.770892,-0.145024,0.620237,0.369436,-0.289106,-0.541464,-0.789452,0.21631,0.215549,-0.936705,-0.275902,0.286897,-0.662611,-0.698059,-0.271405,0.297099,-0.847832,-0.483811,0.217045,0.265252,-0.941719,0.0992098,-0.32144,0.314009,-0.846082,0.532633,0.0211314,0.332856 -}; -// h21 -public static final int h21_numv = 20; -public static final int h21_numf = 12; -public static final double h21_volu = 0.107886; -public static final double[] h21_pos = { -0.701261,0.516623,-0.734170 }; -public static final double[] h21_verts = { // [ h21_numv * 3 ] = { - 0.220060,-0.162111,0.233880, -0.071194,0.139979,-0.265830, 0.326350,0.086982,0.076961, 0.175723,-0.320696,-0.265830, -0.194481,0.286846,0.262411, 0.236048,-0.209990,-0.265830, -0.298739,0.200252,0.166960, 0.264887,-0.091760,0.238083, 0.347459,0.035887,0.053770, -0.298739,0.031984,-0.265830, -0.298739,-0.199980,-0.038920, -0.298739,-0.170573,-0.265830, -0.064116,-0.283496,0.032682, 0.172005,-0.323520,-0.234964, 0.067327,0.317485,0.021628, 0.227351,-0.161534,0.231210, 0.015724,0.286846,0.365050, -0.065674,0.367082,0.311546, 0.153155,0.171345,0.362933, 0.139764,0.180879,0.371107, -}; -public static final int[] h21_faces = { // [] = { - 6, 9,6,4,17,14,1, - 5, 14,2,8,5,1, - 5, 5,3,11,9,1, - 4, 18,7,8,2, - 6, 14,17,16,19,18,2, - 6, 5,8,7,15,13,3, - 5, 13,12,10,11,3, - 3, 16,17,4, - 7, 6,10,12,0,19,16,4, - 4, 9,11,10,6, - 5, 18,19,0,15,7, - 4, 13,15,0,12, -}; -public static final double[] h21_planes = { // [ h21_numf * 4 ] = { - -0.404539,0.852363,-0.331398,0.236209,0.595564,0.522855,-0.609857,0.192906,-1.16998e-16,-0,-1,0.26583,0.864691,0.138024,0.482969,0.331367,0.636259,0.754085,0.162882,0.285771,0.876412,-0.477567,0.0618929,0.290707,-0.299389,-0.946218,-0.12263,0.283437,-0.433652,0.152285,0.888119,0.361071,-0.398278,-0.419584,0.815674,0.171144,-1,0,0,0.298739,0.349687,-0.276295,0.895198,0.331112,0.184883,-0.934913,0.302912,0.26309 -}; -// h22 -public static final int h22_numv = 14; -public static final int h22_numf = 9; -public static final double h22_volu = 0.065276; -public static final double[] h22_pos = { -0.383570,0.726249,-0.891974 }; -public static final double[] h22_verts = { // [ h22_numv * 3 ] = { - 0.403835,0.273751,-0.108026, -0.250365,0.107859,0.179431, -0.224444,0.273751,-0.108026, 0.311631,-0.076337,-0.108026, -0.388885,-0.069647,-0.108026, 0.349740,0.107545,0.033083, 0.400677,0.273751,-0.064850, -0.189576,0.273751,0.079255, 0.008658,-0.122644,0.234765, -0.081643,-0.419616,-0.108026, 0.029768,-0.173739,0.211573, 0.125191,-0.098941,0.194122, 0.140375,-0.342343,-0.108026, 0.081722,-0.168359,0.191970, -}; -public static final int[] h22_faces = { // [] = { - 6, 8,11,5,6,7,1, - 4, 7,2,4,1, - 5, 4,9,10,8,1, - 4, 7,6,0,2, - 6, 0,3,12,9,4,2, - 5, 5,11,13,12,3, - 4, 0,6,5,3, - 4, 10,13,11,8, - 4, 12,13,10,9, -}; -public static final double[] h22_planes = { // [ h22_numf * 4 ] = { - 0.212159,0.447018,0.869002,0.151024,-0.889469,0.425934,0.165603,0.298347,-0.595564,-0.522855,0.609857,0.202141,0,1,0,0.273751,0,0,-1,0.108026,0.758508,-0.488331,0.431507,0.227038,0.964613,-0.254054,0.0705546,0.312375,0.364346,-0.255892,0.895417,0.244751,0.28037,-0.805551,0.521997,0.258742 -}; -// h23 -public static final int h23_numv = 16; -public static final int h23_numf = 10; -public static final double h23_volu = 0.051599; -public static final double[] h23_pos = { -0.800668,0.450995,-0.472891 }; -public static final double[] h23_verts = { // [ h23_numv * 3 ] = { - 0.035291,-0.217869,-0.228598, -0.199332,-0.134353,-0.300199, -0.199332,0.265879,-0.094319, -0.095074,0.352473,0.001132, -0.199332,-0.001690,0.132407, -0.199332,-0.208186,-0.186260, 0.189555,0.299490,0.167366, -0.199332,0.309177,-0.027504, -0.064385,-0.049725,0.223009, -0.036116,-0.285650,-0.106564, 0.116475,0.143410,0.211970, 0.319467,-0.096483,-0.027399, 0.092916,-0.255030,0.098198, 0.194883,-0.191512,0.077971, 0.239171,0.246507,0.109828, 0.115131,0.352473,0.103771, -}; -public static final int[] h23_faces = { // [] = { - 4, 0,9,5,1, - 5, 5,4,7,2,1, - 7, 2,3,15,14,11,0,1, - 3, 7,3,2, - 7, 7,4,8,10,6,15,3, - 5, 5,9,12,8,4, - 3, 14,15,6, - 5, 10,13,11,14,6, - 4, 12,13,10,8, - 5, 0,11,13,12,9, -}; -public static final double[] h23_planes = { // [ h23_numf * 4 ] = { - -0.131611,-0.83191,-0.539077,0.299835,-1,6.69634e-17,-4.33923e-17,0.199332,0.398278,0.419584,-0.815674,0.109103,-0.195313,0.823048,-0.533334,0.308068,-0.398278,0.419585,0.815673,0.186681,-0.553062,-0.69918,0.453068,0.171414,0.647541,0.750402,-0.132616,0.325287,0.693474,-0.121763,0.710118,0.213834,0.349687,-0.276295,0.895198,0.190861,0.493234,-0.850287,-0.183662,0.244643 -}; -// h24 -public static final int h24_numv = 12; -public static final int h24_numf = 8; -public static final double h24_volu = 0.050770; -public static final double[] h24_pos = { -0.845297,0.862613,-0.757515 }; -public static final double[] h24_verts = { // [ h24_numv * 3 ] = { - 0.078361,0.021092,0.334891, -0.154703,-0.145738,0.190305, -0.154703,0.137387,-0.242485, -0.154703,-0.314006,-0.242485, 0.072842,-0.206011,-0.242485, 0.237283,0.137387,-0.242485, -0.154703,-0.102441,0.257120, -0.050445,-0.059144,0.285756, 0.211362,-0.028505,0.044972, -0.154703,0.137387,0.380489, 0.272151,0.137387,-0.055204, 0.060041,0.137387,0.393596, -}; -public static final int[] h24_faces = { // [] = { - 3, 7,6,1, - 5, 6,9,2,3,1, - 6, 3,4,8,0,7,1, - 4, 5,4,3,2, - 5, 9,11,10,5,2, - 4, 5,10,8,4, - 5, 7,0,11,9,6, - 4, 10,11,0,8, -}; -public static final double[] h24_planes = { // [ h24_numf * 4 ] = { - 0.195313,-0.823048,0.533334,0.19123,-1,0,0,0.154703,0.404539,-0.852363,0.331398,0.124705,0,0,-1,0.242485,0,1,-0,0.137387,0.889469,-0.425934,-0.165603,0.192694,-0.0541955,-0.456759,0.887938,0.283483,0.901694,-0.0730722,0.426155,0.211832 -}; -// h25 -public static final int h25_numv = 16; -public static final int h25_numf = 10; -public static final double h25_volu = 0.064196; -public static final double[] h25_pos = { 0.265380,0.609017,-0.859766 }; -public static final double[] h25_verts = { // [ h25_numv * 3 ] = { - 0.171512,-0.295294,0.128463, -0.112864,0.390983,-0.140234, -0.179972,0.258217,0.163631, -0.171482,0.390983,0.031499, -0.146465,0.312621,0.159756, 0.063572,-0.117444,0.267684, -0.245115,0.390983,-0.140234, -0.337319,0.040895,-0.140234, 0.499394,-0.306418,-0.140234, 0.112578,-0.021086,0.259138, 0.074204,-0.220888,0.227450, 0.064293,-0.284390,0.182686, -0.258312,-0.146590,-0.140234, 0.497529,-0.308188,-0.130217, -0.299210,0.224777,0.000875, -0.248273,0.390983,-0.097058, -}; -public static final int[] h25_faces = { // [] = { - 6, 3,4,9,13,8,1, - 5, 8,12,7,6,1, - 4, 6,15,3,1, - 7, 14,7,12,11,10,5,2, - 4, 5,9,4,2, - 5, 4,3,15,14,2, - 5, 10,0,13,9,5, - 4, 7,14,15,6, - 5, 13,0,11,12,8, - 3, 11,0,10, -}; -public static final double[] h25_planes = { // [ h25_numf * 4 ] = { - 0.727925,0.639055,0.248465,0.13286,0,-0,-1,0.140234,0,1,0,0.390983,-0.735479,-0.309932,0.602505,0.150925,-0.158394,0.166867,0.973173,0.230836,-0.747363,0.49209,0.446425,0.33462,0.598205,-0.236329,0.765702,0.270751,-0.964613,0.254054,-0.0705546,0.345666,-0.201934,-0.957321,-0.206781,0.221494,0.320422,-0.578682,0.749971,0.322182 -}; -// h26 -public static final int h26_numv = 24; -public static final int h26_numf = 14; -public static final double h26_volu = 0.101687; -public static final double[] h26_pos = { -0.341007,0.877992,-0.537072 }; -public static final double[] h26_verts = { // [ h26_numv * 3 ] = { - 0.358114,0.122008,-0.419752, -0.168425,-0.052359,0.397165, -0.220490,-0.180490,0.174009, 0.459922,0.043646,-0.162938, 0.324251,-0.109249,-0.070985, -0.202046,0.011183,0.424477, 0.252084,0.007514,0.202105, -0.286958,0.122008,0.388199, 0.307177,-0.044198,-0.321819, 0.426415,-0.010758,-0.159063, 0.082627,-0.250684,-0.160780, -0.033904,-0.274387,-0.120138, -0.232139,0.122008,-0.275647, -0.292928,-0.043884,-0.175471, -0.344531,-0.074523,0.167952, -0.207099,-0.190024,0.165835, -0.444249,0.122008,0.173153, -0.425929,0.005713,0.114448, 0.327136,0.122008,0.185091, -0.202046,0.122008,0.443480, 0.434905,0.122008,-0.291195, 0.483509,0.122008,-0.120325, -0.187210,-0.038985,0.408631, -0.270106,-0.127507,0.231547, -}; -public static final int[] h26_faces = { // [] = { - 5, 22,23,2,15,1, - 6, 15,11,10,4,6,1, - 6, 6,18,19,5,22,1, - 3, 23,14,2, - 6, 14,17,13,11,15,2, - 3, 20,21,3, - 6, 21,18,6,4,9,3, - 5, 9,8,0,20,3, - 4, 10,8,9,4, - 3, 19,7,5, - 7, 7,16,17,14,23,22,5, - 8, 19,18,21,20,0,12,16,7, - 6, 10,11,13,12,0,8, - 4, 13,17,16,12, -}; -public static final double[] h26_planes = { // [ h26_numf * 4 ] = { - -0.256638,-0.811103,0.525594,0.29444,0.324513,-0.835692,0.443069,0.165071,0.433652,-0.152285,0.888119,0.287665,-0.647541,-0.750402,0.132616,0.301294,-0.636259,-0.754085,-0.162882,0.248051,0.95246,-0.139363,-0.270922,0.476118,0.791095,-0.458379,0.40504,0.277839,0.747363,-0.49209,-0.446425,0.39499,0.555832,-0.7947,-0.243931,0.284365,-0.540055,-0.142236,0.829524,0.459639,-0.742791,-0.391264,0.543299,0.37632,0,1,0,0.122008,-0.212159,-0.447018,-0.869002,0.234249,-0.901694,0.0730722,-0.426155,0.335702 -}; -// h27 -public static final int h27_numv = 24; -public static final int h27_numf = 14; -public static final double h27_volu = 0.100588; -public static final double[] h27_pos = { 0.167088,0.649940,-0.364014 }; -public static final double[] h27_verts = { // [ h27_numv * 3 ] = { - -0.183844,0.118803,-0.244043, -0.044353,-0.266136,0.405236, -0.256011,0.235567,0.029047, 0.161864,-0.158366,-0.228068, 0.300539,0.065664,-0.127155, -0.024586,0.350060,-0.293383, -0.048173,0.271698,-0.335996, -0.180959,0.350060,0.012033, -0.081680,0.217294,-0.332121, -0.044357,0.350060,0.088262, -0.006196,-0.377080,0.285910, 0.201878,-0.226993,0.143823, -0.003872,-0.277036,0.420726, 0.210870,-0.062009,-0.236614, -0.003871,0.350060,0.098146, 0.183618,0.350060,-0.130723, -0.165155,-0.254165,0.331667, -0.075081,-0.408619,0.192919, -0.091738,-0.410255,0.124205, 0.005721,-0.287236,0.414262, -0.077668,-0.381972,-0.025325, -0.102748,-0.401170,0.182332, 0.134962,-0.226993,-0.182915, 0.109551,-0.305242,0.296779, -}; -public static final int[] h27_faces = { // [] = { - 7, 16,21,17,10,19,12,1, - 4, 12,14,9,1, - 5, 9,7,2,16,1, - 6, 7,5,6,8,0,2, - 6, 0,20,18,21,16,2, - 5, 13,4,11,22,3, - 5, 22,20,0,8,3, - 4, 8,6,13,3, - 5, 13,6,5,15,4, - 7, 15,14,12,19,23,11,4, - 5, 7,9,14,15,5, - 7, 17,18,20,22,11,23,10, - 3, 23,19,10, - 3, 21,18,17, -}; -public static final double[] h27_planes = { // [ h27_numf * 4 ] = { - -0.40667,-0.730271,0.54893,0.434835,-0.212159,0.447018,0.869002,0.242593,-0.444511,0.409753,0.796563,0.233461,-0.791095,0.458379,-0.40504,0.298742,-0.954535,-0.263372,-0.139635,0.178273,0.870583,-0.45858,-0.178295,0.254203,-0.309646,-0.434949,-0.84554,0.211601,0.158394,-0.166867,-0.973173,0.274014,0.598205,0.236328,-0.765702,0.292665,0.73548,0.309929,0.602505,0.16478,1.09327e-15,1,1.13815e-15,0.35006,0.53156,-0.839996,-0.108863,0.282326,0.425203,-0.759567,0.4922,0.424508,-0.292039,-0.95183,0.0934524,0.428891 -}; -// h28 -public static final int h28_numv = 18; -public static final int h28_numf = 11; -public static final double h28_volu = 0.075441; -public static final double[] h28_pos = { 0.013616,0.472900,-0.719797 }; -public static final double[] h28_verts = { // [ h28_numv * 3 ] = { - -0.187022,-0.167506,-0.280203, 0.109520,-0.345231,0.152809, -0.085555,0.177012,-0.280203, -0.271995,0.154408,0.021945, -0.030372,0.295843,0.111740, 0.061535,-0.227567,0.329703, 0.075804,-0.204932,0.330457, 0.071792,0.394334,0.023662, 0.208102,-0.281022,0.072668, -0.047446,0.360894,-0.139094, 0.077205,-0.350161,0.038133, -0.006548,-0.010473,-0.280203, 0.288434,-0.049953,0.172868, 0.315336,0.018674,0.127715, 0.316057,-0.148273,0.042717, 0.325968,-0.084770,0.087482, -0.256811,-0.088994,-0.280203, -0.315464,0.084990,0.019794, -}; -public static final int[] h28_faces = { // [] = { - 7, 8,14,15,12,6,5,1, - 6, 5,17,16,0,10,1, - 3, 10,8,1, - 5, 16,17,3,9,2, - 7, 9,7,13,15,14,11,2, - 4, 11,0,16,2, - 5, 17,5,6,4,3, - 4, 4,7,9,3, - 5, 6,12,13,7,4, - 5, 10,0,11,14,8, - 3, 15,13,12, -}; -public static final double[] h28_planes = { // [ h28_numf * 4 ] = { - 0.720506,-0.471135,0.508826,0.319313,-0.726908,-0.64614,0.232611,0.179002,0.485104,-0.868795,-0.0993492,0.337882,-0.758508,0.488331,-0.431507,0.272244,0.735479,0.309932,-0.602505,0.160762,0,0,-1,0.280203,-0.469484,0.267909,0.841315,0.187527,-0.555832,0.7947,0.243931,0.279245,0.309646,0.434949,0.84554,0.213753,0.469359,-0.539421,-0.69909,0.198463,0.901694,-0.0730722,0.426155,0.337399 -}; -// h29 -public static final int h29_numv = 20; -public static final int h29_numf = 12; -public static final double h29_volu = 0.090754; -public static final double[] h29_pos = { -0.195482,0.549508,-0.348926 }; -public static final double[] h29_verts = { // [ h29_numv * 3 ] = { - -0.062897,0.077801,-0.348926, 0.254536,-0.331284,-0.002375, -0.179429,0.054098,-0.308283, 0.178726,0.219235,-0.259131, -0.352624,0.138460,-0.022310, 0.259822,-0.300738,0.167244, 0.197415,-0.153733,0.316579, 0.065987,-0.327570,0.133724, 0.114982,-0.134660,0.333685, 0.270633,-0.304175,-0.041168, -0.106366,0.008382,-0.351078, 0.106560,0.335999,0.013959, -0.240892,-0.124645,-0.147161, -0.313950,0.276125,0.209019, -0.158320,0.003002,-0.331475, 0.036774,-0.342768,0.065557, 0.284902,-0.281540,-0.040413, 0.270832,-0.309823,0.109117, 0.013405,-0.084041,0.336165, 0.046528,-0.137097,0.329090, -}; -public static final int[] h29_faces = { // [] = { - 4, 9,16,17,1, - 5, 17,5,7,15,1, - 6, 15,12,14,10,9,1, - 4, 0,10,14,2, - 4, 14,12,4,2, - 6, 4,13,11,3,0,2, - 5, 16,9,10,0,3, - 6, 11,6,5,17,16,3, - 7, 12,15,7,19,18,13,4, - 5, 6,8,19,7,5, - 5, 11,13,18,8,6, - 3, 18,19,8, -}; -public static final double[] h29_planes = { // [ h29_numf * 4 ] = { - 0.846082,-0.532633,-0.0211314,0.391862,0.105626,-0.979232,0.173057,0.350878,-0.148211,-0.780702,-0.607074,0.22235,-0.364346,0.255892,-0.895417,0.355259,-0.864691,-0.138024,-0.482969,0.296575,-0.324513,0.835692,-0.443069,0.240027,0.469484,-0.267909,-0.841315,0.243184,0.954535,0.263372,0.139635,0.192157,-0.73808,-0.518378,0.431882,0.178854,-0.0212658,-0.716912,0.696839,0.326619,0.289106,0.541462,0.789453,0.223758,-0.0600487,-0.168696,0.983837,0.344105 -}; -// h30 -public static final int h30_numv = 26; -public static final int h30_numf = 15; -public static final double h30_volu = 0.141813; -public static final double[] h30_pos = { 0.709749,0.432546,-0.520590 }; -public static final double[] h30_verts = { // [ h30_numv * 3 ] = { - 0.086130,-0.133630,-0.479410, 0.290251,-0.067548,-0.461259, 0.290251,0.254276,-0.130163, -0.166094,-0.194830,-0.275875, -0.114073,0.017151,0.452790, 0.263868,-0.083016,-0.470730, -0.015645,0.141724,0.383369, -0.170984,0.316821,0.046789, -0.242122,0.283058,0.029421, 0.290251,0.110614,0.239339, -0.340783,-0.009598,0.300399, 0.290251,-0.018830,0.261535, 0.067740,-0.137994,-0.479410, -0.241377,-0.054963,0.435747, 0.058158,-0.287592,0.103343, 0.290251,-0.145966,0.143817, 0.068185,-0.139308,-0.479410, -0.017612,-0.287592,-0.266628, 0.053160,-0.131717,-0.469392, -0.272857,-0.118823,-0.210712, 0.007901,-0.200618,-0.414231, 0.003123,-0.268644,-0.311584, -0.331791,0.155385,-0.080037, -0.407699,-0.009598,-0.026339, -0.380797,0.059028,-0.071491, -0.370165,-0.044416,-0.111725, -}; -public static final int[] h30_faces = { // [] = { - 6, 15,14,17,21,5,1, - 9, 5,0,12,18,22,8,7,2,1, - 5, 2,9,11,15,1, - 4, 7,6,9,2, - 4, 20,21,17,3, - 8, 17,14,13,10,23,25,19,3, - 6, 19,18,12,16,20,3, - 5, 13,14,15,11,4, - 4, 11,9,6,4, - 6, 6,7,8,10,13,4, - 5, 21,20,16,0,5, - 5, 22,24,23,10,8, - 3, 0,16,12, - 5, 19,25,24,22,18, - 3, 24,25,23, -}; -public static final double[] h30_planes = { // [ h30_numf * 4 ] = { - 0.53156,-0.839996,-0.108863,0.26124,-0.167754,0.706913,-0.687119,0.220498,1,-0,0,0.290251,0.256529,0.900844,0.350247,0.257932,-0.43192,-0.742413,-0.512121,0.357665,-0.531561,-0.839995,0.108864,0.221912,-0.613049,-0.207593,-0.762283,0.352564,0.275531,-0.653109,0.705359,0.276747,0.433652,0.152285,0.888119,0.355275,-0.46199,0.681388,0.567693,0.321433,0.256638,-0.811103,-0.525594,0.382466,-0.870583,0.45858,0.178295,0.345838,-0,0,-1,0.479409,-0.598205,0.236329,-0.765702,0.296486,-0.901694,0.0730722,-0.426155,0.378142 -}; -// h31 -public static final int h31_numv = 20; -public static final int h31_numf = 12; -public static final double h31_volu = 0.145607; -public static final double[] h31_pos = { 0.628702,0.773411,-0.793457 }; -public static final double[] h31_verts = { // [ h31_numv * 3 ] = { - -0.189575,0.226589,0.317223, 0.371298,-0.414948,-0.206543, -0.476185,0.226589,-0.206543, 0.371298,0.226589,-0.206543, -0.250744,-0.185480,0.192828, 0.148787,-0.478859,-0.206543, -0.509787,0.148227,0.093447, -0.534804,0.226589,-0.034811, -0.277996,0.226589,0.298719, -0.486200,0.226589,0.136059, 0.371298,-0.408413,-0.188392, 0.167177,-0.474495,-0.206543, 0.366378,-0.417196,-0.206543, 0.344915,-0.423881,-0.197864, 0.371298,-0.086589,0.142703, 0.371298,0.226589,0.089002, -0.161075,-0.057807,0.302287, -0.089936,-0.024044,0.319655, 0.134207,-0.472582,-0.196526, 0.136072,-0.470812,-0.206543, -}; -public static final int[] h31_faces = { // [] = { - 4, 10,13,12,1, - 7, 12,11,5,19,2,3,1, - 5, 3,15,14,10,1, - 6, 19,18,4,6,7,2, - 7, 7,9,8,0,15,3,2, - 5, 16,8,9,6,4, - 9, 18,5,11,13,10,14,17,16,4, - 3, 18,19,5, - 3, 9,7,6, - 4, 16,17,0,8, - 3, 12,13,11, - 4, 15,0,17,14, -}; -public static final double[] h31_planes = { // [ h31_numf * 4 ] = { - 0.395039,-0.86436,0.311169,0.441071,-0,-0,-1,0.206543,1,-0,0,0.371298,-0.727925,-0.639055,-0.248465,0.253143,4.94863e-17,1,-0,0.226589,-0.598205,-0.236328,0.765702,0.341479,0.167754,-0.706913,0.687119,0.221551,-0.518906,-0.82,-0.241527,0.365343,-0.95246,0.139363,0.270922,0.531526,-0.204299,-0.0717432,0.976276,0.332171,0.275992,-0.959497,-0.0565231,0.51309,0.372229,0.156858,0.91479,0.255169 -}; -// h32 -public static final int h32_numv = 22; -public static final int h32_numf = 13; -public static final double h32_volu = 0.092552; -public static final double[] h32_pos = { -0.648077,-0.694629,-0.055690 }; -public static final double[] h32_verts = { // [ h32_numv * 3 ] = { - -0.351923,0.020682,-0.162313, -0.351923,0.291038,-0.298522, 0.116588,0.074450,0.304425, 0.180292,0.145010,-0.063690, -0.351923,0.286862,-0.299238, 0.082653,-0.305371,0.200452, 0.444715,-0.214767,0.086986, 0.440565,-0.305371,0.060643, 0.437298,-0.305371,0.003205, 0.441236,-0.180086,0.007980, 0.202670,-0.305371,-0.129990, -0.122926,-0.305371,-0.050498, -0.351923,0.343433,0.003710, 0.034975,0.067995,0.334312, -0.249787,0.361137,-0.236631, 0.059834,0.222599,0.089656, 0.420946,-0.305371,-0.023410, 0.437088,-0.283432,-0.011766, -0.351923,0.387353,-0.064067, -0.294272,0.397125,-0.093222, -0.351923,0.309463,-0.280428, -0.321961,0.320573,-0.278827, -}; -public static final int[] h32_faces = { // [] = { - 3, 20,21,1, - 9, 21,14,3,9,17,16,10,4,1, - 6, 4,0,12,18,20,1, - 5, 13,5,7,6,2, - 5, 6,9,3,15,2, - 6, 15,19,18,12,13,2, - 4, 14,19,15,3, - 4, 10,11,0,4, - 5, 13,12,0,11,5, - 6, 11,10,16,8,7,5, - 5, 7,8,17,9,6, - 3, 16,17,8, - 5, 21,20,18,19,14, -}; -public static final double[] h32_planes = { // [ h32_numf * 4 ] = { - -0.216442,0.684063,-0.696571,0.483201,0.433652,0.152285,-0.888119,0.156831,-1,0,0,0.351923,0.349687,-0.276295,0.895198,0.29272,0.727924,0.639056,0.248465,0.208084,0.131611,0.83191,0.539077,0.241389,0.471464,0.878752,-0.0742736,0.21716,-0.212159,-0.447018,-0.869002,0.206469,-0.73548,-0.309929,0.602505,0.154628,-3.74119e-15,-1,2.12832e-16,0.305371,0.99796,-0.0292037,-0.0567728,0.445142,0.80443,-0.32957,-0.494242,0.450833,-0.314046,0.893286,-0.321583,0.47714 -}; -// h33 -public static final int h33_numv = 18; -public static final int h33_numf = 11; -public static final double h33_volu = 0.056945; -public static final double[] h33_pos = { -0.288352,-0.547292,0.050646 }; -public static final double[] h33_verts = { // [ h33_numv * 3 ] = { - 0.084990,-0.362104,-0.019350, -0.079434,0.021164,0.334816, 0.019488,-0.072734,0.262363, 0.115516,0.076855,-0.268585, 0.213070,0.021874,-0.243280, 0.274323,0.089944,-0.132397, 0.019789,0.332949,0.053313, 0.257211,0.025988,-0.078610, 0.131191,0.288888,-0.060012, 0.118204,-0.320377,0.031687, 0.081511,-0.327423,-0.098356, -0.243137,-0.072887,0.198089, -0.179433,-0.002327,-0.170026, -0.299891,0.075262,-0.016680, -0.055817,0.322184,0.088384, -0.038680,0.277450,0.153234, 0.148159,-0.119839,-0.229545, 0.048588,0.033746,-0.272086, -}; -public static final int[] h33_faces = { // [] = { - 5, 11,0,9,2,1, - 7, 2,7,5,8,6,15,1, - 5, 15,14,13,11,1, - 3, 9,7,2, - 4, 4,16,17,3, - 7, 17,12,13,14,6,8,3, - 4, 8,5,4,3, - 7, 5,7,9,0,10,16,4, - 3, 14,15,6, - 5, 0,11,13,12,10, - 4, 12,17,16,10, -}; -public static final double[] h33_planes = { // [ h33_numf * 4 ] = { - -0.167754,-0.706913,0.687119,0.228423,0.73548,0.309929,0.602505,0.149866,-0.708232,0.479648,0.518021,0.239851,0.830851,-0.164118,0.531744,0.167639,0.158394,-0.166869,-0.973173,0.266852,-0.391463,0.659847,-0.641373,0.177755,0.49733,0.589428,-0.636583,0.273727,0.877503,-0.423705,-0.224641,0.232352,0.131611,0.83191,0.539077,0.308327,-0.727924,-0.639056,-0.248465,0.174346,-0.309646,-0.434949,-0.84554,0.200337 -}; -// h34 -public static final int h34_numv = 24; -public static final int h34_numf = 14; -public static final double h34_volu = 0.086482; -public static final double[] h34_pos = { -0.499709,-0.643458,-0.327986 }; -public static final double[] h34_verts = { // [ h34_numv * 3 ] = { - -0.500291,0.235691,-0.026942, -0.413349,0.203755,-0.157062, -0.223651,0.321490,-0.139249, 0.209880,-0.356542,0.003973, 0.365162,-0.137565,0.097393, 0.292868,-0.231257,0.280276, 0.359516,-0.023673,0.149087, -0.329463,0.339839,-0.019523, -0.041433,0.349469,-0.148408, 0.054302,-0.356542,0.142306, 0.272578,-0.356542,0.248886, 0.288720,-0.334603,0.260530, 0.023896,-0.069111,-0.283979, 0.274970,-0.222320,-0.056303, 0.127449,-0.356542,-0.036276, -0.035189,-0.103922,-0.288953, -0.023751,0.360733,-0.121029, -0.500291,0.237083,-0.030523, -0.346425,0.336124,-0.010604, 0.259945,0.129913,0.106546, -0.500291,0.239867,-0.026226, -0.470329,0.269402,-0.006532, -0.398155,0.309966,0.035665, 0.031924,0.093839,0.208606, -}; -public static final int[] h34_faces = { // [] = { - 7, 17,20,21,18,7,2,1, - 5, 2,8,12,15,1, - 6, 15,14,9,0,17,1, - 4, 7,16,8,2, - 5, 14,15,12,13,3, - 5, 13,4,11,10,3, - 4, 10,9,14,3, - 7, 13,12,8,16,19,6,4, - 4, 6,5,11,4, - 4, 6,19,23,5, - 9, 23,22,21,20,0,9,10,11,5, - 6, 18,22,23,19,16,7, - 3, 0,20,17, - 3, 21,22,18, -}; -public static final double[] h34_planes = { // [ h34_numf * 4 ] = { - -0.425203,0.759567,-0.4922,0.407829,-0.0929092,0.293639,-0.951391,0.247662,-0.66261,-0.69806,-0.271405,0.174284,-0.159459,0.944944,-0.285751,0.379244,0.373525,-0.524676,-0.76498,0.262425,0.837582,-0.502473,-0.214421,0.354093,0,-1,0,0.356542,0.73548,0.309929,-0.602505,0.167254,0.941719,-0.0992098,0.32144,0.388833,0.309646,0.434949,0.84554,0.227085,-0.433652,-0.152285,0.888119,0.157132,0.148211,0.780702,0.607074,0.204631,-1,0,-0,0.500291,-0.474713,0.879502,-0.0335246,0.460429 -}; -// h35 -public static final int h35_numv = 12; -public static final int h35_numf = 8; -public static final double h35_volu = 0.072358; -public static final double[] h35_pos = { -0.852811,-0.781078,0.150064 }; -public static final double[] h35_verts = { // [ h35_numv * 3 ] = { - -0.147189,-0.218922,0.332047, 0.103613,-0.074924,0.288589, -0.147189,0.429882,-0.202044, -0.147189,-0.218922,-0.312160, 0.239709,0.154443,0.128558, 0.287386,-0.218922,-0.005301, -0.043492,-0.218922,0.344705, 0.074717,-0.218922,0.306226, -0.147189,0.402063,0.012610, 0.208223,0.167113,0.176854, -0.147189,0.107130,-0.368067, 0.081807,-0.218922,-0.256252, -}; -public static final int[] h35_faces = { // [] = { - 3, 6,7,1, - 5, 7,5,4,9,1, - 5, 9,8,0,6,1, - 4, 8,9,4,2, - 5, 4,5,11,10,2, - 5, 10,3,0,8,2, - 3, 10,11,3, - 6, 11,5,7,6,0,3, -}; -public static final double[] h35_planes = { // [ h35_numf * 4 ] = { - 0.309078,0.0542691,0.949487,0.301971,0.822068,-0.096228,0.561199,0.254343,-0.107916,0.45476,0.884052,0.209874,0.512085,0.851811,0.110395,0.2685,0.73548,0.309929,-0.602505,0.146711,-1,-0,-0,0.147189,0.233951,-0.164312,-0.958263,0.300667,0,-1,0,0.218922 -}; -// h36 -public static final int h36_numv = 18; -public static final int h36_numf = 11; -public static final double h36_volu = 0.076715; -public static final double[] h36_pos = { 0.330903,-0.599381,-0.308448 }; -public static final double[] h36_verts = { // [ h36_numv * 3 ] = { - 0.235744,-0.093981,0.208985, 0.157036,0.091360,0.296934, -0.213473,-0.059832,-0.258208, 0.131366,0.084254,0.304768, 0.060949,-0.352878,-0.040467, 0.031132,-0.367472,0.023458, -0.038178,0.319175,-0.078462, 0.346140,-0.033881,-0.005840, 0.305466,-0.106272,-0.107625, -0.256020,-0.056138,-0.213238, -0.331115,0.110184,0.014099, -0.356965,0.085987,0.067218, 0.185622,-0.147504,0.212044, 0.241393,0.219660,0.109239, -0.343391,-0.100844,-0.022261, -0.046519,0.081665,-0.290234, -0.272849,0.156195,0.144404, -0.146830,0.270831,-0.017119, -}; -public static final int[] h36_faces = { // [] = { - 6, 13,6,17,16,3,1, - 4, 3,12,0,1, - 4, 0,7,13,1, - 6, 9,10,17,6,15,2, - 4, 15,8,4,2, - 5, 4,5,14,9,2, - 6, 16,11,14,5,12,3, - 6, 8,7,0,12,5,4, - 5, 13,7,8,15,6, - 4, 14,11,10,9, - 4, 11,16,17,10, -}; -public static final double[] h36_planes = { // [ h36_numf * 4 ] = { - -0.066237,0.837367,0.542613,0.227221,0.349687,-0.276295,0.895198,0.295486,0.864691,0.138024,0.482969,0.291807,-0.582463,0.552262,-0.596442,0.245303,0.212159,-0.447016,-0.869003,0.205839,-0.496382,-0.766976,-0.406636,0.25685,-0.398278,-0.419584,0.815674,0.16092,0.722578,-0.66608,0.18498,0.2716,0.595564,0.522855,-0.609857,0.191995,-0.913105,0.120244,-0.389591,0.310099,-0.654405,0.755705,0.0257735,0.300313 -}; -// h37 -public static final int h37_numv = 18; -public static final int h37_numf = 11; -public static final double h37_volu = 0.098217; -public static final double[] h37_pos = { 0.055330,-0.588368,0.333127 }; -public static final double[] h37_verts = { // [ h37_numv * 3 ] = { - -0.107417,0.016721,0.347927, 0.283844,-0.036335,0.197820, 0.129290,0.324988,-0.064466, -0.012100,0.128834,-0.356552, 0.344968,0.171444,-0.038138, -0.270436,0.127441,0.395275, -0.130084,-0.375511,-0.154724, 0.001812,-0.380727,-0.087638, -0.247911,0.142505,0.383526, 0.360906,0.133475,0.137346, 0.062042,-0.352141,-0.072933, 0.261216,0.073240,-0.194499, 0.127844,0.325300,-0.059106, 0.361773,0.137946,0.130076, -0.225478,-0.279302,-0.250794, -0.324194,-0.031659,-0.020118, -0.297963,0.086614,0.328910, -0.086471,0.067064,-0.361091, -}; -public static final int[] h37_faces = { // [] = { - 6, 10,11,4,13,9,1, - 5, 9,8,5,0,1, - 4, 0,7,10,1, - 4, 12,13,4,2, - 4, 4,11,3,2, - 8, 3,17,15,16,5,8,12,2, - 7, 11,10,7,6,14,17,3, - 5, 16,6,7,0,5, - 4, 16,15,14,6, - 4, 9,13,12,8, - 3, 15,17,14, -}; -public static final double[] h37_planes = { // [ h37_numf * 4 ] = { - 0.870583,-0.45858,-0.178295,0.228502,0.372229,0.156856,0.91479,0.280919,0.167754,-0.706913,0.687119,0.209227,0.568104,0.816131,0.105771,0.331865,0.49733,0.589428,-0.636583,0.296895,-0.616962,0.758294,-0.21059,0.180245,0.398278,-0.419585,-0.815673,0.231954,-0.32928,-0.737152,0.590069,0.228345,-0.799798,-0.547681,0.245698,0.271686,0.226312,0.817437,0.529699,0.263537,-0.830851,0.164118,-0.531744,0.274859 -}; -// h38 -public static final int h38_numv = 28; -public static final int h38_numf = 16; -public static final double h38_volu = 0.093559; -public static final double[] h38_pos = { 0.133166,-0.773583,-0.050905 }; -public static final double[] h38_verts = { // [ h38_numv * 3 ] = { - -0.076024,-0.195512,0.296394, 0.264846,-0.226417,0.026836, 0.183380,0.258456,0.189533, -0.015793,-0.166926,0.311098, -0.267713,-0.007440,-0.179688, -0.159228,0.260189,-0.190326, -0.343945,-0.226417,-0.001580, -0.273359,0.106452,-0.127994, 0.216958,-0.226417,-0.206989, 0.383359,0.026697,-0.045499, 0.329103,0.258456,0.047225, -0.089936,0.314049,0.027481, -0.145654,0.073358,-0.279804, 0.228869,-0.193270,-0.234086, -0.131382,0.326289,-0.026485, -0.075112,0.330397,-0.113139, -0.208448,0.248166,-0.141729, -0.011151,-0.226417,0.296364, -0.211663,-0.226417,0.216210, -0.072038,-0.226417,0.288931, -0.336528,-0.135813,0.082201, -0.147195,0.316236,-0.030846, -0.340678,-0.226417,0.055858, -0.164307,0.252279,0.022941, -0.344155,-0.204478,-0.016551, -0.340007,-0.101132,0.003195, -0.207920,-0.190296,0.229308, -0.303314,-0.094086,0.133238, -}; -public static final int[] h38_faces = { // [] = { - 4, 8,13,9,1, - 6, 9,10,2,3,17,1, - 7, 17,19,18,22,6,8,1, - 5, 10,15,14,11,2, - 7, 11,23,27,26,0,3,2, - 4, 0,19,17,3, - 4, 24,25,7,4, - 5, 7,16,5,12,4, - 6, 12,13,8,6,24,4, - 5, 16,21,14,15,5, - 6, 15,10,9,13,12,5, - 5, 22,20,25,24,6, - 7, 25,20,27,23,21,16,7, - 4, 14,21,23,11, - 5, 26,27,20,22,18, - 4, 19,0,26,18, -}; -public static final double[] h38_planes = { // [ h38_numf * 4 ] = { - 0.870583,-0.45858,-0.178295,0.329616,0.693474,-0.121763,0.710118,0.23029,0,-1,0,0.226417,0.124536,0.983986,0.127525,0.301324,-0.398278,0.419585,0.815673,0.190005,-0.117405,-0.247372,0.961781,0.342356,-0.941719,0.0992098,-0.32144,0.309131,-0.709719,0.26169,-0.654077,0.305583,-0.289106,-0.541464,-0.789452,0.223281,-0.465257,0.845503,-0.262033,0.343944,0.398278,0.419584,-0.815674,0.200998,-0.99796,0.0292037,0.0567728,0.336541,-0.877503,0.423705,0.224641,0.256225,-0.548603,0.619234,0.561769,0.259246,-0.770892,-0.145024,0.620237,0.330106,-0.445543,-0.264025,0.855443,0.33904 -}; -// h39 -public static final int h39_numv = 32; -public static final int h39_numf = 18; -public static final double h39_volu = 0.060173; -public static final double[] h39_pos = { -0.130993,-0.349156,0.297470 }; -public static final double[] h39_verts = { // [ h39_numv * 3 ] = { - 0.132777,-0.098138,-0.374861, 0.174223,-0.110378,-0.320895, -0.236793,-0.176972,0.087992, 0.120090,0.163784,-0.274197, -0.036262,0.126682,-0.293283, -0.239846,-0.040235,0.342234, -0.196039,0.079314,-0.093590, -0.026168,0.090752,-0.306837, -0.084113,-0.111771,0.430932, -0.132771,0.138527,-0.197817, -0.061588,-0.096707,0.419183, -0.167047,-0.030107,0.457226, 0.314167,0.086089,-0.023449, 0.140527,0.255266,-0.004320, -0.137571,0.134813,-0.193511, 0.315613,0.085777,-0.028809, 0.116964,-0.108191,-0.379221, 0.099852,-0.172148,-0.325434, -0.176687,-0.026318,0.447418, -0.168971,-0.023213,0.453768, -0.137871,-0.270870,0.015539, -0.111640,-0.152598,0.364567, -0.122362,-0.092357,0.456223, -0.127730,-0.079472,0.460978, -0.243030,-0.080780,0.324741, -0.136583,-0.114124,0.420896, -0.241856,-0.054541,0.348612, -0.178625,-0.028253,0.445248, -0.171209,-0.024409,0.453290, -0.169333,-0.024798,0.455225, 0.224076,0.244621,-0.088171, 0.213513,0.251212,-0.061379, -}; -public static final int[] h39_faces = { // [] = { - 5, 0,3,30,15,1, - 8, 15,12,10,8,21,20,17,1, - 4, 17,16,0,1, - 5, 20,21,25,24,2, - 5, 24,26,5,6,2, - 7, 6,14,7,16,17,20,2, - 5, 0,16,7,4,3, - 6, 4,9,13,31,30,3, - 4, 7,14,9,4, - 4, 26,27,18,5, - 8, 18,28,19,13,9,14,6,5, - 4, 10,23,22,8, - 4, 22,25,21,8, - 8, 12,31,13,19,29,11,23,10, - 7, 27,26,24,25,22,23,11, - 5, 29,28,18,27,11, - 4, 15,30,31,12, - 3, 28,29,19, -}; -public static final double[] h39_planes = { // [ h39_numf * 4 ] = { - 0.794364,0.251059,-0.553132,0.288182,0.616962,-0.758294,0.21059,0.12361,0.548603,-0.619234,-0.561769,0.344197,-0.526505,-0.792388,0.308081,0.292012,-0.991673,0.108076,-0.0700326,0.209533,-0.73548,-0.309929,-0.602505,0.17599,0.0284606,0.359798,-0.932596,0.318062,-0.184883,0.934913,-0.302912,0.213979,-0.696788,0.0734069,-0.713511,0.243827,-0.830322,0.320028,0.456232,0.342411,-0.493232,0.850288,0.183662,0.146944,0.512456,-0.101226,0.852726,0.335677,-0.0662371,-0.837367,0.542614,0.332994,0.553104,0.49165,0.672575,0.200322,-0.664689,-0.486283,0.567201,0.385014,-0.721996,-0.0507074,0.690036,0.437637,0.818514,0.542417,0.189261,0.299408,-0.474458,0.651966,0.591464,0.333423 -}; -// h40 -public static final int h40_numv = 24; -public static final int h40_numf = 14; -public static final double h40_volu = 0.115424; -public static final double[] h40_pos = { 0.492476,-0.748212,0.263785 }; -public static final double[] h40_verts = { // [ h40_numv * 3 ] = { - -0.375103,-0.192297,-0.003592, 0.259307,0.208511,0.137583, 0.097667,-0.251788,0.295436, 0.264741,-0.251788,-0.112461, -0.092178,0.331289,0.031204, 0.024049,0.001327,-0.360189, 0.074171,0.054850,-0.363248, 0.312772,-0.115013,-0.159366, -0.175930,0.233085,-0.125157, -0.094464,-0.251788,-0.287854, -0.004537,0.240191,-0.275299, -0.030207,0.233085,-0.267465, -0.370461,-0.251788,-0.018326, 0.056736,-0.251788,0.315422, -0.153302,0.123509,0.267162, -0.068302,0.078845,0.319783, 0.171724,0.348803,0.156293, 0.053571,0.367605,-0.023060, -0.075373,0.297791,0.199418, 0.109457,0.331072,0.189737, -0.005042,0.303901,0.226077, 0.014996,0.282164,0.244247, -0.076239,0.293319,0.206688, -0.068649,0.297216,0.207331, -}; -public static final int[] h40_faces = { // [] = { - 4, 2,3,7,1, - 6, 7,6,10,17,16,1, - 7, 16,19,21,15,13,2,1, - 5, 13,12,9,3,2, - 5, 9,5,6,7,3, - 5, 17,10,11,8,4, - 6, 8,0,14,22,18,4, - 7, 18,23,20,19,16,17,4, - 6, 9,12,0,8,11,5, - 4, 11,10,6,5, - 5, 13,15,14,0,12, - 6, 15,21,20,23,22,14, - 3, 22,23,18, - 3, 20,21,19, -}; -public static final double[] h40_planes = { // [ h40_numf * 4 ] = { - 0.908278,-0.191373,0.372031,0.246805,0.73808,0.518378,-0.431882,0.240058,0.433652,0.152285,0.888119,0.266393,5.15129e-17,-1,5.27492e-17,0.251788,0.398278,-0.419585,-0.815673,0.302818,-0.348894,0.86639,-0.357268,0.308038,-0.870583,0.45858,0.178295,0.237735,-0.162747,0.964426,0.208316,0.341006,-0.693474,0.121763,-0.710118,0.23926,-0.349687,0.276295,-0.895198,0.314397,-0.598205,-0.236328,0.765702,0.267084,-0.296224,0.4369,0.849335,0.326283,-0.440632,0.78713,0.431589,0.353679,0.071473,0.677671,0.731884,0.371046 -}; // h41 public static final int h41_numv = 18; public static final int h41_numf = 11; diff --git a/demo/src/main/java/org/ode4j/demo/Halton235Geom40.java b/demo/src/main/java/org/ode4j/demo/Halton235Geom40.java new file mode 100644 index 00000000..1ccde8c5 --- /dev/null +++ b/demo/src/main/java/org/ode4j/demo/Halton235Geom40.java @@ -0,0 +1,1050 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * Open Dynamics Engine 4J, Copyright (C) 2009-2014 Tilmann Zaeschke * + * All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT, ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT for more * + * details. * + * * + *************************************************************************/ +package org.ode4j.demo; +// Generated by ./Tools/mksrc.py + +public class Halton235Geom40 { +// h00 +public static final int h00_numv = 14; +public static final int h00_numf = 9; +public static final double h00_volu = 0.105869; +public static final double[] h00_pos = { -0.801161,-0.825905,-0.503586 }; +public static final double[] h00_verts = { // [ h00_numv * 3 ] = { + -0.198839,-0.174095,-0.496414, -0.198839,-0.073069,-0.496414, 0.355754,-0.174095,0.317906, 0.266263,0.078525,-0.113353, -0.198839,0.418138,0.148658, -0.198839,0.151957,0.285583, -0.004749,-0.165186,-0.496414, -0.198839,0.342511,-0.068863, -0.198839,-0.174095,0.341490, 0.030157,-0.174095,0.397398, -0.005096,-0.174095,-0.496414, 0.428901,-0.174095,0.139324, -0.198839,0.419530,0.145078, -0.111897,0.386202,0.018538, +}; +public static final int[] h00_faces = { + 5, 7,13,3,6,1, + 4, 6,10,0,1, + 7, 0,8,5,4,12,7,1, + 6, 11,3,13,12,4,2, + 4, 4,5,9,2, + 6, 9,8,0,10,11,2, + 4, 11,10,6,3, + 3, 8,9,5, + 3, 12,13,7, +}; +public static final double[] h00_planes = { // [ h00_numf * 4 ] = { + 0.322183,0.678839,-0.659831,0.213885,0,0,-1,0.496414,-1,3.46515e-16,1.34725e-16,0.198839,0.66261,0.69806,0.271405,0.200478,0.212159,0.447018,0.869002,0.273913,-0,-1,0,0.174095,0.825473,-0.0322069,-0.563523,0.281141,-0.233951,0.164312,0.958263,0.34515,-0.131169,0.932758,-0.335793,0.368685 +}; +// h01 +public static final int h01_numv = 16; +public static final int h01_numf = 10; +public static final double h01_volu = 0.123003; +public static final double[] h01_pos = { -0.669502,-0.555335,-0.800913 }; +public static final double[] h01_verts = { // [ h01_numv * 3 ] = { + 0.137874,0.266251,0.316069, -0.136407,-0.435756,-0.199087, -0.330498,0.127352,-0.199087, 0.378917,-0.091301,0.019367, 0.437409,0.033623,-0.016334, 0.038469,0.311615,0.180723, -0.330498,-0.343638,-0.199087, 0.193689,-0.157234,0.188948, 0.276656,-0.200503,-0.199087, 0.399981,0.033623,-0.199087, -0.039317,0.311615,-0.199087, -0.330498,0.071941,0.228464, 0.134604,-0.192045,0.183974, -0.243556,0.115632,0.315865, 0.128360,0.261346,0.324519, -0.053858,0.233367,0.333678, +}; +public static final int[] h01_faces = { + 5, 8,3,7,12,1, + 5, 12,13,11,6,1, + 6, 6,2,10,9,8,1, + 6, 11,13,15,5,10,2, + 3, 6,11,2, + 4, 8,9,4,3, + 5, 4,0,14,7,3, + 5, 9,10,5,0,4, + 4, 15,14,0,5, + 5, 14,15,13,12,7, +}; +public static final double[] h01_planes = { // [ h01_numf * 4 ] = { + 0.485031,-0.851631,0.198669,0.265389,-0.322183,-0.678839,0.659831,0.208392,0,0,-1,0.199087,-0.53156,0.839996,0.108863,0.260981,-1,0,-0,0.330498,0.870584,-0.458578,-0.178296,0.368295,0.693474,-0.121763,0.710118,0.287639,0.531559,0.839996,-0.108863,0.26253,-0.120149,0.911352,0.393704,0.35052,0.0929092,-0.293639,0.951391,0.243929 +}; +// h02 +public static final int h02_numv = 22; +public static final int h02_numf = 13; +public static final double h02_volu = 0.069699; +public static final double[] h02_pos = { -0.226726,-0.554920,-0.490680 }; +public static final double[] h02_verts = { // [ h02_numv * 3 ] = { + 0.092179,-0.226103,0.260087, -0.296734,0.272195,0.041665, -0.063859,-0.091716,-0.290866, 0.291800,-0.116083,-0.104671, -0.005367,0.033207,-0.326567, 0.057499,0.071569,-0.315604, -0.314416,0.260931,0.014286, 0.001987,-0.310858,0.106391, 0.200664,0.041526,0.249449, -0.249087,-0.157649,-0.121285, 0.164143,-0.213455,-0.116915, 0.086533,-0.112211,0.311781, 0.301609,-0.100599,-0.031006, -0.013037,0.041374,0.269240, 0.214238,-0.145305,0.159971, -0.177599,0.337949,0.022880, -0.304902,0.265836,0.005836, 0.151444,0.029502,0.298046, 0.226514,0.065723,0.196331, -0.078156,0.329100,-0.024159, 0.053890,0.084483,0.272741, -0.198047,0.327898,0.050872, +}; +public static final int[] h02_faces = { + 4, 13,20,21,1, + 5, 21,15,16,6,1, + 7, 6,9,7,0,11,13,1, + 5, 9,6,16,4,2, + 5, 4,5,3,10,2, + 4, 10,7,9,2, + 5, 5,19,18,12,3, + 6, 12,14,0,7,10,3, + 5, 16,15,19,5,4, + 7, 18,19,15,21,20,17,8, + 5, 17,11,0,14,8, + 4, 14,12,18,8, + 4, 17,20,13,11, +}; +public static final double[] h02_planes = { // [ h02_numf * 4 ] = { + -0.322885,0.43293,0.841615,0.248718,-0.488006,0.871758,-0.0434537,0.380285,-0.73548,-0.309929,0.602505,0.158984,-0.693474,0.121763,-0.710118,0.239666,0.398278,-0.419584,-0.815674,0.250302,-0.11362,-0.877785,-0.465387,0.223128,0.726907,0.646142,-0.23261,0.161453,0.598819,-0.796079,0.0875987,0.257978,-0.27553,0.653111,-0.705358,0.253514,0.315015,0.796483,0.516121,0.225033,0.709719,-0.26169,0.654077,0.294707,0.913105,-0.120244,0.389591,0.275417,-0.158394,0.166869,0.973173,0.270985 +}; +// h03 +public static final int h03_numv = 18; +public static final int h03_numf = 11; +public static final double h03_volu = 0.069585; +public static final double[] h03_pos = { -0.013871,-0.718833,-0.869565 }; +public static final double[] h03_verts = { // [ h03_numv * 3 ] = { + -0.207492,-0.281167,-0.130435, 0.113468,0.049972,0.264160, -0.007999,0.353837,-0.130435, 0.078945,0.047830,0.274214, -0.003048,-0.281167,0.119131, -0.048711,-0.049541,0.261970, -0.155356,0.235482,0.063281, 0.163083,-0.281167,0.065052, -0.378975,-0.037005,-0.130435, -0.276714,0.072197,0.088019, 0.263172,-0.281167,-0.130435, 0.247851,0.256254,-0.130435, 0.308871,0.008019,-0.130435, 0.268707,0.210552,0.010520, 0.116203,0.335344,-0.130435, 0.263499,0.226082,-0.009852, -0.255650,0.197121,-0.130435, -0.218222,0.197121,0.052318, +}; +public static final int[] h03_faces = { // [] = { + 7, 13,15,14,2,6,3,1, + 5, 3,5,4,7,1, + 5, 7,10,12,13,1, + 4, 16,17,6,2, + 8, 14,11,12,10,0,8,16,2, + 5, 6,17,9,5,3, + 5, 5,9,8,0,4, + 4, 0,10,7,4, + 4, 9,17,16,8, + 3, 14,15,11, + 4, 15,13,12,11, +}; +public static final double[] h03_planes = { // [ h03_numf * 4 ] = { + 0.119725,0.804079,0.582343,0.207598,0.274018,-0.465094,0.841785,0.230216,0.881437,-0.139289,0.451296,0.212269,-0.53156,0.839996,0.108863,0.287274,0,-0,-1,0.130435,-0.398278,0.419584,0.815674,0.212296,-0.679728,-0.477395,0.556833,0.202635,-0,-1,-0,0.281167,-0.870584,0.458578,0.178296,0.289704,0.509459,0.848006,0.146072,0.324522,0.968964,0.238186,-0.066148,0.309823 +}; +// h04 +public static final int h04_numv = 18; +public static final int h04_numf = 11; +public static final double h04_volu = 0.049776; +public static final double[] h04_pos = { 0.037853,-0.892026,-0.431971 }; +public static final double[] h04_verts = { // [ h04_numv * 3 ] = { + -0.100436,0.123651,-0.175624, 0.353999,-0.060233,0.083056, 0.061744,0.223165,-0.173434, -0.054772,-0.107974,-0.318463, 0.079577,0.232813,-0.134685, 0.365414,-0.107974,0.061633, 0.111359,-0.107974,-0.372542, -0.262592,0.026248,0.047682, -0.327682,-0.107974,0.107959, -0.050341,0.191801,0.101262, -0.248632,-0.107974,0.379486, -0.172400,0.111003,0.201378, 0.324182,-0.074827,0.146980, 0.312271,-0.107974,0.174077, -0.248842,-0.086035,0.364515, -0.264984,-0.107974,0.352871, 0.027221,0.221023,-0.163380, 0.037030,0.236507,-0.089715, +}; +public static final int[] h04_faces = { + 4, 12,13,5,1, + 5, 5,6,2,4,1, + 5, 4,17,9,12,1, + 4, 16,17,4,2, + 5, 6,3,0,16,2, + 4, 8,7,0,3, + 7, 6,5,13,10,15,8,3, + 5, 8,15,14,11,7, + 6, 11,9,17,16,0,7, + 6, 11,14,10,13,12,9, + 3, 14,15,10, +}; +public static final double[] h04_planes = { // [ h04_numf * 4 ] = { + 0.903842,0.0244154,0.42717,0.353968,0.79204,0.397342,-0.463457,0.217956,0.496382,0.766976,0.406636,0.163295,-0.11569,0.975032,-0.189546,0.243324,-0.274018,0.465094,-0.841785,0.232868,-0.83085,0.164121,-0.531744,0.197127,0,-1,0,0.107974,-0.837582,0.502473,0.214421,0.243355,-0.598819,0.796079,-0.0875987,0.173963,0.289106,0.541464,0.789452,0.169241,-0.80443,0.32957,0.494242,0.35198 +}; +// h05 +public static final int h05_numv = 12; +public static final int h05_numf = 8; +public static final double h05_volu = 0.060052; +public static final double[] h05_pos = { -0.361440,-0.882680,-0.728709 }; +public static final double[] h05_verts = { // [ h05_numv * 3 ] = { + -0.444817,-0.117320,-0.271291, 0.140076,-0.117320,-0.271291, 0.136701,0.016901,0.344420, -0.031407,0.126842,-0.271291, 0.070855,0.236044,-0.052837, -0.114373,0.170111,0.116744, 0.344521,-0.117320,-0.021725, 0.298857,0.114305,0.121114, -0.444469,-0.108411,-0.271291, 0.071611,-0.117320,0.404697, -0.173458,0.135300,0.111770, -0.010820,-0.117320,0.364447, +}; +public static final int[] h05_faces = { + 5, 3,4,7,6,1, + 5, 6,9,11,0,1, + 4, 0,8,3,1, + 5, 5,10,11,9,2, + 4, 9,6,7,2, + 4, 7,4,5,2, + 5, 8,10,5,4,3, + 4, 0,11,10,8, +}; +public static final double[] h05_planes = { // [ h05_numf * 4 ] = { + 0.679728,0.477395,-0.556833,0.190269,0,-1,0,0.11732,0,0,-1,0.271291,-0.373525,0.524676,0.76498,0.221281,0.83085,-0.164121,0.531744,0.293948,0.11362,0.877785,0.465387,0.190656,-0.485031,0.851631,-0.198669,0.177153,-0.825473,0.0322069,0.563523,0.210527 +}; +// h06 +public static final int h06_numv = 16; +public static final int h06_numf = 10; +public static final double h06_volu = 0.067458; +public static final double[] h06_pos = { 0.885250,-0.616510,-0.689541 }; +public static final double[] h06_verts = { // [ h06_numv * 3 ] = { + -0.230633,-0.043361,0.025874, -0.001305,-0.383490,-0.079103, 0.114750,-0.383490,0.055891, 0.114750,0.141993,-0.310459, 0.042572,0.157183,0.322917, 0.114750,0.349093,0.009138, 0.114750,-0.209139,-0.310459, 0.114750,-0.383490,-0.220772, 0.114750,0.143660,0.326163, -0.023969,0.120047,-0.310459, -0.230634,0.218132,-0.108639, -0.072958,0.349093,0.054965, -0.138827,-0.119612,0.199579, 0.020027,-0.383490,0.025057, -0.041036,-0.038390,0.301047, 0.114750,-0.091790,0.305977, +}; +public static final int[] h06_faces = { + 6, 0,10,9,6,7,1, + 4, 7,2,13,1, + 4, 13,12,0,1, + 5, 15,14,12,13,2, + 7, 7,6,3,5,8,15,2, + 5, 9,10,11,5,3, + 3, 6,9,3, + 4, 14,15,8,4, + 4, 8,5,11,4, + 6, 11,10,0,12,14,4, +}; +public static final double[] h06_planes = { // [ h06_numf * 4 ] = { + -0.735479,-0.309932,-0.602505,0.167476,0,-1,0,0.38349,-0.794108,-0.585614,0.162633,0.212748,-0.239912,-0.631869,0.73701,0.255977,1,-0,0,0.11475,-0.131611,0.831909,-0.539079,0.270385,0,0,-1,0.310459,-0.0606999,-0.0852635,0.994508,0.305158,0.131611,0.831909,0.539078,0.310442,-0.793214,0.278548,0.541501,0.184874 +}; +// h07 +public static final int h07_numv = 18; +public static final int h07_numf = 11; +public static final double h07_volu = 0.100040; +public static final double[] h07_pos = { 0.439796,-0.816642,-0.690430 }; +public static final double[] h07_verts = { // [ h07_numv * 3 ] = { + -0.290584,-0.183358,-0.114083, 0.444149,-0.183358,-0.078214, -0.340199,0.147781,0.085025, -0.036530,-0.183358,0.320092, -0.047944,-0.135617,0.341515, 0.306627,0.080520,0.200468, -0.322367,0.157429,0.123774, 0.465481,-0.183358,0.025945, 0.214820,0.156771,0.026763, -0.144796,0.105827,-0.309570, 0.159858,-0.183358,-0.309570, -0.190496,-0.183358,-0.309570, -0.155412,0.298926,0.091748, -0.184960,0.308361,-0.168615, -0.134267,0.332806,-0.106403, 0.196572,0.110989,0.274357, -0.157992,0.325768,-0.131745, -0.142419,0.333870,-0.095406, +}; +public static final int[] h07_faces = { + 7, 10,9,13,16,14,8,1, + 4, 8,5,7,1, + 6, 7,3,0,11,10,1, + 6, 6,12,17,16,13,2, + 5, 13,9,11,0,2, + 5, 0,3,4,6,2, + 5, 7,5,15,4,3, + 4, 15,12,6,4, + 6, 8,14,17,12,15,5, + 3, 10,11,9, + 3, 16,17,14, +}; +public static final double[] h07_planes = { // [ h07_numf * 4 ] = { + 0.525603,0.55372,-0.645861,0.182432,0.794108,0.585614,-0.162633,0.258045,0,-1,0,0.183358,-0.632147,0.768422,0.0995875,0.337082,-0.881437,0.139289,-0.451296,0.282078,-0.79204,-0.397342,0.463457,0.250137,0.488522,-0.25733,0.833743,0.296212,-0.212159,0.447016,0.869003,0.246326,0.381225,0.903643,0.195187,0.228784,-1.58443e-16,2.50379e-17,-1,0.30957,-0.105626,0.979232,-0.173057,0.35849 +}; +// h08 +public static final int h08_numv = 22; +public static final int h08_numf = 13; +public static final double h08_volu = 0.095115; +public static final double[] h08_pos = { 0.582909,-0.382310,-0.514785 }; +public static final double[] h08_verts = { // [ h08_numv * 3 ] = { + 0.039696,0.333763,-0.114253, -0.040720,0.073975,-0.343437, -0.281418,0.194479,0.107755, 0.071707,-0.016068,-0.283395, 0.071707,-0.277561,-0.148882, 0.163514,-0.353812,0.024824, 0.072380,0.310495,-0.182078, 0.344912,-0.077018,0.148161, 0.229382,0.114893,-0.119790, 0.056106,0.251986,0.176207, 0.261304,-0.272590,0.126291, 0.053460,-0.323343,0.098712, -0.280479,0.198156,0.096008, -0.285532,-0.100462,-0.271051, 0.094134,-0.250952,0.200497, -0.277380,-0.101526,-0.282048, -0.010614,0.002589,0.315575, -0.026292,0.211375,0.249710, 0.146296,0.123570,0.286302, 0.056041,0.119791,0.321947, -0.290185,0.102104,0.127875, -0.298525,-0.135406,-0.083897, +}; +public static final int[] h08_faces = { // [] = { + 6, 15,13,12,0,6,1, + 4, 6,8,3,1, + 4, 3,4,15,1, + 5, 20,16,19,17,2, + 5, 17,9,0,12,2, + 5, 12,13,21,20,2, + 6, 8,7,10,5,4,3, + 6, 5,11,21,13,15,4, + 4, 10,14,11,5, + 6, 0,9,18,7,8,6, + 6, 18,19,16,14,10,7, + 4, 17,19,18,9, + 5, 14,16,20,21,11, +}; +public static final double[] h08_planes = { // [ h08_numf * 4 ] = { + -0.595386,0.627237,-0.502085,0.243079,0.598205,0.236327,-0.765702,0.256094,0.107916,-0.45476,-0.884052,0.265581,-0.484779,0.229821,0.843903,0.272055,-0.215549,0.936705,0.275902,0.272559,-0.995125,0.0827659,-0.053632,0.290362,0.793214,-0.278548,-0.541501,0.214813,-0.381225,-0.903643,-0.195187,0.252539,0.131611,-0.83191,0.539077,0.329242,0.750032,0.646492,0.139642,0.229594,0.364346,-0.255892,0.895417,0.278042,0.228161,0.721101,0.654183,0.30978,-0.595564,-0.522855,0.609857,0.197424 +}; +// h09 +public static final int h09_numv = 16; +public static final int h09_numf = 10; +public static final double h09_volu = 0.059582; +public static final double[] h09_pos = { 0.627742,-0.657906,-0.898694 }; +public static final double[] h09_verts = { // [ h09_numv * 3 ] = { + -0.028087,-0.342094,-0.101306, 0.372258,-0.342094,-0.101306, 0.233539,0.161443,-0.101306, 0.372258,-0.167743,-0.101306, 0.256203,-0.342094,0.130050, 0.372258,-0.342094,-0.011619, -0.322212,0.174071,0.101861, 0.026875,-0.001965,0.235027, -0.098160,0.388838,-0.101306, 0.026875,0.259528,0.100514, -0.332742,-0.052909,-0.101306, -0.085552,0.349571,0.040471, -0.393762,0.195327,-0.101306, -0.372906,0.149626,0.039648, -0.378114,0.165155,0.019276, -0.345937,0.167033,0.076519, +}; +public static final int[] h09_faces = { // [] = { + 7, 0,10,12,8,2,3,1, + 3, 3,5,1, + 4, 5,4,0,1, + 4, 8,11,9,2, + 6, 9,7,4,5,3,2, + 7, 7,6,15,13,10,0,4, + 6, 11,8,12,14,15,6, + 4, 7,9,11,6, + 4, 13,14,12,10, + 3, 15,14,13, +}; +public static final double[] h09_planes = { // [ h09_numf * 4 ] = { + 0,0,-1,0.101306,1,0,0,0.372258,0,-1,0,0.342094,0.55667,0.812007,0.175394,0.243329,0.735479,0.309932,0.602505,0.160762,-0.525603,-0.55372,0.645861,0.138757,-0.527367,0.805591,0.270012,0.337657,-0.107916,0.45476,0.884052,0.203982,-0.968964,-0.238186,0.066148,0.328316,-0.830322,0.320028,0.456232,0.375605 +}; +// h10 +public static final int h10_numv = 18; +public static final int h10_numf = 11; +public static final double h10_volu = 0.082139; +public static final double[] h10_pos = { -0.348593,-0.203405,-0.827574 }; +public static final double[] h10_verts = { // [ h10_numv * 3 ] = { + 0.351136,-0.038001,-0.172426, 0.318157,0.110282,-0.172426, -0.183035,-0.085679,0.342730, -0.360226,-0.040315,-0.172426, 0.190400,0.248876,-0.172426, 0.296736,0.161596,-0.025823, 0.116500,-0.318307,0.010327, -0.282440,-0.040315,0.207384, -0.155944,0.334915,-0.140051, -0.055732,-0.013566,0.359774, 0.296359,0.169251,-0.045236, -0.155944,0.347503,-0.172426, 0.079072,-0.318307,-0.172426, 0.043711,-0.022416,0.312735, 0.326723,-0.161591,-0.172426, 0.179366,-0.279946,0.021290, 0.100706,0.105108,0.263039, 0.042697,0.111008,0.290353, +}; +public static final int[] h10_faces = { // [] = { + 4, 10,5,0,1, + 7, 0,14,12,3,11,4,1, + 3, 4,10,1, + 5, 6,15,13,9,2, + 5, 9,17,8,7,2, + 5, 7,3,12,6,2, + 4, 7,8,11,3, + 7, 11,8,17,16,5,10,4, + 6, 16,13,15,14,0,5, + 4, 12,14,15,6, + 4, 13,16,17,9, +}; +public static final double[] h10_planes = { // [ h10_numf * 4 ] = { + 0.973989,0.216619,0.066491,0.322306,-0,0,-1,0.172426,0.722579,0.66608,-0.18498,0.335245,0.27553,-0.653111,0.705358,0.247274,-0.46199,0.681388,0.567693,0.220745,-0.531559,-0.839996,0.108863,0.206575,-0.870584,0.458578,0.178296,0.264376,0.256529,0.900843,0.350248,0.212649,0.830851,-0.164118,0.531744,0.206291,0.53156,-0.839996,-0.108863,0.328179,0.433652,0.152283,0.888119,0.293288 +}; +// h11 +public static final int h11_numv = 18; +public static final int h11_numf = 11; +public static final double h11_volu = 0.058443; +public static final double[] h11_pos = { -0.902277,0.042835,-0.283464 }; +public static final double[] h11_verts = { // [ h11_numv * 3 ] = { + 0.065494,-0.341848,-0.057123, 0.194525,0.153131,-0.091230, -0.097723,-0.350111,0.163707, 0.194525,-0.144351,0.061796, 0.065493,0.122511,-0.295991, -0.097723,-0.183345,0.306682, -0.097723,0.152153,0.335446, -0.097723,-0.428001,-0.052654, 0.107269,-0.156775,0.196004, -0.097723,0.199975,-0.375687, 0.037223,0.358435,0.033582, -0.097723,0.406471,-0.057020, -0.067761,-0.416891,-0.051054, -0.040073,-0.340339,0.134552, 0.056142,-0.350169,-0.055126, 0.004412,-0.376327,-0.008857, 0.025793,-0.108438,0.290488, -0.096343,0.152412,0.335215, +}; +public static final int[] h11_faces = { // [] = { + 5, 4,9,11,10,1, + 6, 10,17,16,8,3,1, + 4, 3,0,4,1, + 5, 7,12,15,13,2, + 5, 13,8,16,5,2, + 6, 5,6,11,9,7,2, + 6, 8,13,15,14,0,3, + 6, 0,14,12,7,9,4, + 4, 16,17,6,5, + 4, 17,10,11,6, + 3, 14,15,12, +}; +public static final double[] h11_planes = { // [ h11_numf * 4 ] = { + 0.553062,0.69918,-0.453068,0.255983,0.793213,0.278551,0.5415,0.147553,0.835369,-0.251444,-0.48881,0.168589,0.314046,-0.893286,0.321583,0.334705,0.443092,-0.583496,0.68059,0.272405,-1,0,0,0.0977235,0.66062,-0.653782,0.368986,0.245683,0.212159,-0.447018,-0.869002,0.216347,0.179474,-0.0840327,0.980167,0.298468,-0.066237,0.837367,0.542613,0.315898,0.474713,-0.879502,0.0335246,0.332778 +}; +// h12 +public static final int h12_numv = 22; +public static final int h12_numf = 13; +public static final double h12_volu = 0.106128; +public static final double[] h12_pos = { -0.838340,-0.076123,-0.758521 }; +public static final double[] h12_verts = { // [ h12_numv * 3 ] = { + 0.207307,-0.167597,0.138331, 0.129521,-0.167597,-0.241479, -0.161660,0.318933,0.099371, 0.312802,0.272050,-0.241479, -0.161660,-0.330252,0.400013, -0.074718,-0.363580,0.273473, 0.001556,0.241469,0.179066, -0.161660,-0.309043,0.422403, -0.161660,-0.407271,0.186072, -0.161660,-0.351860,-0.241479, -0.007794,-0.231211,0.419931, 0.001557,-0.222890,0.417934, 0.309084,0.269226,-0.210613, -0.161660,0.422173,-0.241479, 0.072963,0.309250,0.057032, -0.161660,0.392766,-0.014569, -0.131698,-0.297933,0.424004, -0.161660,-0.327468,0.404309, 0.114980,-0.245845,0.291286, 0.009169,-0.227496,0.411012, 0.333803,0.207633,-0.209104, 0.333803,0.220221,-0.241479, +}; +public static final int[] h12_faces = { // [] = { + 6, 0,18,5,8,9,1, + 5, 9,13,3,21,1, + 4, 21,20,0,1, + 4, 6,14,15,2, + 8, 15,13,9,8,4,17,7,2, + 6, 7,16,10,11,6,2, + 4, 12,20,21,3, + 5, 13,15,14,12,3, + 7, 5,18,19,10,16,17,4, + 3, 8,5,4, + 8, 11,19,18,0,20,12,14,6, + 3, 17,16,7, + 3, 19,11,10, +}; +public static final double[] h12_planes = { // [ h12_numf * 4 ] = { + 0.53156,-0.839996,-0.108863,0.235917,0,0,-1,0.241479,0.870584,-0.458578,-0.178296,0.23267,0.131611,0.83191,0.539077,0.297616,-1,0,0,0.16166,-0.212159,0.447018,0.869002,0.263219,0.917084,0.371595,0.144476,0.353071,0.299389,0.946218,0.12263,0.321456,0.425203,-0.759567,0.4922,0.378997,0.131169,-0.932758,0.335793,0.421162,0.735479,0.309932,0.602505,0.183872,0.216442,-0.684063,0.696571,0.470649,0.494656,-0.366713,0.787932,0.411811 +}; +// h13 +public static final int h13_numv = 22; +public static final int h13_numf = 13; +public static final double h13_volu = 0.080573; +public static final double[] h13_pos = { -0.579196,0.019592,-0.524795 }; +public static final double[] h13_verts = { // [ h13_numv * 3 ] = { + -0.186181,0.213535,-0.176694, 0.154423,-0.034973,0.266436, 0.105286,0.335497,0.021835, 0.055737,-0.302317,0.075780, -0.128556,-0.121108,0.303127, 0.252786,0.058395,0.170378, -0.257588,0.145754,-0.054660, 0.097995,0.334920,0.024505, 0.093556,-0.038093,0.287537, 0.074659,0.111918,-0.442830, -0.051837,-0.263312,-0.095394, -0.257587,-0.318605,0.184208, 0.273300,-0.111989,-0.012426, 0.049940,0.173511,-0.444339, -0.026589,0.239892,0.129875, -0.128556,0.176374,0.150102, 0.038054,-0.313581,0.048402, 0.047568,-0.308676,0.039952, -0.249976,-0.323211,0.177286, -0.144164,-0.341560,0.057561, 0.174871,-0.236563,0.056995, 0.154423,-0.246614,0.084987, +}; +public static final int[] h13_faces = { // [] = { + 5, 21,20,12,5,1, + 6, 5,2,7,14,8,1, + 7, 8,4,11,18,3,21,1, + 5, 5,12,9,13,2, + 4, 13,0,7,2, + 5, 16,17,20,21,3, + 4, 18,19,16,3, + 4, 8,14,15,4, + 4, 15,6,11,4, + 5, 15,14,7,0,6, + 8, 0,13,9,10,19,18,11,6, + 5, 12,20,17,10,9, + 4, 17,16,19,10, +}; +public static final double[] h13_planes = { // [ h13_numf * 4 ] = { + 0.805487,-0.385719,0.449901,0.257745,0.24653,0.556538,0.793403,0.229997,0.284317,-0.624016,0.727852,0.259655,0.904761,0.357436,-0.231619,0.21012,-0.184883,0.934913,-0.302912,0.287581,0.488006,-0.871758,0.0434537,0.29404,0.159459,-0.944944,0.285751,0.316215,-0.107916,0.45476,0.884052,0.226779,-0.835369,0.251444,0.48881,0.225111,-0.493234,0.850287,0.183662,0.240945,-0.735479,-0.309932,-0.602505,0.17721,0.46199,-0.681388,-0.567693,0.209624,0.120149,-0.911352,-0.393704,0.271298 +}; +// h14 +public static final int h14_numv = 24; +public static final int h14_numf = 14; +public static final double h14_volu = 0.092625; +public static final double[] h14_pos = { 0.037294,-0.326434,-0.629340 }; +public static final double[] h14_verts = { // [ h14_numv * 3 ] = { + 0.244511,-0.164440,-0.192835, -0.034752,0.085028,-0.370660, -0.037506,-0.162763,0.334991, -0.206521,-0.156917,-0.176944, 0.151340,0.267484,0.166363, 0.265137,0.142280,0.210563, 0.260084,-0.156338,-0.156496, -0.285181,0.228137,0.064806, 0.037588,-0.329085,0.107655, -0.342176,0.100614,0.114501, 0.027780,-0.344569,0.033990, -0.089151,0.284625,-0.224057, -0.059164,-0.038562,-0.370660, 0.065038,-0.057055,-0.370660, 0.036995,0.362842,0.085406, 0.062303,-0.342427,0.023935, 0.217542,-0.181847,-0.229705, 0.212334,-0.166317,-0.250077, 0.224212,0.171137,0.236256, 0.080136,-0.332779,0.062684, 0.146779,-0.002116,0.303773, 0.264198,0.138603,0.222310, 0.247091,-0.191282,0.030659, 0.255431,0.046228,0.242430, +}; +public static final int[] h14_faces = { // [] = { + 6, 12,3,9,7,11,1, + 9, 11,14,4,5,6,0,17,13,1, + 3, 13,12,1, + 6, 8,19,22,23,20,2, + 7, 20,18,4,14,7,9,2, + 5, 9,3,10,8,2, + 7, 12,13,17,16,15,10,3, + 4, 18,21,5,4, + 5, 21,23,22,6,5, + 6, 22,19,15,16,0,6, + 3, 14,11,7, + 4, 10,15,19,8, + 3, 17,0,16, + 4, 20,23,21,18, +}; +public static final double[] h14_planes = { // [ h14_numf * 4 ] = { + -0.830851,0.164118,-0.531744,0.239924,0.738081,0.518376,-0.431883,0.178509,0,0,-1,0.37066,0.582463,-0.552262,0.596442,0.267845,-0.240814,0.443968,0.863077,0.225893,-0.726907,-0.646142,0.23261,0.210353,-0.119725,-0.804079,-0.582343,0.253941,0.662611,0.698059,0.271405,0.33215,0.995125,-0.0827659,0.053632,0.263362,0.632147,-0.768422,-0.0995875,0.300129,-0.380333,0.921564,-0.0778922,0.313659,0.11569,-0.975032,0.189546,0.345622,0.830322,-0.320028,-0.456232,0.343625,0.433652,0.152283,0.888119,0.333115 +}; +// h15 +public static final int h15_numv = 16; +public static final int h15_numf = 10; +public static final double h15_volu = 0.047330; +public static final double[] h15_pos = { 0.221274,0.213040,-0.893886 }; +public static final double[] h15_verts = { // [ h15_numv * 3 ] = { + -0.273508,-0.247194,0.021075, -0.214206,0.249387,-0.106114, -0.394680,0.092354,-0.106114, 0.468273,-0.026582,-0.106114, -0.379467,-0.167569,-0.106114, -0.251710,-0.306163,-0.106114, -0.130453,-0.090301,0.212222, 0.215618,0.100683,0.162583, 0.108399,0.111587,0.216806, 0.543500,0.089559,-0.106114, 0.556660,0.080198,-0.106114, 0.496376,0.018888,-0.040935, 0.000444,-0.021162,0.246756, 0.322381,0.024676,0.097420, 0.541635,0.087788,-0.096097, 0.556215,0.081512,-0.106114, +}; +public static final int[] h15_faces = { // [] = { + 5, 2,6,12,8,1, + 5, 8,7,14,9,1, + 8, 9,15,10,3,5,4,2,1, + 4, 4,0,6,2, + 3, 10,11,3, + 7, 11,13,12,6,0,5,3, + 3, 5,0,4, + 6, 13,11,10,15,14,7, + 4, 8,12,13,7, + 3, 14,15,9, +}; +public static final double[] h15_planes = { // [ h15_numf * 4 ] = { + -0.469359,0.539421,0.69909,0.160881,0.201934,0.957321,0.206781,0.173545,0,0,-1,0.106114,-0.781405,-0.0457332,0.622346,0.238142,0.765488,-0.633631,0.11198,0.363418,0.324513,-0.835692,0.443069,0.127159,-0.722579,-0.66608,0.18498,0.366181,0.613049,0.207593,0.762283,0.27702,0.433652,-0.152283,0.888119,0.222564,0.518906,0.82,0.241527,0.329834 +}; +// h16 +public static final int h16_numv = 24; +public static final int h16_numf = 14; +public static final double h16_volu = 0.105221; +public static final double[] h16_pos = { -0.230932,0.200668,-0.677519 }; +public static final double[] h16_verts = { // [ h16_numv * 3 ] = { + 0.072738,-0.155197,-0.322481, 0.178698,-0.234822,-0.195293, -0.074965,-0.293065,0.140297, -0.273605,-0.069158,-0.290106, -0.242978,0.154421,0.174559, 0.321753,-0.077929,-0.004145, 0.331656,-0.130769,0.158361, -0.234281,0.105965,-0.322481, 0.057526,0.104725,-0.322481, -0.070916,0.357222,-0.022485, 0.179075,-0.242477,-0.175878, 0.305221,-0.164260,0.133584, 0.289986,0.017556,0.326217, -0.205442,0.224195,0.181431, -0.273605,-0.056571,-0.322481, -0.016955,-0.298965,0.112984, -0.012263,0.183238,-0.322481, -0.122870,0.351842,-0.002882, -0.294606,-0.004741,-0.322481, -0.298324,-0.007565,-0.291615, 0.354068,-0.072999,0.110530, 0.306083,0.044665,0.287425, 0.072223,0.006072,0.394149, -0.095479,-0.122681,0.323101, +}; +public static final int[] h16_faces = { // [] = { + 7, 10,15,2,3,14,0,1, + 4, 0,8,5,1, + 6, 5,20,6,11,10,1, + 7, 15,11,6,12,22,23,2, + 5, 23,4,19,3,2, + 4, 19,18,14,3, + 4, 23,22,13,4, + 6, 13,17,7,18,19,4, + 6, 8,16,9,21,20,5, + 4, 20,21,12,6, + 4, 17,9,16,7, + 6, 16,8,0,14,18,7, + 6, 17,13,22,12,21,9, + 3, 11,15,10, +}; +public static final double[] h16_planes = { // [ h16_numf * 4 ] = { + -0.256529,-0.900843,-0.350248,0.234098,0.781405,0.0457332,-0.622346,0.250435,0.837582,-0.502473,-0.214421,0.309541,0.247318,-0.694798,0.675344,0.27983,-0.904761,-0.357436,0.231619,0.205073,-0.917084,-0.371595,-0.144476,0.318531,-0.501077,0.186311,0.84511,0.298042,-0.876412,0.477567,-0.0618929,0.275891,0.726908,0.64614,-0.232611,0.184496,0.941719,-0.0992098,0.32144,0.376203,-0.28037,0.805551,-0.521997,0.31938,0,0,-1,0.322481,0.148211,0.780702,0.607074,0.254723,0.380333,-0.921564,0.0778922,0.277867 +}; +// h17 +public static final int h17_numv = 26; +public static final int h17_numf = 15; +public static final double h17_volu = 0.108916; +public static final double[] h17_pos = { 0.335926,-0.094685,-0.795267 }; +public static final double[] h17_verts = { // [ h17_numv * 3 ] = { + 0.319363,0.022871,0.098404, -0.388160,0.060531,-0.077543, 0.353621,0.281144,-0.204733, 0.207729,0.332401,-0.001198, 0.193656,-0.174383,-0.204733, -0.101947,-0.367894,-0.204733, -0.366362,0.001562,-0.204733, -0.261637,0.131093,0.251333, 0.356211,0.239639,0.008049, -0.212790,0.222354,0.228279, -0.038549,-0.388087,0.009431, -0.033495,-0.089469,0.376490, -0.054122,-0.396189,-0.026907, 0.286680,0.046139,0.166229, 0.206263,-0.213650,-0.062955, -0.030396,-0.389151,-0.001566, -0.086298,-0.398066,-0.084150, -0.233594,-0.288804,-0.204733, -0.114208,0.286563,0.148137, -0.245105,0.217424,0.113603, 0.376946,0.258587,-0.036908, 0.381724,0.326613,-0.139554, -0.147292,0.035735,0.332290, -0.235202,0.164584,0.276109, -0.333383,-0.146721,-0.204733, -0.387783,0.052876,-0.058130, +}; +public static final int[] h17_faces = { // [] = { + 4, 6,24,25,1, + 6, 25,7,23,9,19,1, + 7, 19,18,3,21,2,6,1, + 6, 21,20,0,14,4,2, + 6, 4,5,17,24,6,2, + 4, 8,20,21,3, + 8, 18,9,23,22,11,13,8,3, + 6, 14,15,12,16,5,4, + 3, 16,17,5, + 3, 22,23,7, + 9, 25,24,17,16,12,10,11,22,7, + 4, 13,0,20,8, + 3, 18,19,9, + 6, 15,14,0,13,11,10, + 3, 12,15,10, +}; +public static final double[] h17_planes = { // [ h17_numf * 4 ] = { + -0.973989,-0.216619,-0.066491,0.370108,-0.837582,0.502473,0.214421,0.338905,-0.324513,0.835692,-0.443069,0.210905,0.929286,-0.326334,-0.173016,0.27229,-4.07036e-16,-9.05266e-17,-1,0.204733,0.43192,0.742413,0.512121,0.335888,0.289106,0.541464,0.789452,0.239093,0.527367,-0.805591,-0.270012,0.297889,-0.509459,-0.848006,-0.146072,0.39382,-0.621965,-0.0849382,0.778424,0.347238,-0.738081,-0.518376,0.431883,0.2337,0.903842,0.0244154,0.42717,0.331247,-0.485104,0.868795,0.0993492,0.319085,0.595386,-0.627237,0.502085,0.225206,0.105626,-0.979232,0.173057,0.377587 +}; +// h18 +public static final int h18_numv = 18; +public static final int h18_numf = 11; +public static final double h18_volu = 0.081077; +public static final double[] h18_pos = { 0.870716,-0.039183,-0.528244 }; +public static final double[] h18_verts = { // [ h18_numv * 3 ] = { + -0.102809,0.184137,0.110997, 0.129284,0.393063,-0.471756, 0.129284,0.325763,0.151471, 0.124364,0.395398,-0.471756, -0.058424,-0.228234,-0.106332, 0.057106,-0.420144,0.161620, -0.248110,-0.009363,-0.100794, -0.231701,-0.091141,0.189666, 0.129284,-0.228234,-0.152159, 0.129284,-0.433667,0.164866, 0.129284,-0.166980,0.404939, -0.141510,-0.219557,0.299761, 0.129284,0.397646,-0.471756, -0.215427,-0.032631,-0.168619, 0.102902,0.388713,-0.463077, 0.129284,0.404181,-0.453605, -0.178579,0.184137,-0.258974, -0.157844,0.203085,-0.303931, +}; +public static final int[] h18_faces = { // [] = { + 7, 8,4,13,17,14,3,1, + 3, 3,12,1, + 7, 12,15,2,10,9,8,1, + 6, 15,14,17,16,0,2, + 5, 0,7,11,10,2, + 4, 14,15,12,3, + 6, 5,11,7,6,13,4, + 4, 8,9,5,4, + 4, 9,10,11,5, + 4, 16,17,13,6, + 4, 7,0,16,6, +}; +public static final double[] h18_planes = { // [ h18_numf * 4 ] = { + -0.212159,-0.447018,-0.869002,0.206822,0,-0,-1,0.471756,1,0,-0,0.129284,-0.53156,0.839996,0.108863,0.221407,-0.398278,0.419585,0.815673,0.208745,-0.395039,0.86436,-0.311169,0.439434,-0.750032,-0.646492,-0.139642,0.206219,-0.131611,-0.831909,-0.539078,0.25488,-0.156805,-0.660773,0.734024,0.387299,-0.903842,-0.0244154,-0.42717,0.267537,-0.870583,0.45858,0.178295,0.193736 +}; +// h19 +public static final int h19_numv = 16; +public static final int h19_numf = 10; +public static final double h19_volu = 0.057269; +public static final double[] h19_pos = { 0.808301,-0.134672,-0.879100 }; +public static final double[] h19_verts = { // [ h19_numv * 3 ] = { + 0.052980,-0.361791,-0.120900, 0.191699,-0.339845,-0.120900, -0.030366,0.427910,-0.120900, 0.191699,0.488552,-0.120900, -0.118754,0.321131,-0.120900, 0.191699,-0.132745,0.198697, 0.186779,0.490887,-0.120900, 0.003992,-0.132745,0.244524, -0.153012,0.062857,0.182237, -0.153685,-0.263706,0.080920, -0.278719,-0.134396,-0.120900, -0.266112,-0.173663,0.020877, -0.090651,0.366600,-0.055721, -0.095429,0.298574,0.046924, -0.012422,0.433588,-0.120900, 0.165316,0.484202,-0.112221, +}; +public static final int[] h19_faces = { // [] = { + 5, 5,7,9,0,1, + 8, 0,10,4,2,14,6,3,1, + 3, 3,5,1, + 5, 12,13,15,14,2, + 3, 4,12,2, + 7, 6,15,13,8,7,5,3, + 6, 10,11,8,13,12,4, + 3, 14,15,6, + 4, 8,11,9,7, + 4, 11,10,0,9, +}; +public static final double[] h19_planes = { // [ h19_numf * 4 ] = { + 0.131611,-0.831909,0.539079,0.242775,-4.33777e-17,-9.13967e-17,-1,0.1209,1,0,0,0.191699,-0.256638,0.811103,0.525594,0.291328,-0.765488,0.633631,-0.11198,0.307921,0.212159,0.447018,0.869002,0.153999,-0.929286,0.326334,0.173016,0.194234,-0.275992,0.959497,0.0565231,0.412621,-0.598205,-0.236327,0.765702,0.216216,-0.55667,-0.812007,-0.175394,0.28549 +}; +// h20 +public static final int h20_numv = 30; +public static final int h20_numf = 17; +public static final double h20_volu = 0.107509; +public static final double[] h20_pos = { 0.402458,0.140897,-0.404353 }; +public static final double[] h20_verts = { // [ h20_numv * 3 ] = { + -0.100408,0.282050,-0.142576, 0.065914,0.236686,0.319509, -0.125820,0.203801,0.337118, 0.365449,0.004057,-0.012894, 0.056400,0.231781,0.327959, 0.034434,0.172826,-0.326950, -0.072786,0.183730,-0.272727, -0.247229,0.030507,0.295489, 0.136546,-0.281738,0.161639, 0.289679,0.004057,-0.382865, 0.141197,0.096819,-0.392113, -0.100966,-0.328728,-0.002677, -0.140953,-0.296194,0.011269, -0.180740,0.050981,-0.242777, -0.253566,0.024492,0.286206, -0.033492,0.282050,0.184162, 0.236557,-0.271221,0.065774, 0.154159,-0.311832,0.139278, -0.301735,-0.070997,-0.114805, -0.213824,-0.199847,-0.058625, -0.310451,0.100424,0.233258, -0.241567,0.131963,0.326249, -0.062874,0.247232,-0.227963, -0.327109,0.098788,0.164544, -0.279322,-0.013228,-0.162635, -0.343405,0.077327,0.053051, -0.313038,0.127071,0.015013, -0.327307,0.104436,0.014259, -0.100027,-0.325051,-0.014425, 0.220147,-0.189444,-0.224685, +}; +public static final int[] h20_faces = { // [] = { + 8, 3,9,10,5,22,0,15,1, + 4, 15,2,4,1, + 6, 4,8,17,16,3,1, + 7, 15,0,26,23,20,21,2, + 5, 21,7,8,4,2, + 4, 16,29,9,3, + 3, 6,22,5, + 4, 10,13,6,5, + 7, 13,24,27,26,0,22,6, + 6, 14,12,11,17,8,7, + 4, 21,20,14,7, + 8, 29,28,19,18,24,13,10,9, + 5, 28,29,16,17,11, + 4, 12,19,28,11, + 7, 14,20,23,25,18,19,12, + 4, 25,27,24,18, + 4, 26,27,25,23, +}; +public static final double[] h20_planes = { // [ h20_numf * 4 ] = { + 0.531561,0.839995,-0.108864,0.199069,-0.120149,0.911351,0.393704,0.333576,0.693474,-0.121763,0.710118,0.243778,-0.53156,0.839996,0.108863,0.274773,0.0929092,-0.293639,0.951391,0.249197,0.870583,-0.45858,-0.178295,0.318592,-0.320422,0.578682,-0.749971,0.334181,-0.433652,0.152283,-0.888119,0.301757,-0.720506,0.471135,-0.508826,0.277775,-0.322183,-0.678839,0.659831,0.253916,-0.770892,-0.145024,0.620237,0.369436,-0.289106,-0.541464,-0.789452,0.21631,0.215549,-0.936705,-0.275902,0.286897,-0.662611,-0.698059,-0.271405,0.297099,-0.847832,-0.483811,0.217045,0.265252,-0.941719,0.0992098,-0.32144,0.314009,-0.846082,0.532633,0.0211314,0.332856 +}; +// h21 +public static final int h21_numv = 20; +public static final int h21_numf = 12; +public static final double h21_volu = 0.107886; +public static final double[] h21_pos = { -0.701261,0.516623,-0.734170 }; +public static final double[] h21_verts = { // [ h21_numv * 3 ] = { + 0.220060,-0.162111,0.233880, -0.071194,0.139979,-0.265830, 0.326350,0.086982,0.076961, 0.175723,-0.320696,-0.265830, -0.194481,0.286846,0.262411, 0.236048,-0.209990,-0.265830, -0.298739,0.200252,0.166960, 0.264887,-0.091760,0.238083, 0.347459,0.035887,0.053770, -0.298739,0.031984,-0.265830, -0.298739,-0.199980,-0.038920, -0.298739,-0.170573,-0.265830, -0.064116,-0.283496,0.032682, 0.172005,-0.323520,-0.234964, 0.067327,0.317485,0.021628, 0.227351,-0.161534,0.231210, 0.015724,0.286846,0.365050, -0.065674,0.367082,0.311546, 0.153155,0.171345,0.362933, 0.139764,0.180879,0.371107, +}; +public static final int[] h21_faces = { // [] = { + 6, 9,6,4,17,14,1, + 5, 14,2,8,5,1, + 5, 5,3,11,9,1, + 4, 18,7,8,2, + 6, 14,17,16,19,18,2, + 6, 5,8,7,15,13,3, + 5, 13,12,10,11,3, + 3, 16,17,4, + 7, 6,10,12,0,19,16,4, + 4, 9,11,10,6, + 5, 18,19,0,15,7, + 4, 13,15,0,12, +}; +public static final double[] h21_planes = { // [ h21_numf * 4 ] = { + -0.404539,0.852363,-0.331398,0.236209,0.595564,0.522855,-0.609857,0.192906,-1.16998e-16,-0,-1,0.26583,0.864691,0.138024,0.482969,0.331367,0.636259,0.754085,0.162882,0.285771,0.876412,-0.477567,0.0618929,0.290707,-0.299389,-0.946218,-0.12263,0.283437,-0.433652,0.152285,0.888119,0.361071,-0.398278,-0.419584,0.815674,0.171144,-1,0,0,0.298739,0.349687,-0.276295,0.895198,0.331112,0.184883,-0.934913,0.302912,0.26309 +}; +// h22 +public static final int h22_numv = 14; +public static final int h22_numf = 9; +public static final double h22_volu = 0.065276; +public static final double[] h22_pos = { -0.383570,0.726249,-0.891974 }; +public static final double[] h22_verts = { // [ h22_numv * 3 ] = { + 0.403835,0.273751,-0.108026, -0.250365,0.107859,0.179431, -0.224444,0.273751,-0.108026, 0.311631,-0.076337,-0.108026, -0.388885,-0.069647,-0.108026, 0.349740,0.107545,0.033083, 0.400677,0.273751,-0.064850, -0.189576,0.273751,0.079255, 0.008658,-0.122644,0.234765, -0.081643,-0.419616,-0.108026, 0.029768,-0.173739,0.211573, 0.125191,-0.098941,0.194122, 0.140375,-0.342343,-0.108026, 0.081722,-0.168359,0.191970, +}; +public static final int[] h22_faces = { // [] = { + 6, 8,11,5,6,7,1, + 4, 7,2,4,1, + 5, 4,9,10,8,1, + 4, 7,6,0,2, + 6, 0,3,12,9,4,2, + 5, 5,11,13,12,3, + 4, 0,6,5,3, + 4, 10,13,11,8, + 4, 12,13,10,9, +}; +public static final double[] h22_planes = { // [ h22_numf * 4 ] = { + 0.212159,0.447018,0.869002,0.151024,-0.889469,0.425934,0.165603,0.298347,-0.595564,-0.522855,0.609857,0.202141,0,1,0,0.273751,0,0,-1,0.108026,0.758508,-0.488331,0.431507,0.227038,0.964613,-0.254054,0.0705546,0.312375,0.364346,-0.255892,0.895417,0.244751,0.28037,-0.805551,0.521997,0.258742 +}; +// h23 +public static final int h23_numv = 16; +public static final int h23_numf = 10; +public static final double h23_volu = 0.051599; +public static final double[] h23_pos = { -0.800668,0.450995,-0.472891 }; +public static final double[] h23_verts = { // [ h23_numv * 3 ] = { + 0.035291,-0.217869,-0.228598, -0.199332,-0.134353,-0.300199, -0.199332,0.265879,-0.094319, -0.095074,0.352473,0.001132, -0.199332,-0.001690,0.132407, -0.199332,-0.208186,-0.186260, 0.189555,0.299490,0.167366, -0.199332,0.309177,-0.027504, -0.064385,-0.049725,0.223009, -0.036116,-0.285650,-0.106564, 0.116475,0.143410,0.211970, 0.319467,-0.096483,-0.027399, 0.092916,-0.255030,0.098198, 0.194883,-0.191512,0.077971, 0.239171,0.246507,0.109828, 0.115131,0.352473,0.103771, +}; +public static final int[] h23_faces = { // [] = { + 4, 0,9,5,1, + 5, 5,4,7,2,1, + 7, 2,3,15,14,11,0,1, + 3, 7,3,2, + 7, 7,4,8,10,6,15,3, + 5, 5,9,12,8,4, + 3, 14,15,6, + 5, 10,13,11,14,6, + 4, 12,13,10,8, + 5, 0,11,13,12,9, +}; +public static final double[] h23_planes = { // [ h23_numf * 4 ] = { + -0.131611,-0.83191,-0.539077,0.299835,-1,6.69634e-17,-4.33923e-17,0.199332,0.398278,0.419584,-0.815674,0.109103,-0.195313,0.823048,-0.533334,0.308068,-0.398278,0.419585,0.815673,0.186681,-0.553062,-0.69918,0.453068,0.171414,0.647541,0.750402,-0.132616,0.325287,0.693474,-0.121763,0.710118,0.213834,0.349687,-0.276295,0.895198,0.190861,0.493234,-0.850287,-0.183662,0.244643 +}; +// h24 +public static final int h24_numv = 12; +public static final int h24_numf = 8; +public static final double h24_volu = 0.050770; +public static final double[] h24_pos = { -0.845297,0.862613,-0.757515 }; +public static final double[] h24_verts = { // [ h24_numv * 3 ] = { + 0.078361,0.021092,0.334891, -0.154703,-0.145738,0.190305, -0.154703,0.137387,-0.242485, -0.154703,-0.314006,-0.242485, 0.072842,-0.206011,-0.242485, 0.237283,0.137387,-0.242485, -0.154703,-0.102441,0.257120, -0.050445,-0.059144,0.285756, 0.211362,-0.028505,0.044972, -0.154703,0.137387,0.380489, 0.272151,0.137387,-0.055204, 0.060041,0.137387,0.393596, +}; +public static final int[] h24_faces = { // [] = { + 3, 7,6,1, + 5, 6,9,2,3,1, + 6, 3,4,8,0,7,1, + 4, 5,4,3,2, + 5, 9,11,10,5,2, + 4, 5,10,8,4, + 5, 7,0,11,9,6, + 4, 10,11,0,8, +}; +public static final double[] h24_planes = { // [ h24_numf * 4 ] = { + 0.195313,-0.823048,0.533334,0.19123,-1,0,0,0.154703,0.404539,-0.852363,0.331398,0.124705,0,0,-1,0.242485,0,1,-0,0.137387,0.889469,-0.425934,-0.165603,0.192694,-0.0541955,-0.456759,0.887938,0.283483,0.901694,-0.0730722,0.426155,0.211832 +}; +// h25 +public static final int h25_numv = 16; +public static final int h25_numf = 10; +public static final double h25_volu = 0.064196; +public static final double[] h25_pos = { 0.265380,0.609017,-0.859766 }; +public static final double[] h25_verts = { // [ h25_numv * 3 ] = { + 0.171512,-0.295294,0.128463, -0.112864,0.390983,-0.140234, -0.179972,0.258217,0.163631, -0.171482,0.390983,0.031499, -0.146465,0.312621,0.159756, 0.063572,-0.117444,0.267684, -0.245115,0.390983,-0.140234, -0.337319,0.040895,-0.140234, 0.499394,-0.306418,-0.140234, 0.112578,-0.021086,0.259138, 0.074204,-0.220888,0.227450, 0.064293,-0.284390,0.182686, -0.258312,-0.146590,-0.140234, 0.497529,-0.308188,-0.130217, -0.299210,0.224777,0.000875, -0.248273,0.390983,-0.097058, +}; +public static final int[] h25_faces = { // [] = { + 6, 3,4,9,13,8,1, + 5, 8,12,7,6,1, + 4, 6,15,3,1, + 7, 14,7,12,11,10,5,2, + 4, 5,9,4,2, + 5, 4,3,15,14,2, + 5, 10,0,13,9,5, + 4, 7,14,15,6, + 5, 13,0,11,12,8, + 3, 11,0,10, +}; +public static final double[] h25_planes = { // [ h25_numf * 4 ] = { + 0.727925,0.639055,0.248465,0.13286,0,-0,-1,0.140234,0,1,0,0.390983,-0.735479,-0.309932,0.602505,0.150925,-0.158394,0.166867,0.973173,0.230836,-0.747363,0.49209,0.446425,0.33462,0.598205,-0.236329,0.765702,0.270751,-0.964613,0.254054,-0.0705546,0.345666,-0.201934,-0.957321,-0.206781,0.221494,0.320422,-0.578682,0.749971,0.322182 +}; +// h26 +public static final int h26_numv = 24; +public static final int h26_numf = 14; +public static final double h26_volu = 0.101687; +public static final double[] h26_pos = { -0.341007,0.877992,-0.537072 }; +public static final double[] h26_verts = { // [ h26_numv * 3 ] = { + 0.358114,0.122008,-0.419752, -0.168425,-0.052359,0.397165, -0.220490,-0.180490,0.174009, 0.459922,0.043646,-0.162938, 0.324251,-0.109249,-0.070985, -0.202046,0.011183,0.424477, 0.252084,0.007514,0.202105, -0.286958,0.122008,0.388199, 0.307177,-0.044198,-0.321819, 0.426415,-0.010758,-0.159063, 0.082627,-0.250684,-0.160780, -0.033904,-0.274387,-0.120138, -0.232139,0.122008,-0.275647, -0.292928,-0.043884,-0.175471, -0.344531,-0.074523,0.167952, -0.207099,-0.190024,0.165835, -0.444249,0.122008,0.173153, -0.425929,0.005713,0.114448, 0.327136,0.122008,0.185091, -0.202046,0.122008,0.443480, 0.434905,0.122008,-0.291195, 0.483509,0.122008,-0.120325, -0.187210,-0.038985,0.408631, -0.270106,-0.127507,0.231547, +}; +public static final int[] h26_faces = { // [] = { + 5, 22,23,2,15,1, + 6, 15,11,10,4,6,1, + 6, 6,18,19,5,22,1, + 3, 23,14,2, + 6, 14,17,13,11,15,2, + 3, 20,21,3, + 6, 21,18,6,4,9,3, + 5, 9,8,0,20,3, + 4, 10,8,9,4, + 3, 19,7,5, + 7, 7,16,17,14,23,22,5, + 8, 19,18,21,20,0,12,16,7, + 6, 10,11,13,12,0,8, + 4, 13,17,16,12, +}; +public static final double[] h26_planes = { // [ h26_numf * 4 ] = { + -0.256638,-0.811103,0.525594,0.29444,0.324513,-0.835692,0.443069,0.165071,0.433652,-0.152285,0.888119,0.287665,-0.647541,-0.750402,0.132616,0.301294,-0.636259,-0.754085,-0.162882,0.248051,0.95246,-0.139363,-0.270922,0.476118,0.791095,-0.458379,0.40504,0.277839,0.747363,-0.49209,-0.446425,0.39499,0.555832,-0.7947,-0.243931,0.284365,-0.540055,-0.142236,0.829524,0.459639,-0.742791,-0.391264,0.543299,0.37632,0,1,0,0.122008,-0.212159,-0.447018,-0.869002,0.234249,-0.901694,0.0730722,-0.426155,0.335702 +}; +// h27 +public static final int h27_numv = 24; +public static final int h27_numf = 14; +public static final double h27_volu = 0.100588; +public static final double[] h27_pos = { 0.167088,0.649940,-0.364014 }; +public static final double[] h27_verts = { // [ h27_numv * 3 ] = { + -0.183844,0.118803,-0.244043, -0.044353,-0.266136,0.405236, -0.256011,0.235567,0.029047, 0.161864,-0.158366,-0.228068, 0.300539,0.065664,-0.127155, -0.024586,0.350060,-0.293383, -0.048173,0.271698,-0.335996, -0.180959,0.350060,0.012033, -0.081680,0.217294,-0.332121, -0.044357,0.350060,0.088262, -0.006196,-0.377080,0.285910, 0.201878,-0.226993,0.143823, -0.003872,-0.277036,0.420726, 0.210870,-0.062009,-0.236614, -0.003871,0.350060,0.098146, 0.183618,0.350060,-0.130723, -0.165155,-0.254165,0.331667, -0.075081,-0.408619,0.192919, -0.091738,-0.410255,0.124205, 0.005721,-0.287236,0.414262, -0.077668,-0.381972,-0.025325, -0.102748,-0.401170,0.182332, 0.134962,-0.226993,-0.182915, 0.109551,-0.305242,0.296779, +}; +public static final int[] h27_faces = { // [] = { + 7, 16,21,17,10,19,12,1, + 4, 12,14,9,1, + 5, 9,7,2,16,1, + 6, 7,5,6,8,0,2, + 6, 0,20,18,21,16,2, + 5, 13,4,11,22,3, + 5, 22,20,0,8,3, + 4, 8,6,13,3, + 5, 13,6,5,15,4, + 7, 15,14,12,19,23,11,4, + 5, 7,9,14,15,5, + 7, 17,18,20,22,11,23,10, + 3, 23,19,10, + 3, 21,18,17, +}; +public static final double[] h27_planes = { // [ h27_numf * 4 ] = { + -0.40667,-0.730271,0.54893,0.434835,-0.212159,0.447018,0.869002,0.242593,-0.444511,0.409753,0.796563,0.233461,-0.791095,0.458379,-0.40504,0.298742,-0.954535,-0.263372,-0.139635,0.178273,0.870583,-0.45858,-0.178295,0.254203,-0.309646,-0.434949,-0.84554,0.211601,0.158394,-0.166867,-0.973173,0.274014,0.598205,0.236328,-0.765702,0.292665,0.73548,0.309929,0.602505,0.16478,1.09327e-15,1,1.13815e-15,0.35006,0.53156,-0.839996,-0.108863,0.282326,0.425203,-0.759567,0.4922,0.424508,-0.292039,-0.95183,0.0934524,0.428891 +}; +// h28 +public static final int h28_numv = 18; +public static final int h28_numf = 11; +public static final double h28_volu = 0.075441; +public static final double[] h28_pos = { 0.013616,0.472900,-0.719797 }; +public static final double[] h28_verts = { // [ h28_numv * 3 ] = { + -0.187022,-0.167506,-0.280203, 0.109520,-0.345231,0.152809, -0.085555,0.177012,-0.280203, -0.271995,0.154408,0.021945, -0.030372,0.295843,0.111740, 0.061535,-0.227567,0.329703, 0.075804,-0.204932,0.330457, 0.071792,0.394334,0.023662, 0.208102,-0.281022,0.072668, -0.047446,0.360894,-0.139094, 0.077205,-0.350161,0.038133, -0.006548,-0.010473,-0.280203, 0.288434,-0.049953,0.172868, 0.315336,0.018674,0.127715, 0.316057,-0.148273,0.042717, 0.325968,-0.084770,0.087482, -0.256811,-0.088994,-0.280203, -0.315464,0.084990,0.019794, +}; +public static final int[] h28_faces = { // [] = { + 7, 8,14,15,12,6,5,1, + 6, 5,17,16,0,10,1, + 3, 10,8,1, + 5, 16,17,3,9,2, + 7, 9,7,13,15,14,11,2, + 4, 11,0,16,2, + 5, 17,5,6,4,3, + 4, 4,7,9,3, + 5, 6,12,13,7,4, + 5, 10,0,11,14,8, + 3, 15,13,12, +}; +public static final double[] h28_planes = { // [ h28_numf * 4 ] = { + 0.720506,-0.471135,0.508826,0.319313,-0.726908,-0.64614,0.232611,0.179002,0.485104,-0.868795,-0.0993492,0.337882,-0.758508,0.488331,-0.431507,0.272244,0.735479,0.309932,-0.602505,0.160762,0,0,-1,0.280203,-0.469484,0.267909,0.841315,0.187527,-0.555832,0.7947,0.243931,0.279245,0.309646,0.434949,0.84554,0.213753,0.469359,-0.539421,-0.69909,0.198463,0.901694,-0.0730722,0.426155,0.337399 +}; +// h29 +public static final int h29_numv = 20; +public static final int h29_numf = 12; +public static final double h29_volu = 0.090754; +public static final double[] h29_pos = { -0.195482,0.549508,-0.348926 }; +public static final double[] h29_verts = { // [ h29_numv * 3 ] = { + -0.062897,0.077801,-0.348926, 0.254536,-0.331284,-0.002375, -0.179429,0.054098,-0.308283, 0.178726,0.219235,-0.259131, -0.352624,0.138460,-0.022310, 0.259822,-0.300738,0.167244, 0.197415,-0.153733,0.316579, 0.065987,-0.327570,0.133724, 0.114982,-0.134660,0.333685, 0.270633,-0.304175,-0.041168, -0.106366,0.008382,-0.351078, 0.106560,0.335999,0.013959, -0.240892,-0.124645,-0.147161, -0.313950,0.276125,0.209019, -0.158320,0.003002,-0.331475, 0.036774,-0.342768,0.065557, 0.284902,-0.281540,-0.040413, 0.270832,-0.309823,0.109117, 0.013405,-0.084041,0.336165, 0.046528,-0.137097,0.329090, +}; +public static final int[] h29_faces = { // [] = { + 4, 9,16,17,1, + 5, 17,5,7,15,1, + 6, 15,12,14,10,9,1, + 4, 0,10,14,2, + 4, 14,12,4,2, + 6, 4,13,11,3,0,2, + 5, 16,9,10,0,3, + 6, 11,6,5,17,16,3, + 7, 12,15,7,19,18,13,4, + 5, 6,8,19,7,5, + 5, 11,13,18,8,6, + 3, 18,19,8, +}; +public static final double[] h29_planes = { // [ h29_numf * 4 ] = { + 0.846082,-0.532633,-0.0211314,0.391862,0.105626,-0.979232,0.173057,0.350878,-0.148211,-0.780702,-0.607074,0.22235,-0.364346,0.255892,-0.895417,0.355259,-0.864691,-0.138024,-0.482969,0.296575,-0.324513,0.835692,-0.443069,0.240027,0.469484,-0.267909,-0.841315,0.243184,0.954535,0.263372,0.139635,0.192157,-0.73808,-0.518378,0.431882,0.178854,-0.0212658,-0.716912,0.696839,0.326619,0.289106,0.541462,0.789453,0.223758,-0.0600487,-0.168696,0.983837,0.344105 +}; +// h30 +public static final int h30_numv = 26; +public static final int h30_numf = 15; +public static final double h30_volu = 0.141813; +public static final double[] h30_pos = { 0.709749,0.432546,-0.520590 }; +public static final double[] h30_verts = { // [ h30_numv * 3 ] = { + 0.086130,-0.133630,-0.479410, 0.290251,-0.067548,-0.461259, 0.290251,0.254276,-0.130163, -0.166094,-0.194830,-0.275875, -0.114073,0.017151,0.452790, 0.263868,-0.083016,-0.470730, -0.015645,0.141724,0.383369, -0.170984,0.316821,0.046789, -0.242122,0.283058,0.029421, 0.290251,0.110614,0.239339, -0.340783,-0.009598,0.300399, 0.290251,-0.018830,0.261535, 0.067740,-0.137994,-0.479410, -0.241377,-0.054963,0.435747, 0.058158,-0.287592,0.103343, 0.290251,-0.145966,0.143817, 0.068185,-0.139308,-0.479410, -0.017612,-0.287592,-0.266628, 0.053160,-0.131717,-0.469392, -0.272857,-0.118823,-0.210712, 0.007901,-0.200618,-0.414231, 0.003123,-0.268644,-0.311584, -0.331791,0.155385,-0.080037, -0.407699,-0.009598,-0.026339, -0.380797,0.059028,-0.071491, -0.370165,-0.044416,-0.111725, +}; +public static final int[] h30_faces = { // [] = { + 6, 15,14,17,21,5,1, + 9, 5,0,12,18,22,8,7,2,1, + 5, 2,9,11,15,1, + 4, 7,6,9,2, + 4, 20,21,17,3, + 8, 17,14,13,10,23,25,19,3, + 6, 19,18,12,16,20,3, + 5, 13,14,15,11,4, + 4, 11,9,6,4, + 6, 6,7,8,10,13,4, + 5, 21,20,16,0,5, + 5, 22,24,23,10,8, + 3, 0,16,12, + 5, 19,25,24,22,18, + 3, 24,25,23, +}; +public static final double[] h30_planes = { // [ h30_numf * 4 ] = { + 0.53156,-0.839996,-0.108863,0.26124,-0.167754,0.706913,-0.687119,0.220498,1,-0,0,0.290251,0.256529,0.900844,0.350247,0.257932,-0.43192,-0.742413,-0.512121,0.357665,-0.531561,-0.839995,0.108864,0.221912,-0.613049,-0.207593,-0.762283,0.352564,0.275531,-0.653109,0.705359,0.276747,0.433652,0.152285,0.888119,0.355275,-0.46199,0.681388,0.567693,0.321433,0.256638,-0.811103,-0.525594,0.382466,-0.870583,0.45858,0.178295,0.345838,-0,0,-1,0.479409,-0.598205,0.236329,-0.765702,0.296486,-0.901694,0.0730722,-0.426155,0.378142 +}; +// h31 +public static final int h31_numv = 20; +public static final int h31_numf = 12; +public static final double h31_volu = 0.145607; +public static final double[] h31_pos = { 0.628702,0.773411,-0.793457 }; +public static final double[] h31_verts = { // [ h31_numv * 3 ] = { + -0.189575,0.226589,0.317223, 0.371298,-0.414948,-0.206543, -0.476185,0.226589,-0.206543, 0.371298,0.226589,-0.206543, -0.250744,-0.185480,0.192828, 0.148787,-0.478859,-0.206543, -0.509787,0.148227,0.093447, -0.534804,0.226589,-0.034811, -0.277996,0.226589,0.298719, -0.486200,0.226589,0.136059, 0.371298,-0.408413,-0.188392, 0.167177,-0.474495,-0.206543, 0.366378,-0.417196,-0.206543, 0.344915,-0.423881,-0.197864, 0.371298,-0.086589,0.142703, 0.371298,0.226589,0.089002, -0.161075,-0.057807,0.302287, -0.089936,-0.024044,0.319655, 0.134207,-0.472582,-0.196526, 0.136072,-0.470812,-0.206543, +}; +public static final int[] h31_faces = { // [] = { + 4, 10,13,12,1, + 7, 12,11,5,19,2,3,1, + 5, 3,15,14,10,1, + 6, 19,18,4,6,7,2, + 7, 7,9,8,0,15,3,2, + 5, 16,8,9,6,4, + 9, 18,5,11,13,10,14,17,16,4, + 3, 18,19,5, + 3, 9,7,6, + 4, 16,17,0,8, + 3, 12,13,11, + 4, 15,0,17,14, +}; +public static final double[] h31_planes = { // [ h31_numf * 4 ] = { + 0.395039,-0.86436,0.311169,0.441071,-0,-0,-1,0.206543,1,-0,0,0.371298,-0.727925,-0.639055,-0.248465,0.253143,4.94863e-17,1,-0,0.226589,-0.598205,-0.236328,0.765702,0.341479,0.167754,-0.706913,0.687119,0.221551,-0.518906,-0.82,-0.241527,0.365343,-0.95246,0.139363,0.270922,0.531526,-0.204299,-0.0717432,0.976276,0.332171,0.275992,-0.959497,-0.0565231,0.51309,0.372229,0.156858,0.91479,0.255169 +}; +// h32 +public static final int h32_numv = 22; +public static final int h32_numf = 13; +public static final double h32_volu = 0.092552; +public static final double[] h32_pos = { -0.648077,-0.694629,-0.055690 }; +public static final double[] h32_verts = { // [ h32_numv * 3 ] = { + -0.351923,0.020682,-0.162313, -0.351923,0.291038,-0.298522, 0.116588,0.074450,0.304425, 0.180292,0.145010,-0.063690, -0.351923,0.286862,-0.299238, 0.082653,-0.305371,0.200452, 0.444715,-0.214767,0.086986, 0.440565,-0.305371,0.060643, 0.437298,-0.305371,0.003205, 0.441236,-0.180086,0.007980, 0.202670,-0.305371,-0.129990, -0.122926,-0.305371,-0.050498, -0.351923,0.343433,0.003710, 0.034975,0.067995,0.334312, -0.249787,0.361137,-0.236631, 0.059834,0.222599,0.089656, 0.420946,-0.305371,-0.023410, 0.437088,-0.283432,-0.011766, -0.351923,0.387353,-0.064067, -0.294272,0.397125,-0.093222, -0.351923,0.309463,-0.280428, -0.321961,0.320573,-0.278827, +}; +public static final int[] h32_faces = { // [] = { + 3, 20,21,1, + 9, 21,14,3,9,17,16,10,4,1, + 6, 4,0,12,18,20,1, + 5, 13,5,7,6,2, + 5, 6,9,3,15,2, + 6, 15,19,18,12,13,2, + 4, 14,19,15,3, + 4, 10,11,0,4, + 5, 13,12,0,11,5, + 6, 11,10,16,8,7,5, + 5, 7,8,17,9,6, + 3, 16,17,8, + 5, 21,20,18,19,14, +}; +public static final double[] h32_planes = { // [ h32_numf * 4 ] = { + -0.216442,0.684063,-0.696571,0.483201,0.433652,0.152285,-0.888119,0.156831,-1,0,0,0.351923,0.349687,-0.276295,0.895198,0.29272,0.727924,0.639056,0.248465,0.208084,0.131611,0.83191,0.539077,0.241389,0.471464,0.878752,-0.0742736,0.21716,-0.212159,-0.447018,-0.869002,0.206469,-0.73548,-0.309929,0.602505,0.154628,-3.74119e-15,-1,2.12832e-16,0.305371,0.99796,-0.0292037,-0.0567728,0.445142,0.80443,-0.32957,-0.494242,0.450833,-0.314046,0.893286,-0.321583,0.47714 +}; +// h33 +public static final int h33_numv = 18; +public static final int h33_numf = 11; +public static final double h33_volu = 0.056945; +public static final double[] h33_pos = { -0.288352,-0.547292,0.050646 }; +public static final double[] h33_verts = { // [ h33_numv * 3 ] = { + 0.084990,-0.362104,-0.019350, -0.079434,0.021164,0.334816, 0.019488,-0.072734,0.262363, 0.115516,0.076855,-0.268585, 0.213070,0.021874,-0.243280, 0.274323,0.089944,-0.132397, 0.019789,0.332949,0.053313, 0.257211,0.025988,-0.078610, 0.131191,0.288888,-0.060012, 0.118204,-0.320377,0.031687, 0.081511,-0.327423,-0.098356, -0.243137,-0.072887,0.198089, -0.179433,-0.002327,-0.170026, -0.299891,0.075262,-0.016680, -0.055817,0.322184,0.088384, -0.038680,0.277450,0.153234, 0.148159,-0.119839,-0.229545, 0.048588,0.033746,-0.272086, +}; +public static final int[] h33_faces = { // [] = { + 5, 11,0,9,2,1, + 7, 2,7,5,8,6,15,1, + 5, 15,14,13,11,1, + 3, 9,7,2, + 4, 4,16,17,3, + 7, 17,12,13,14,6,8,3, + 4, 8,5,4,3, + 7, 5,7,9,0,10,16,4, + 3, 14,15,6, + 5, 0,11,13,12,10, + 4, 12,17,16,10, +}; +public static final double[] h33_planes = { // [ h33_numf * 4 ] = { + -0.167754,-0.706913,0.687119,0.228423,0.73548,0.309929,0.602505,0.149866,-0.708232,0.479648,0.518021,0.239851,0.830851,-0.164118,0.531744,0.167639,0.158394,-0.166869,-0.973173,0.266852,-0.391463,0.659847,-0.641373,0.177755,0.49733,0.589428,-0.636583,0.273727,0.877503,-0.423705,-0.224641,0.232352,0.131611,0.83191,0.539077,0.308327,-0.727924,-0.639056,-0.248465,0.174346,-0.309646,-0.434949,-0.84554,0.200337 +}; +// h34 +public static final int h34_numv = 24; +public static final int h34_numf = 14; +public static final double h34_volu = 0.086482; +public static final double[] h34_pos = { -0.499709,-0.643458,-0.327986 }; +public static final double[] h34_verts = { // [ h34_numv * 3 ] = { + -0.500291,0.235691,-0.026942, -0.413349,0.203755,-0.157062, -0.223651,0.321490,-0.139249, 0.209880,-0.356542,0.003973, 0.365162,-0.137565,0.097393, 0.292868,-0.231257,0.280276, 0.359516,-0.023673,0.149087, -0.329463,0.339839,-0.019523, -0.041433,0.349469,-0.148408, 0.054302,-0.356542,0.142306, 0.272578,-0.356542,0.248886, 0.288720,-0.334603,0.260530, 0.023896,-0.069111,-0.283979, 0.274970,-0.222320,-0.056303, 0.127449,-0.356542,-0.036276, -0.035189,-0.103922,-0.288953, -0.023751,0.360733,-0.121029, -0.500291,0.237083,-0.030523, -0.346425,0.336124,-0.010604, 0.259945,0.129913,0.106546, -0.500291,0.239867,-0.026226, -0.470329,0.269402,-0.006532, -0.398155,0.309966,0.035665, 0.031924,0.093839,0.208606, +}; +public static final int[] h34_faces = { // [] = { + 7, 17,20,21,18,7,2,1, + 5, 2,8,12,15,1, + 6, 15,14,9,0,17,1, + 4, 7,16,8,2, + 5, 14,15,12,13,3, + 5, 13,4,11,10,3, + 4, 10,9,14,3, + 7, 13,12,8,16,19,6,4, + 4, 6,5,11,4, + 4, 6,19,23,5, + 9, 23,22,21,20,0,9,10,11,5, + 6, 18,22,23,19,16,7, + 3, 0,20,17, + 3, 21,22,18, +}; +public static final double[] h34_planes = { // [ h34_numf * 4 ] = { + -0.425203,0.759567,-0.4922,0.407829,-0.0929092,0.293639,-0.951391,0.247662,-0.66261,-0.69806,-0.271405,0.174284,-0.159459,0.944944,-0.285751,0.379244,0.373525,-0.524676,-0.76498,0.262425,0.837582,-0.502473,-0.214421,0.354093,0,-1,0,0.356542,0.73548,0.309929,-0.602505,0.167254,0.941719,-0.0992098,0.32144,0.388833,0.309646,0.434949,0.84554,0.227085,-0.433652,-0.152285,0.888119,0.157132,0.148211,0.780702,0.607074,0.204631,-1,0,-0,0.500291,-0.474713,0.879502,-0.0335246,0.460429 +}; +// h35 +public static final int h35_numv = 12; +public static final int h35_numf = 8; +public static final double h35_volu = 0.072358; +public static final double[] h35_pos = { -0.852811,-0.781078,0.150064 }; +public static final double[] h35_verts = { // [ h35_numv * 3 ] = { + -0.147189,-0.218922,0.332047, 0.103613,-0.074924,0.288589, -0.147189,0.429882,-0.202044, -0.147189,-0.218922,-0.312160, 0.239709,0.154443,0.128558, 0.287386,-0.218922,-0.005301, -0.043492,-0.218922,0.344705, 0.074717,-0.218922,0.306226, -0.147189,0.402063,0.012610, 0.208223,0.167113,0.176854, -0.147189,0.107130,-0.368067, 0.081807,-0.218922,-0.256252, +}; +public static final int[] h35_faces = { // [] = { + 3, 6,7,1, + 5, 7,5,4,9,1, + 5, 9,8,0,6,1, + 4, 8,9,4,2, + 5, 4,5,11,10,2, + 5, 10,3,0,8,2, + 3, 10,11,3, + 6, 11,5,7,6,0,3, +}; +public static final double[] h35_planes = { // [ h35_numf * 4 ] = { + 0.309078,0.0542691,0.949487,0.301971,0.822068,-0.096228,0.561199,0.254343,-0.107916,0.45476,0.884052,0.209874,0.512085,0.851811,0.110395,0.2685,0.73548,0.309929,-0.602505,0.146711,-1,-0,-0,0.147189,0.233951,-0.164312,-0.958263,0.300667,0,-1,0,0.218922 +}; +// h36 +public static final int h36_numv = 18; +public static final int h36_numf = 11; +public static final double h36_volu = 0.076715; +public static final double[] h36_pos = { 0.330903,-0.599381,-0.308448 }; +public static final double[] h36_verts = { // [ h36_numv * 3 ] = { + 0.235744,-0.093981,0.208985, 0.157036,0.091360,0.296934, -0.213473,-0.059832,-0.258208, 0.131366,0.084254,0.304768, 0.060949,-0.352878,-0.040467, 0.031132,-0.367472,0.023458, -0.038178,0.319175,-0.078462, 0.346140,-0.033881,-0.005840, 0.305466,-0.106272,-0.107625, -0.256020,-0.056138,-0.213238, -0.331115,0.110184,0.014099, -0.356965,0.085987,0.067218, 0.185622,-0.147504,0.212044, 0.241393,0.219660,0.109239, -0.343391,-0.100844,-0.022261, -0.046519,0.081665,-0.290234, -0.272849,0.156195,0.144404, -0.146830,0.270831,-0.017119, +}; +public static final int[] h36_faces = { // [] = { + 6, 13,6,17,16,3,1, + 4, 3,12,0,1, + 4, 0,7,13,1, + 6, 9,10,17,6,15,2, + 4, 15,8,4,2, + 5, 4,5,14,9,2, + 6, 16,11,14,5,12,3, + 6, 8,7,0,12,5,4, + 5, 13,7,8,15,6, + 4, 14,11,10,9, + 4, 11,16,17,10, +}; +public static final double[] h36_planes = { // [ h36_numf * 4 ] = { + -0.066237,0.837367,0.542613,0.227221,0.349687,-0.276295,0.895198,0.295486,0.864691,0.138024,0.482969,0.291807,-0.582463,0.552262,-0.596442,0.245303,0.212159,-0.447016,-0.869003,0.205839,-0.496382,-0.766976,-0.406636,0.25685,-0.398278,-0.419584,0.815674,0.16092,0.722578,-0.66608,0.18498,0.2716,0.595564,0.522855,-0.609857,0.191995,-0.913105,0.120244,-0.389591,0.310099,-0.654405,0.755705,0.0257735,0.300313 +}; +// h37 +public static final int h37_numv = 18; +public static final int h37_numf = 11; +public static final double h37_volu = 0.098217; +public static final double[] h37_pos = { 0.055330,-0.588368,0.333127 }; +public static final double[] h37_verts = { // [ h37_numv * 3 ] = { + -0.107417,0.016721,0.347927, 0.283844,-0.036335,0.197820, 0.129290,0.324988,-0.064466, -0.012100,0.128834,-0.356552, 0.344968,0.171444,-0.038138, -0.270436,0.127441,0.395275, -0.130084,-0.375511,-0.154724, 0.001812,-0.380727,-0.087638, -0.247911,0.142505,0.383526, 0.360906,0.133475,0.137346, 0.062042,-0.352141,-0.072933, 0.261216,0.073240,-0.194499, 0.127844,0.325300,-0.059106, 0.361773,0.137946,0.130076, -0.225478,-0.279302,-0.250794, -0.324194,-0.031659,-0.020118, -0.297963,0.086614,0.328910, -0.086471,0.067064,-0.361091, +}; +public static final int[] h37_faces = { // [] = { + 6, 10,11,4,13,9,1, + 5, 9,8,5,0,1, + 4, 0,7,10,1, + 4, 12,13,4,2, + 4, 4,11,3,2, + 8, 3,17,15,16,5,8,12,2, + 7, 11,10,7,6,14,17,3, + 5, 16,6,7,0,5, + 4, 16,15,14,6, + 4, 9,13,12,8, + 3, 15,17,14, +}; +public static final double[] h37_planes = { // [ h37_numf * 4 ] = { + 0.870583,-0.45858,-0.178295,0.228502,0.372229,0.156856,0.91479,0.280919,0.167754,-0.706913,0.687119,0.209227,0.568104,0.816131,0.105771,0.331865,0.49733,0.589428,-0.636583,0.296895,-0.616962,0.758294,-0.21059,0.180245,0.398278,-0.419585,-0.815673,0.231954,-0.32928,-0.737152,0.590069,0.228345,-0.799798,-0.547681,0.245698,0.271686,0.226312,0.817437,0.529699,0.263537,-0.830851,0.164118,-0.531744,0.274859 +}; +// h38 +public static final int h38_numv = 28; +public static final int h38_numf = 16; +public static final double h38_volu = 0.093559; +public static final double[] h38_pos = { 0.133166,-0.773583,-0.050905 }; +public static final double[] h38_verts = { // [ h38_numv * 3 ] = { + -0.076024,-0.195512,0.296394, 0.264846,-0.226417,0.026836, 0.183380,0.258456,0.189533, -0.015793,-0.166926,0.311098, -0.267713,-0.007440,-0.179688, -0.159228,0.260189,-0.190326, -0.343945,-0.226417,-0.001580, -0.273359,0.106452,-0.127994, 0.216958,-0.226417,-0.206989, 0.383359,0.026697,-0.045499, 0.329103,0.258456,0.047225, -0.089936,0.314049,0.027481, -0.145654,0.073358,-0.279804, 0.228869,-0.193270,-0.234086, -0.131382,0.326289,-0.026485, -0.075112,0.330397,-0.113139, -0.208448,0.248166,-0.141729, -0.011151,-0.226417,0.296364, -0.211663,-0.226417,0.216210, -0.072038,-0.226417,0.288931, -0.336528,-0.135813,0.082201, -0.147195,0.316236,-0.030846, -0.340678,-0.226417,0.055858, -0.164307,0.252279,0.022941, -0.344155,-0.204478,-0.016551, -0.340007,-0.101132,0.003195, -0.207920,-0.190296,0.229308, -0.303314,-0.094086,0.133238, +}; +public static final int[] h38_faces = { // [] = { + 4, 8,13,9,1, + 6, 9,10,2,3,17,1, + 7, 17,19,18,22,6,8,1, + 5, 10,15,14,11,2, + 7, 11,23,27,26,0,3,2, + 4, 0,19,17,3, + 4, 24,25,7,4, + 5, 7,16,5,12,4, + 6, 12,13,8,6,24,4, + 5, 16,21,14,15,5, + 6, 15,10,9,13,12,5, + 5, 22,20,25,24,6, + 7, 25,20,27,23,21,16,7, + 4, 14,21,23,11, + 5, 26,27,20,22,18, + 4, 19,0,26,18, +}; +public static final double[] h38_planes = { // [ h38_numf * 4 ] = { + 0.870583,-0.45858,-0.178295,0.329616,0.693474,-0.121763,0.710118,0.23029,0,-1,0,0.226417,0.124536,0.983986,0.127525,0.301324,-0.398278,0.419585,0.815673,0.190005,-0.117405,-0.247372,0.961781,0.342356,-0.941719,0.0992098,-0.32144,0.309131,-0.709719,0.26169,-0.654077,0.305583,-0.289106,-0.541464,-0.789452,0.223281,-0.465257,0.845503,-0.262033,0.343944,0.398278,0.419584,-0.815674,0.200998,-0.99796,0.0292037,0.0567728,0.336541,-0.877503,0.423705,0.224641,0.256225,-0.548603,0.619234,0.561769,0.259246,-0.770892,-0.145024,0.620237,0.330106,-0.445543,-0.264025,0.855443,0.33904 +}; +// h39 +public static final int h39_numv = 32; +public static final int h39_numf = 18; +public static final double h39_volu = 0.060173; +public static final double[] h39_pos = { -0.130993,-0.349156,0.297470 }; +public static final double[] h39_verts = { // [ h39_numv * 3 ] = { + 0.132777,-0.098138,-0.374861, 0.174223,-0.110378,-0.320895, -0.236793,-0.176972,0.087992, 0.120090,0.163784,-0.274197, -0.036262,0.126682,-0.293283, -0.239846,-0.040235,0.342234, -0.196039,0.079314,-0.093590, -0.026168,0.090752,-0.306837, -0.084113,-0.111771,0.430932, -0.132771,0.138527,-0.197817, -0.061588,-0.096707,0.419183, -0.167047,-0.030107,0.457226, 0.314167,0.086089,-0.023449, 0.140527,0.255266,-0.004320, -0.137571,0.134813,-0.193511, 0.315613,0.085777,-0.028809, 0.116964,-0.108191,-0.379221, 0.099852,-0.172148,-0.325434, -0.176687,-0.026318,0.447418, -0.168971,-0.023213,0.453768, -0.137871,-0.270870,0.015539, -0.111640,-0.152598,0.364567, -0.122362,-0.092357,0.456223, -0.127730,-0.079472,0.460978, -0.243030,-0.080780,0.324741, -0.136583,-0.114124,0.420896, -0.241856,-0.054541,0.348612, -0.178625,-0.028253,0.445248, -0.171209,-0.024409,0.453290, -0.169333,-0.024798,0.455225, 0.224076,0.244621,-0.088171, 0.213513,0.251212,-0.061379, +}; +public static final int[] h39_faces = { // [] = { + 5, 0,3,30,15,1, + 8, 15,12,10,8,21,20,17,1, + 4, 17,16,0,1, + 5, 20,21,25,24,2, + 5, 24,26,5,6,2, + 7, 6,14,7,16,17,20,2, + 5, 0,16,7,4,3, + 6, 4,9,13,31,30,3, + 4, 7,14,9,4, + 4, 26,27,18,5, + 8, 18,28,19,13,9,14,6,5, + 4, 10,23,22,8, + 4, 22,25,21,8, + 8, 12,31,13,19,29,11,23,10, + 7, 27,26,24,25,22,23,11, + 5, 29,28,18,27,11, + 4, 15,30,31,12, + 3, 28,29,19, +}; +public static final double[] h39_planes = { // [ h39_numf * 4 ] = { + 0.794364,0.251059,-0.553132,0.288182,0.616962,-0.758294,0.21059,0.12361,0.548603,-0.619234,-0.561769,0.344197,-0.526505,-0.792388,0.308081,0.292012,-0.991673,0.108076,-0.0700326,0.209533,-0.73548,-0.309929,-0.602505,0.17599,0.0284606,0.359798,-0.932596,0.318062,-0.184883,0.934913,-0.302912,0.213979,-0.696788,0.0734069,-0.713511,0.243827,-0.830322,0.320028,0.456232,0.342411,-0.493232,0.850288,0.183662,0.146944,0.512456,-0.101226,0.852726,0.335677,-0.0662371,-0.837367,0.542614,0.332994,0.553104,0.49165,0.672575,0.200322,-0.664689,-0.486283,0.567201,0.385014,-0.721996,-0.0507074,0.690036,0.437637,0.818514,0.542417,0.189261,0.299408,-0.474458,0.651966,0.591464,0.333423 +}; +// h40 +public static final int h40_numv = 24; +public static final int h40_numf = 14; +public static final double h40_volu = 0.115424; +public static final double[] h40_pos = { 0.492476,-0.748212,0.263785 }; +public static final double[] h40_verts = { // [ h40_numv * 3 ] = { + -0.375103,-0.192297,-0.003592, 0.259307,0.208511,0.137583, 0.097667,-0.251788,0.295436, 0.264741,-0.251788,-0.112461, -0.092178,0.331289,0.031204, 0.024049,0.001327,-0.360189, 0.074171,0.054850,-0.363248, 0.312772,-0.115013,-0.159366, -0.175930,0.233085,-0.125157, -0.094464,-0.251788,-0.287854, -0.004537,0.240191,-0.275299, -0.030207,0.233085,-0.267465, -0.370461,-0.251788,-0.018326, 0.056736,-0.251788,0.315422, -0.153302,0.123509,0.267162, -0.068302,0.078845,0.319783, 0.171724,0.348803,0.156293, 0.053571,0.367605,-0.023060, -0.075373,0.297791,0.199418, 0.109457,0.331072,0.189737, -0.005042,0.303901,0.226077, 0.014996,0.282164,0.244247, -0.076239,0.293319,0.206688, -0.068649,0.297216,0.207331, +}; +public static final int[] h40_faces = { // [] = { + 4, 2,3,7,1, + 6, 7,6,10,17,16,1, + 7, 16,19,21,15,13,2,1, + 5, 13,12,9,3,2, + 5, 9,5,6,7,3, + 5, 17,10,11,8,4, + 6, 8,0,14,22,18,4, + 7, 18,23,20,19,16,17,4, + 6, 9,12,0,8,11,5, + 4, 11,10,6,5, + 5, 13,15,14,0,12, + 6, 15,21,20,23,22,14, + 3, 22,23,18, + 3, 20,21,19, +}; +public static final double[] h40_planes = { // [ h40_numf * 4 ] = { + 0.908278,-0.191373,0.372031,0.246805,0.73808,0.518378,-0.431882,0.240058,0.433652,0.152285,0.888119,0.266393,5.15129e-17,-1,5.27492e-17,0.251788,0.398278,-0.419585,-0.815673,0.302818,-0.348894,0.86639,-0.357268,0.308038,-0.870583,0.45858,0.178295,0.237735,-0.162747,0.964426,0.208316,0.341006,-0.693474,0.121763,-0.710118,0.23926,-0.349687,0.276295,-0.895198,0.314397,-0.598205,-0.236328,0.765702,0.267084,-0.296224,0.4369,0.849335,0.326283,-0.440632,0.78713,0.431589,0.353679,0.071473,0.677671,0.731884,0.371046 +}; +} \ No newline at end of file From 35cbed98bed7727e88ec4fa73d46135d64795c22 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 18:37:01 +0200 Subject: [PATCH 09/27] Upwards including joints done + libCCD + Demos + Halton --- .../test/java/org/ode4j/tests/CollisionTest.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java b/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java index 5646befe..fcd38f62 100644 --- a/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java +++ b/demo-cpp/src/test/java/org/ode4j/tests/CollisionTest.java @@ -28,6 +28,7 @@ import static org.ode4j.cpp.internal.ApiCppCollisionTrimesh.dCreateTriMesh; import static org.ode4j.cpp.internal.ApiCppCollisionTrimesh.dGeomTriMeshDataBuildSingle; import static org.ode4j.cpp.internal.ApiCppCollisionTrimesh.dGeomTriMeshDataCreate; +import static org.ode4j.demo.ConvexPrism.*; import static org.ode4j.ode.internal.Common.*; import static org.ode4j.tests.UnitTestPlusPlus.CheckMacros.*; @@ -182,19 +183,6 @@ public class CollisionTest extends TestSuperClass { dGeomHeightfieldDataDestroy(heightfieldData); } - - // Copied from ConvexRayCollisionTest - private final int prism_pointcount = 8; - private final int prism_planecount = 6; - private final double prism_points[] = { 10.0, 1.0, -1.0, 10.0, -1.0, -1.0, -10.0, -1.0, -1.0, -10.0, 1.0, -1.0, - 10.0, 1.0, 1.0, 10.0, -1.0, 1.0, -10.0, -1.0, 1.0, -10.0, 1.0, 1.0 }; - - private final int prism_polygons[] = { 4, 0, 1, 2, 3, 4, 4, 7, 6, 5, 4, 0, 4, 5, 1, 4, 1, 5, 6, 2, 4, 2, 6, 7, 3, 4, - 4, 0, 3, 7, }; - - private final double prism_planes[] = { 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 10.0, 0.0, -1.0, - 0.0, 1.0, -1.0, 0.0, -0.0, 10.0, 0.0, 1.0, 0.0, 1.0, }; - @Test public void test_collision_ray_convex() { From 6e36805baff0244a5ac22ed89c0c3270866984a8 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 19:30:22 +0200 Subject: [PATCH 10/27] Upwards including joints done + libCCD + Demos + Halton --- CHANGELOG.txt | 5 +- .../java/org/ode4j/ode/internal/DxBox.java | 2 +- .../ode4j/ode/internal/DxQuadTreeSpace.java | 50 ++++++++++++++----- .../main/java/org/ode4j/demo/DemoConvex.java | 37 ++++---------- 4 files changed, 51 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d49acac2..f86110ad 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -44,13 +44,16 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col ===== - Port updates until 0.16.2. THis includes some libCCD updates missing fro the 0.15.1 update. - TODO FIX prism dependency in ColliksionTest.test_collision_ray_convex() + New demo: DemoConvex. + TODO FIX prism dependency in CollisionTest.test_collision_ray_convex() Not ported: - resource_control.* - simple_cooperation.* - Updates to DxWorldProcessContext - threaded_solver.ldlt.h + TODO Check DemoFeedback + DONE: backwards up until quickstep.cpp - Added GutHub Actions CI builds for Java 8 and 9. [#95](https://github.com/tzaeschke/ode4j/pull/95) diff --git a/core/src/main/java/org/ode4j/ode/internal/DxBox.java b/core/src/main/java/org/ode4j/ode/internal/DxBox.java index cf468ffc..2e2a9c7c 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxBox.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxBox.java @@ -158,7 +158,7 @@ public double dGeomBoxPointDepth (double x, double y, double z) // if the point is inside all six sides double[] dist = new double[6]; - // TODO TZ remove comment after 16.3: ported from latest ODE (2023-04-05) + // TODO CHECK TZ remove comment after 16.3: ported from latest ODE (2023-04-05) boolean outside = false; double lastOuterOffset = 0; diff --git a/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java b/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java index 9f1fc587..de0514ba 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java @@ -25,9 +25,7 @@ package org.ode4j.ode.internal; import static org.ode4j.ode.OdeConstants.dInfinity; -import static org.ode4j.ode.internal.Common.dAASSERT; -import static org.ode4j.ode.internal.Common.dIASSERT; -import static org.ode4j.ode.internal.Common.dNextAfter; +import static org.ode4j.ode.internal.Common.*; import java.util.ArrayList; import java.util.List; @@ -295,15 +293,21 @@ void AddObject(DxGeom aObject){ //void Block::DelObject(dGeom Object){ void DelObject(DxGeom aObject){ // Del the geom - DxGeom g = mFirst; - DxGeom Last = null; - while (g!=null){ - if (g == aObject){ - if (Last!=null){ - Last.setNextEx( g.getNextEx() ); - } - else mFirst = g.getNextEx(); + DxGeom Last, g = mFirst; + boolean Found = false; + if (g == aObject){ + mFirst = g.getNextEx(); + Found = true; + } + else { + Last = g; + g = g.getNextEx(); + } + + for (; !Found && g != null; Found = false){ + if (g == aObject){ + Last.setNextEx( g.getNextEx() ); break; } Last = g; @@ -312,6 +316,26 @@ void DelObject(DxGeom aObject){ //XXX TZ aObject.tome = null; aObject._qtIdxEx = null; + // TODO CHECK TZ ????? + // dUASSERT((aObject.getNext() = 0, true), "Needed for an assertion check only"); + +// DxGeom g = mFirst; +// DxGeom Last = null; +// while (g!=null){ +// if (g == aObject){ +// if (Last!=null){ +// Last.setNextEx( g.getNextEx() ); +// } +// else mFirst = g.getNextEx(); +// +// break; +// } +// Last = g; +// g = g.getNextEx(); +// } +// +// //XXX TZ aObject.tome = null; +// aObject._qtIdxEx = null; // Now traverse upwards to tell that we have lost a geom @@ -481,7 +505,7 @@ public void DESTRUCTOR(){ void add(DxGeom g){ CHECK_NOT_LOCKED (this); //Common.dAASSERT(g); - Common.dUASSERT(g._qtIdxEx == null && g.getNextEx() == null, + dUASSERT(g._qtIdxEx == null && g.getNextEx() == null, "geom is already in a space"); DirtyList.add(g); @@ -497,7 +521,7 @@ void add(DxGeom g){ void remove(DxGeom g){ CHECK_NOT_LOCKED(this); //Common.dAASSERT(g); - Common.dUASSERT(g.parent_space == this,"object is not in this space"); + dUASSERT(g.parent_space == this,"object is not in this space"); // remove //TZ XXX ((Block*)g.tome).DelObject(g); diff --git a/demo/src/main/java/org/ode4j/demo/DemoConvex.java b/demo/src/main/java/org/ode4j/demo/DemoConvex.java index 058d7b19..1a2a5dbb 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoConvex.java +++ b/demo/src/main/java/org/ode4j/demo/DemoConvex.java @@ -34,20 +34,14 @@ import static org.ode4j.ode.internal.Common.M_PI; import static org.ode4j.demo.Halton235Geom.*; -/** Convex demo. +/** + * Convex demo. * Serves as a test for the convex geometry. * By Bram Stolk. */ public class DemoConvex extends DrawStuff.dsFunctions { - -//# #include "texturepath.h" - -// #include "halton235_geom.h" - - - -// Height at which we drop the composite block. + // Height at which we drop the composite block. private static final double H = 4.20; private static DWorld world; @@ -55,8 +49,8 @@ public class DemoConvex extends DrawStuff.dsFunctions { private static DBody mbody; - private static DBody[] hbody = new DBody[halton_numc ]; - private static DGeom[] hgeom = new DGeom[halton_numc ]; + private static final DBody[] hbody = new DBody[halton_numc ]; + private static final DGeom[] hgeom = new DGeom[halton_numc ]; private static DJointGroup contactgroup; @@ -64,7 +58,7 @@ public class DemoConvex extends DrawStuff.dsFunctions { private static boolean solidkernel = false; - private DGeom.DNearCallback nearCallback = new DGeom.DNearCallback() { + private final DGeom.DNearCallback nearCallback = new DGeom.DNearCallback() { @Override public void call(Object data, DGeom o1, DGeom o2) { nearCallback(data, o1, o2); @@ -112,25 +106,18 @@ private void nearCallback(Object data, DGeom o1, DGeom o2) { public void start() { //dAllocateODEDataForThread(dAllocateMaskAll); dsSetViewpoint(xyz, hpr); - System.err.printf("Press SPACE to reset the simulation.\n"); + System.err.println("Press SPACE to reset the simulation."); } - private static float[] xyz = { // [ 3] ={ + private static final float[] xyz = { // [ 3] ={ -8, 0, 5 }; - private static float[] hpr = { // [ 3] ={ + private static final float[] hpr = { // [ 3] ={ 0.0f, -29.5000f, 0.0000f }; private static void reset() { DQuaternion q = new DQuaternion(); - // TODO remove -// dQSetIdentity(q); -// dBodySetPosition(mbody, 0, 0, 0 + H); -// dBodySetQuaternion(mbody, q); -// dBodySetLinearVel(mbody, 0, 0, 0); -// dBodySetAngularVel(mbody, 0, 0, 0); -// dBodyEnable(mbody); q.setIdentity(); mbody.setPosition(0, 0, 0 + H); mbody.setQuaternion(q); @@ -140,12 +127,6 @@ private static void reset() { for (int i = 0; i < halton_numc; ++i) { DBody body = hbody[i]; if (body == null) continue; - // TODO remove -// dBodySetPosition(body, halton_pos[i][0], halton_pos[i][1], halton_pos[i][2] + H); -// dBodySetQuaternion(body, q); -// dBodySetLinearVel(body, 0, 0, 0); -// dBodySetAngularVel(body, 0, 0, 0); -// dBodyEnable(body); body.setPosition(halton_pos[i][0], halton_pos[i][1], halton_pos[i][2] + H); body.setQuaternion(q); body.setLinearVel(0, 0, 0); From 762baa3b0840916fe65efb8172d984031946fecf Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 19:31:40 +0200 Subject: [PATCH 11/27] Upwards including joints done + libCCD + Demos + Halton --- .../ode4j/ode/internal/DxQuadTreeSpace.java | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java b/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java index de0514ba..f80b2c09 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxQuadTreeSpace.java @@ -293,7 +293,7 @@ void AddObject(DxGeom aObject){ //void Block::DelObject(dGeom Object){ void DelObject(DxGeom aObject){ // Del the geom - DxGeom Last, g = mFirst; + DxGeom Last = null, g = mFirst; boolean Found = false; if (g == aObject){ @@ -319,25 +319,6 @@ void DelObject(DxGeom aObject){ // TODO CHECK TZ ????? // dUASSERT((aObject.getNext() = 0, true), "Needed for an assertion check only"); -// DxGeom g = mFirst; -// DxGeom Last = null; -// while (g!=null){ -// if (g == aObject){ -// if (Last!=null){ -// Last.setNextEx( g.getNextEx() ); -// } -// else mFirst = g.getNextEx(); -// -// break; -// } -// Last = g; -// g = g.getNextEx(); -// } -// -// //XXX TZ aObject.tome = null; -// aObject._qtIdxEx = null; - - // Now traverse upwards to tell that we have lost a geom Block Block = this; do{ From 51227c552661e747caac05e23c20b451dd07d123 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 3 May 2023 20:26:17 +0200 Subject: [PATCH 12/27] Upwards including joints done + libCCD + Demos + DxConvex --- CHANGELOG.txt | 4 +- .../java/org/ode4j/ode/internal/DxConvex.java | 234 ++++++++---------- .../org/ode4j/ode/internal/DxHashSpace.java | 11 +- .../ode4j/ode/internal/DxQuadTreeSpace.java | 3 +- .../org/ode4j/ode/internal/DxSAPSpace.java | 8 +- 5 files changed, 129 insertions(+), 131 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f86110ad..e5ef18ba 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -52,7 +52,9 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col - Updates to DxWorldProcessContext - threaded_solver.ldlt.h - TODO Check DemoFeedback + TODO + - Check DemoFeedback + - Remove CollideTrimeshBoxOld.java DONE: backwards up until quickstep.cpp diff --git a/core/src/main/java/org/ode4j/ode/internal/DxConvex.java b/core/src/main/java/org/ode4j/ode/internal/DxConvex.java index 7831cf4c..914b753d 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxConvex.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxConvex.java @@ -26,12 +26,9 @@ import static org.ode4j.ode.OdeConstants.CONTACTS_UNIMPORTANT; import static org.ode4j.ode.OdeConstants.dInfinity; -import static org.ode4j.ode.OdeMath.dCalcVectorCross3; -import static org.ode4j.ode.OdeMath.dCalcVectorDot3; -import static org.ode4j.ode.OdeMath.dMultiply0_331; -import static org.ode4j.ode.OdeMath.dMultiply1_331; -import static org.ode4j.ode.OdeMath.dNormalize3; +import static org.ode4j.ode.OdeMath.*; import static org.ode4j.ode.internal.Common.*; +import static org.ode4j.ode.internal.DxCollisionUtil.dVector3Copy; import static org.ode4j.ode.internal.cpp4j.Cmath.fabs; import static org.ode4j.ode.internal.cpp4j.Cstdio.fprintf; import static org.ode4j.ode.internal.cpp4j.Cstdio.stdout; @@ -437,7 +434,8 @@ void dGeomSetConvex (double[] planes, int planecount, * Returns Whether or not the segment ab intersects plane p. * @param a origin of the segment * @param b segment destination - * @param p plane to test for intersection + * @param pV plane to test for intersection - vector + * @param pD plane to test for intersection - depth * @param t returns the time "t" in the segment ray that gives us the intersecting * point * @param q returns the intersection point @@ -477,16 +475,16 @@ private static boolean IntersectSegmentPlane(DVector3 a, return false; } - /** - * Returns the Closest Point in Ray 1 to Ray 2. - * @param Origin1 The origin of Ray 1 - * @param Direction1 The direction of Ray 1 - * @param Origin1 The origin of Ray 2 - * @param Direction1 The direction of Ray 3 - * @param t the time "t" in Ray 1 that gives us the closest point - * (closest_point=Origin1+(Direction1*t). - * @return true if there is a closest point, false if the rays are paralell. - */ + // /** + // * Returns the Closest Point in Ray 1 to Ray 2. + // * @param Origin1 The origin of Ray 1 + // * @param Direction1 The direction of Ray 1 + // * @param Origin1 The origin of Ray 2 + // * @param Direction1 The direction of Ray 3 + // * @param t the time "t" in Ray 1 that gives us the closest point + // * (closest_point=Origin1+(Direction1*t). + // * @return true if there is a closest point, false if the rays are paralell. + // */ //inline bool ClosestPointInRay(final dVector3 Origin1, // final dVector3 Direction1, // final dVector3 Origin2, @@ -1465,10 +1463,7 @@ private static int TestConvexIntersection(DxConvex cvx1,DxConvex cvx2, int flags ccso.min_depth=dInfinity; // Min not min at all ccso.depth_type=0; // no type // precompute distance vector -// ccso.dist[0] = cvx2.final_posr.pos[0]-cvx1.final_posr.pos[0]; -// ccso.dist[1] = cvx2.final_posr.pos[1]-cvx1.final_posr.pos[1]; -// ccso.dist[2] = cvx2.final_posr.pos[2]-cvx1.final_posr.pos[2]; - ccso.dist.eqDiff(cvx2.final_posr().pos(), cvx1.final_posr().pos()); + dSubtractVectors3(ccso.dist, cvx2.final_posr().pos(), cvx1.final_posr().pos()); int maxc = flags & NUMC_MASK; dIASSERT(maxc != 0); DVector3 i1 = new DVector3(),i2 = new DVector3(), @@ -1514,10 +1509,7 @@ else if(!CheckSATConvexEdges(cvx1,cvx2,ccso)) //CollisionUtil.dVector3Copy(ccso.dist,dist); dist = new DVector3(ccso.dist); reference_side = GetSupportSide(dist,cvx1); -// dist[0]=-dist[0]; -// dist[1]=-dist[1]; -// dist[2]=-dist[2]; - dist.scale(-1); + dNegateVector3(dist); incident_side = GetSupportSide(dist,cvx2); pReferencePolyPos = 0;//cvx1.polygons; @@ -1591,22 +1583,28 @@ else if(!CheckSATConvexEdges(cvx1,cvx2,ccso)) d2 = r2.dot(planeV) - planeD; if(d1*d2<0) { + out = false; + // Edge intersects plane - IntersectSegmentPlane(r1,r2,planeV, planeD,t,p); - // Check the resulting point again to make sure it is inside the reference convex - out=false; - for(int k=0;k0) - { - out = true; - break; - }; + out = true; + } + + if (!out) { + out = false; + for (int k = 0; k < cvx1.planecount; ++k) { + // d = p[0]*cvx1.planes[(k*4)+0]+ + // p[1]*cvx1.planes[(k*4)+1]+ + // p[2]*cvx1.planes[(k*4)+2]- + // cvx1.planes[(k*4)+3]; + d = p.dot(cvx1.planesV[k]) - cvx1.planesD[k]; + if (d > 0) { + out = true; + break; + } + ; + } } if(!out) { @@ -1632,17 +1630,13 @@ else if(!CheckSATConvexEdges(cvx1,cvx2,ccso)) d = p.dot(rplaneV) - rplaneD; if(d>0) { - //dVector3Copy(p,SAFECONTACT(flags, contact, contacts, skip).pos); - //dVector3Copy(rplane,SAFECONTACT(flags, contact, contacts, skip).normal); - //SAFECONTACT(flags, contact, contacts, skip).g1=cvx1;//&cvx1; - //SAFECONTACT(flags, contact, contacts, skip).g2=cvx2;//&cvx2; - //SAFECONTACT(flags, contact, contacts, skip).depth=d; - DContactGeom contact = contactBuf.getSafe(flags, contacts); - contact.pos.set(p); - contact.normal.set(rplaneV); - contact.g1 = cvx1; - contact.g2 = cvx2; - contact.depth = d; + // SAFECONTACT(flags, contact, contacts, skip); + DContactGeom target = contactBuf.getSafe(flags, contacts); + dVector3Copy(p, target.pos); + dVector3Copy(rplaneV, target.normal); + target.g1 = cvx1; + target.g2 = cvx2; + target.depth = d; ++contacts; if (contacts==maxc) return contacts; } @@ -1661,17 +1655,13 @@ else if(!CheckSATConvexEdges(cvx1,cvx2,ccso)) d = i1.dot(rplaneV) - rplaneD; if(d>0) { - DContactGeom contact = contactBuf.getSafe(flags, contacts); - //dVector3Copy(i1,SAFECONTACT(flags, contact, contacts, skip).pos); - //dVector3Copy(rplane,SAFECONTACT(flags, contact, contacts, skip).normal); - //SAFECONTACT(flags, contact, contacts, skip).g1=cvx1;//&cvx1; - //SAFECONTACT(flags, contact, contacts, skip).g2=cvx2;//&cvx2; - //SAFECONTACT(flags, contact, contacts, skip).depth=d; - contact.pos.set(i1); - contact.normal.set(rplaneV); - contact.g1 = cvx1; - contact.g2 = cvx2; - contact.depth = d; + // dContactGeom *target = SAFECONTACT(flags, contact, contacts, skip); + DContactGeom target = contactBuf.getSafe(flags, contacts); + dVector3Copy(i1, target.pos); + dVector3Copy(rplaneV, target.normal); + target.g1 = cvx1; + target.g2 = cvx2; + target.depth = d; ++contacts; if (contacts==maxc) return contacts; } @@ -1739,10 +1729,9 @@ else if(!CheckSATConvexEdges(cvx1,cvx2,ccso)) outside = false; for(int j=0;j0) { - //dVector3Copy(i1,SAFECONTACT(flags, contact, contacts, skip).pos); - //dVector3Copy(rplane,SAFECONTACT(flags, contact, contacts, skip).normal); - //SAFECONTACT(flags, contact, contacts, skip).g1=cvx1;//&cvx1; - //SAFECONTACT(flags, contact, contacts, skip).g2=cvx2;//&cvx2; - //SAFECONTACT(flags, contact, contacts, skip).depth=d; - DContactGeom contact = contactBuf.getSafe(flags, contacts); - contact.pos.set(i1); - contact.normal.set(rplaneV); - contact.g1 = cvx1; - contact.g2 = cvx2; - contact.depth = d; + // dContactGeom *target = SAFECONTACT(flags, contact, contacts, skip); + DContactGeom target = contactBuf.getSafe(flags, contacts); + dVector3Copy(i1, target.pos); + dVector3Copy(rplaneV, target.normal); + target.g1 = cvx1; + target.g2 = cvx2; + target.depth = d; ++contacts; if (contacts==maxc) return contacts; } @@ -1774,51 +1759,38 @@ else if(!CheckSATConvexEdges(cvx1,cvx2,ccso)) } } } - else if(ccso.depth_type==2) // edge-edge + else if (ccso.depth_type == 2) // edge-edge { -// // Some parts borrowed from dBoxBox -// DVector3 ua = new DVector3(),ub = new DVector3(),pa = new DVector3(),pb = new DVector3(); -// RefDouble alpha=new RefDouble(),beta=new RefDouble(); -// // Get direction of first edge -// //for (i=0; i<3; i++) ua[i] = ccso.e1b[i]-ccso.e1a[i]; -// ua.eqDiff(ccso.e1b, ccso.e1a); -// dNormalize3(ua); // normalization shouldn't be necesary but dLineClosestApproach requires it -// // Get direction of second edge -// //for (i=0; i<3; i++) ub[i] = ccso.e2b[i]-ccso.e2a[i]; -// ub.eqDiff(ccso.e2b, ccso.e2a); -// dNormalize3(ub); // same as with ua normalization -// // Get closest points between edges (one at each) -// DxCollisionUtil.dLineClosestApproach (ccso.e1a,ua,ccso.e2a,ub,alpha,beta); -// //for (i=0; i<3; i++) pa[i] = ccso.e1a[i]+(ua[i]*alpha.get()); -// pa.eqSum(ccso.e1a, ua, alpha.get()); -// //for (i=0; i<3; i++) pb[i] = ccso.e2a[i]+(ub[i]*beta.get()); -// pb.eqSum(ccso.e2a, ub, beta.get()); -// // Set the contact point as halfway between the 2 closest points -//// for (i=0; i<3; i++) SAFECONTACT(flags, contact, contacts, skip).pos[i] = REAL(0.5)*(pa[i]+pb[i]); -//// SAFECONTACT(flags, contact, contacts, skip).g1=cvx1;//&cvx1; -//// SAFECONTACT(flags, contact, contacts, skip).g2=cvx2;//&cvx2; -//// dVector3Copy(ccso.plane,SAFECONTACT(flags, contact, contacts, skip).normal); -//// SAFECONTACT(flags, contact, contacts, skip).depth=ccso.min_depth; -// DContactGeom contact = contactBuf.getSafe(flags, contacts); -// contact.pos.eqSum(pa, 0.5, pb, 0.5); -// contact.g1 = cvx1; -// contact.g2 = cvx2; -// //TODO TZ optimize with dVector3! -// contact.normal.set(ccso.plane.get0(), ccso.plane.get1(), ccso.plane.get2()); -// contact.depth = ccso.min_depth; -// ++contacts; - DVector3 c1 = new DVector3(), c2 = new DVector3(); - DContactGeom contact = contactBuf.getSafe(flags, contacts); - //SAFECONTACT(flags, contact, contacts, skip)->depth = - contact.depth = dSqrt(ClosestPointBetweenSegments(ccso.e1a,ccso.e1b,ccso.e2a,ccso.e2b,c1,c2)); - contact.g1=cvx1; - contact.g2=cvx2; - //dVector3Copy(c1,SAFECONTACT(flags, contact, contacts, skip)->pos); - contact.pos.set( c1 ); - contact.normal.eqDiff(c2, c1); - contact.normal.normalize(); - //dNormalize3(SAFECONTACT(flags, contact, contacts, skip)->normal); + ClosestPointBetweenSegments(ccso.e1a, ccso.e1b, ccso.e2a, ccso.e2b, c1, c2); + + // dContactGeom *target = SAFECONTACT(flags, contact, contacts, skip); + DContactGeom target = contactBuf.getSafe(flags, contacts); + dSubtractVectors3(target.normal, c2, c1); + double depth_square = dCalcVectorLengthSquare3(target.normal); + + if (dxSafeNormalize3(target.normal)) + { + target.depth = dSqrt(depth_square); + } + else + { + // If edges coincide return direction from one center to the other as the contact normal + dVector3Copy(ccso.dist, target.normal); + + if (!dxSafeNormalize3(target.normal)) + { + // If the both centers coincide as well return an arbitrary vector. The depth is going to be zero anyway. + // dAssignVector3(target.normal, 1, 0, 0); + target.normal.set(1, 0, 0); + } + + target.depth = 0; // Since the edges coincide, return a contact of zero depth + } + + target.g1 = cvx1; + target.g2 = cvx2; + dVector3Copy(c1, target.pos); contacts++; } return contacts; @@ -1936,17 +1908,31 @@ int dCollideRayConvex( DxRay ray, DxConvex convex, contact.side2 = -1; // TODO: set plane index? double alpha, beta, nsign; + boolean flag = false; // // Compute some useful info // - - DVector3 ray_pos = new DVector3(); - DVector3 ray_dir = new DVector3(); - dMultiply1_331(ray_pos, convex.final_posr().R(), new DVector3(ray.final_posr().pos()).sub(convex.final_posr().pos())); - dMultiply1_331(ray_dir, convex.final_posr().R(), ray.final_posr().R().columnAsNewVector(2)); - boolean flag = false; + // dVector3 ray_pos = { + // ray->final_posr->pos[0] - convex->final_posr->pos[0], + // ray->final_posr->pos[1] - convex->final_posr->pos[1], + // ray->final_posr->pos[2] - convex->final_posr->pos[2] + // }; + DVector3 ray_pos = new DVector3(ray.final_posr().pos()).sub(convex.final_posr().pos()); + // + // dVector3 ray_dir = { + // ray->final_posr->R[0 * 4 + 2], + // ray->final_posr->R[1 * 4 + 2], + // ray->final_posr->R[2 * 4 + 2] + // }; + DVector3 ray_dir = ray.final_posr().R().columnAsNewVector(2); + + //dMultiply1_331(ray_pos, convex->final_posr->R, ray_pos); + //dMultiply1_331(ray_dir, convex->final_posr->R, ray_dir); + dMultiply1_331(ray_pos, convex.final_posr().R(), ray_pos); + dMultiply1_331(ray_dir, convex.final_posr().R(), ray_dir); + for ( int i = 0; i < convex.planecount; ++i ) { // Alias this plane. diff --git a/core/src/main/java/org/ode4j/ode/internal/DxHashSpace.java b/core/src/main/java/org/ode4j/ode/internal/DxHashSpace.java index e9cf874e..5c524cde 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxHashSpace.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxHashSpace.java @@ -226,12 +226,15 @@ public void collide (Object data, DNearCallback callback) aabb.level = level; if (level > maxlevel) maxlevel = level; // cellsize = 2^level - double cellSizeRecip = dRecip(ldexp(1.0, level)); - // discretize AABB position to cell size + double cellSizeRecip = dRecip(ldexp(1.0, level)); // No computational errors here! // discretize AABB position to cell size for (i=0; i < 3; i++) { - aabb.dbounds[2*i] = (int)Math.floor (geom._aabb.getMin(i) * cellSizeRecip); - aabb.dbounds[2*i+1] = (int)Math.floor (geom._aabb.getMax(i) * cellSizeRecip); + double aabbBoundMin = Math.floor (geom._aabb.getMin(i) * cellSizeRecip); // No computational errors so far! + double aabbBoundMax = Math.floor (geom._aabb.getMax(i) * cellSizeRecip); // No computational errors so far! + dICHECK(aabbBoundMin >= Integer.MIN_VALUE && aabbBoundMin = Integer.MIN_VALUE && aabbBoundMax tome_ex = 0; + g._qtIdxEx = null; + // dUASSERT((g->next_ex = 0, true), "Needed for an assertion check only"); + g.setNextEx(null); + dUASSERT(true, "Needed for an assertion check only"); + super.remove(g); } From 46700747f463ef7814054f93ca92a61a799afa2b Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Thu, 4 May 2023 20:01:22 +0200 Subject: [PATCH 13/27] Everything done except quicklstep and the stuff listed in CHANGELOG --- CHANGELOG.txt | 6 ++ .../java/org/ode4j/ode/internal/FastDot.java | 4 +- .../java/org/ode4j/ode/internal/Matrix.java | 55 ++----------------- .../ode4j/ode/internal/joints/DxJoint.java | 2 +- 4 files changed, 15 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e5ef18ba..74606d9c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -51,6 +51,12 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col - simple_cooperation.* - Updates to DxWorldProcessContext - threaded_solver.ldlt.h + - fastldlt.c -> cpp + fastldltfactor / fastldldvolve + - fastlsolve.c -> cpp + x + - fastltsolve.c -> cpp + fastvecscale + - gimpact_contact_export.* / gimpact_*_contact_accessor.* + - lcp.cpp/.h ------------------------? + - objects.h/.cpp / obstack.h/.cpp TODO - Check DemoFeedback diff --git a/core/src/main/java/org/ode4j/ode/internal/FastDot.java b/core/src/main/java/org/ode4j/ode/internal/FastDot.java index b5adb40a..e7b4e643 100644 --- a/core/src/main/java/org/ode4j/ode/internal/FastDot.java +++ b/core/src/main/java/org/ode4j/ode/internal/FastDot.java @@ -103,7 +103,8 @@ public static double dDot (final double[] a, int aOfs, } //template - public static double dxtDot (final double[] a, int a_pos, final double[] b, int b_pos, int n, int b_stride) + public static double calculateLargeVectorDot ( + final double[] a, int a_pos, final double[] b, int b_pos, int n, final int b_stride) { double sum = 0; int a_end = a_pos + (n & (int)(~3)); @@ -122,5 +123,4 @@ public static double dxtDot (final double[] a, int a_pos, final double[] b, int } return sum; } - } \ No newline at end of file diff --git a/core/src/main/java/org/ode4j/ode/internal/Matrix.java b/core/src/main/java/org/ode4j/ode/internal/Matrix.java index 814f8036..68e85aa6 100644 --- a/core/src/main/java/org/ode4j/ode/internal/Matrix.java +++ b/core/src/main/java/org/ode4j/ode/internal/Matrix.java @@ -348,8 +348,7 @@ public static void dMultiply1(double[] A, final double[] B, * @param B B * @param C C */ - public static void dMultiply2(DMatrix3 A, final DMatrix3C B, - final DMatrix3C C) { + public static void dMultiply2(DMatrix3 A, final DMatrix3C B, final DMatrix3C C) { //dMultiply2(A.v, ((DMatrix3) B).v, ((DMatrix3) C).v, 3, 3, 3); dMultiply0(A, B, C.reTranspose()); } @@ -368,8 +367,7 @@ public static void dMultiply2(DMatrix3 A, final DMatrix3C B, * @param B B * @param C C */ - public static void dMultiply2(DVector3 A, final DMatrix3C B, - final DVector3C C) { + public static void dMultiply2(DVector3 A, final DMatrix3C B, final DVector3C C) { //dMultiply2(A.v, ((DMatrix3) B).v, ((DVector3) C).v, 3, 3, 1); //TZ: this is equal to dMultiply0(...) !!! A.set0( B.get00()*C.get0() + B.get01()*C.get1() + B.get02()*C.get2() ); @@ -393,8 +391,7 @@ public static void dMultiply2(DVector3 A, final DMatrix3C B, * @param r r * */ - public static void dMultiply2(double[] A, final double[] B, - final double[] C, int p, int q, int r) { + public static void dMultiply2(double[] A, final double[] B, final double[] C, int p, int q, int r) { dAASSERT(p > 0 && q > 0 && r > 0); final int rskip = dPAD(r); final int qskip = dPAD(q); @@ -412,37 +409,6 @@ public static void dMultiply2(double[] A, final double[] B, A[a] = sum;//(*a) = sum; } } - //TODO remove is from 0.11.1 -// int i, j, k, z, rpad, qskip; -// double sum; -// // final double[] bb,cc; -// // TZ: -// int aPos = 0, bPos, cPos; -// // dAASSERT (A, B , C); -// dAASSERT(p > 0 && q > 0 && r > 0); -// rpad = dPAD(r) - r; -// qskip = dPAD(q); -// // bb = B; -// bPos = 0; -// for (i = p; i > 0; i--) { -// // cc = C; -// cPos = 0; -// for (j = r; j > 0; j--) { -// z = 0; -// sum = 0; -// // for (k=q; k>0; k--,z++) sum += bb[z] * cc[z]; -// for (k = q; k > 0; k--, z++) -// sum += B[bPos + z] * C[cPos + z]; -// // *(A++) = sum; -// A[aPos++] = sum; -// // cc += qskip; -// cPos += qskip; -// } -// // A += rpad; -// aPos += rpad; -// // bb += qskip; -// bPos += qskip; -// } } /** @@ -713,19 +679,8 @@ public static boolean dIsPositiveDefinite(DMatrix3C A) { return dFactorCholesky(A.clone()); } -// /** -// * this has been replaced by a faster version void dSolveL1T (const double -// * *L, double *b, int n, int nskip) { int i,j; dAASSERT (L && b && n >= 0 && -// * nskip >= n); double sum; for (i=n-2; i>=0; i--) { sum = 0; for (j=i+1; -// * j // void dxtSolveLDLT (const dReal *L, const dReal *d, dReal *b, unsigned rowCount, unsigned rowSkip) public static void dxtSolveLDLT(final double[] L, double[] dArray, int dPos, double[] bArray, int bPos, int rowCount, int rowSkip, int d_stride, int b_stride) { diff --git a/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java b/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java index fa630bca..5c623322 100644 --- a/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java +++ b/core/src/main/java/org/ode4j/ode/internal/joints/DxJoint.java @@ -786,7 +786,7 @@ public void dJointAttach (DBody b1, DBody b2) // check if the joint can not be attached to just one body dUASSERT (!((flags & dJOINT_TWOBODIES) != 0 && - ((body1 != null) ^ (body2 != null))), + ((body1 != null) != (body2 != null))), "joint can not be attached to just one body"); // remove any existing body attachments From b64265d7ab52b0f336460b2acdc38a2f646a80c7 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Thu, 4 May 2023 20:11:57 +0200 Subject: [PATCH 14/27] Everything done except quicklstep and the stuff listed in CHANGELOG --- core/src/main/java/org/ode4j/ode/internal/DLCP.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/DLCP.java b/core/src/main/java/org/ode4j/ode/internal/DLCP.java index 8635bb81..bd265f31 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DLCP.java +++ b/core/src/main/java/org/ode4j/ode/internal/DLCP.java @@ -373,8 +373,12 @@ static int estimate_transfer_i_from_C_to_N_mem_req(int nC, int nskip) { private int indexC (int i) { return i; } private int indexN (int i) { return i+m_nC; } private double Aii (int i) { return AROW(i,i); } - private double AiC_times_qC (int i, double[] qA, int qP, int q_stride) { return dxtDot (m_A, AROWp(i), qA, qP, m_nC, q_stride); } - private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) { return dxtDot (m_A,AROWp(i) + m_nC, qA, qP + m_nC * q_stride, m_nN, q_stride); } + private double AiC_times_qC (int i, double[] qA, int qP, int q_stride) { + return calculateLargeVectorDot (m_A, AROWp(i), qA, qP, m_nC, q_stride); + } + private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) { + return calculateLargeVectorDot (m_A,AROWp(i) + m_nC, qA, qP + m_nC * q_stride, m_nN, q_stride); + } // void pN_equals_ANC_times_qC (dReal *p, dReal *q); // void pN_plusequals_ANi (dReal *p, int i, int sign=1); // private void pC_plusequals_s_times_qC (double[] p, double s, double[] q) From d3f4a3761336f21319a5b89fdfd513de213eb0e0 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 5 May 2023 13:10:58 +0200 Subject: [PATCH 15/27] Everything done except quicklstep and the stuff listed in CHANGELOG --- CHANGELOG.txt | 20 +++----------------- TODO.txt | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 74606d9c..99934873 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -17,7 +17,7 @@ TODO for 0.5.0 - "Split package, multiple jars provide the same package" - [WARNING] bootstrap class path not set in conjunction with -source 8 when using: mvn clean install -P on-jdk-9-plus -- CI: Fail build on warnbing?! +- CI: Fail build on warning?! - CI: remove "temurin"...?! @@ -43,26 +43,12 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col 0.5.0 (unreleased) ===== - Port updates until 0.16.2. - THis includes some libCCD updates missing fro the 0.15.1 update. - New demo: DemoConvex. - TODO FIX prism dependency in CollisionTest.test_collision_ray_convex() - Not ported: - - resource_control.* - - simple_cooperation.* - - Updates to DxWorldProcessContext - - threaded_solver.ldlt.h - - fastldlt.c -> cpp + fastldltfactor / fastldldvolve - - fastlsolve.c -> cpp + x - - fastltsolve.c -> cpp + fastvecscale - - gimpact_contact_export.* / gimpact_*_contact_accessor.* - - lcp.cpp/.h ------------------------? - - objects.h/.cpp / obstack.h/.cpp - + This includes some libCCD updates missing fro the 0.15.1 update. TODO - Check DemoFeedback - Remove CollideTrimeshBoxOld.java - DONE: backwards up until quickstep.cpp + DONE: all Except listed in TODO.txt and quickstep.cpp - Added GutHub Actions CI builds for Java 8 and 9. [#95](https://github.com/tzaeschke/ode4j/pull/95) - Added default logger for demos and tests. [#94](https://github.com/tzaeschke/ode4j/pull/94) diff --git a/TODO.txt b/TODO.txt index 44545f6d..ca21bf6d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -5,6 +5,22 @@ mvn versions:display-dependency-updates mvn versions:display-plugin-updates +Things left out for 0.5.0 (missing from 0.15.1 vs 0.16.2) +========================================================= + Not ported: + - resource_control.* + - simple_cooperation.* + - Updates to DxWorldProcessContext + - threaded_solver.ldlt.h + - fastldlt.c -> cpp + fastldltfactor / fastldldvolve + - fastlsolve.c -> cpp + x + - fastltsolve.c -> cpp + fastvecscale + - gimpact_contact_export.* / gimpact_*_contact_accessor.* + - lcp.cpp/.h ------------------------? + - objects.h/.cpp / obstack.h/.cpp + + + Java Version ============ From eb28ae17b3c8bd560b55c7daac99c706d562a37b Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 5 May 2023 13:28:54 +0200 Subject: [PATCH 16/27] Everything done except quicklstep and the stuff listed in CHANGELOG --- .../src/main/java/org/ode4j/ode/internal/ErrorHdl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/ErrorHdl.java b/core/src/main/java/org/ode4j/ode/internal/ErrorHdl.java index 376591b7..9a1ed091 100644 --- a/core/src/main/java/org/ode4j/ode/internal/ErrorHdl.java +++ b/core/src/main/java/org/ode4j/ode/internal/ErrorHdl.java @@ -119,10 +119,11 @@ public static void dError (int num, String msg, Object ... ap) { // va_start (ap,msg); if (error_function != null) { error_function.call (num,msg,ap); - } - logger.error("ODE Error " + num + ": " + msg, ap); + } else { + logger.error("ODE Error " + num + ": " + msg, ap); + } throw new RuntimeException("#"+num + ": " + msg); - //System.exit (1); + //exit (1); } @@ -137,8 +138,9 @@ public static void dDebug (int num, String msg, Object ... ap) { // va_start (ap,msg); if (debug_function != null) { debug_function.call (num,msg,ap); + } else { + logger.debug("ODE INTERNAL ERROR " + " " + num + ": " + msg, ap); } - logger.debug("ODE INTERNAL ERROR " + " " + num + ": " + msg, ap); // *((char *)0) = 0; ... commit SEGVicide //abort(); throw new RuntimeException("#"+num + ": " + String.format(msg, ap)); From e9ffbf86cb4673b0cdebb77841e58e355a9a48e2 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 5 May 2023 15:55:04 +0200 Subject: [PATCH 17/27] Everything done except quicklstep and the stuff listed in TODO --- TODO.txt | 14 +- .../ode/internal/CollideTrimeshTrimesh.java | 2 +- .../java/org/ode4j/ode/internal/DLCP.java | 430 +++++++++--------- .../org/ode4j/ode/internal/FastLSolve.java | 2 +- 4 files changed, 219 insertions(+), 229 deletions(-) diff --git a/TODO.txt b/TODO.txt index ca21bf6d..9f74ba6b 100644 --- a/TODO.txt +++ b/TODO.txt @@ -13,21 +13,15 @@ Things left out for 0.5.0 (missing from 0.15.1 vs 0.16.2) - Updates to DxWorldProcessContext - threaded_solver.ldlt.h - fastldlt.c -> cpp + fastldltfactor / fastldldvolve - - fastlsolve.c -> cpp + x + - fastlsolve.c -> cpp + x: solveL1Straight() is done; Missing: ThreadedEquationSolverLDLT* and *Cooperative* - fastltsolve.c -> cpp + fastvecscale - - gimpact_contact_export.* / gimpact_*_contact_accessor.* - - lcp.cpp/.h ------------------------? - objects.h/.cpp / obstack.h/.cpp - - Java Version ============ - We should aim for Oreo or later (Android 8.0, released 2017, API Level 26: https://apilevels.com/) -- Java 8 should be fine. -- Try animal-sniffer plugin for higher versions, e.g. Java 9 - More accurate (respects desugaring by D8): https://github.com/open-toast/gummy-bears +- We use animal-sniffer (respects desugaring by D8): https://github.com/open-toast/gummy-bears - Android Runtime replaced Dalvik as default Runtime in Android 5: https://en.wikipedia.org/wiki/Android_version_history - Android 8 (Oreo) is about 8% share: @@ -40,9 +34,6 @@ Java Version - Android 11 support "up to" Java 13 (Question: complete 13 or partial 13??) - 2018: https://jakewharton.com/androids-java-9-10-11-and-12-support/ -- Java 8 support: https://developer.android.com/studio/write/java8-support-table -- Java 8 support details: https://developer.android.com/studio/write/java8-support - MArch 2023: General cleanup: @@ -52,7 +43,6 @@ General cleanup: - update DVector3 safeNormalize to use max() and then compare to 0. ALso see: https://github.com/JOML-CI/JOML/issues/66 - replace DVector3.clone() with dVector3.re() or copy() - reformat everything? At least indentation? -- CI builds July 6th 2009: diff --git a/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshTrimesh.java b/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshTrimesh.java index 2819f2ac..c91f1c80 100644 --- a/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshTrimesh.java +++ b/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshTrimesh.java @@ -96,7 +96,7 @@ int dCollideTTL(DxGeom g1, DxGeom g2, int Flags, DContactGeomBuffer Contacts, in trimeshContacts.GIM_DYNARRAY_DESTROY(); - // TODO remove this, #22 has been resolved + // TODO CHECK-TZ remove this, #22 has been resolved int contactcount = trimeshContacts.size(); int maxcontacts = Flags & NUMC_MASK; if (contactcount > maxcontacts) diff --git a/core/src/main/java/org/ode4j/ode/internal/DLCP.java b/core/src/main/java/org/ode4j/ode/internal/DLCP.java index bd265f31..0fa2d64a 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DLCP.java +++ b/core/src/main/java/org/ode4j/ode/internal/DLCP.java @@ -30,6 +30,7 @@ import static org.ode4j.ode.internal.ErrorHandler.dDebug; import static org.ode4j.ode.internal.ErrorHandler.dMessage; import static org.ode4j.ode.internal.FastLDLT.dxtFactorLDLT; +import static org.ode4j.ode.internal.FastLSolve.solveL1Straight; import static org.ode4j.ode.internal.Matrix.*; import static org.ode4j.ode.internal.Misc.dClearUpperTriangle; import static org.ode4j.ode.internal.Misc.dMakeRandomMatrix; @@ -205,7 +206,7 @@ public class DLCP { //#define DEBUG_LCP //#define dLCP_FAST // use fast dLCP object - //private static final boolean dLCP_FAST = true; + private static final boolean dLCP_FAST = true; //#define NUB_OPTIMIZATIONS protected static final boolean NUB_OPTIMIZATIONS = true; @@ -262,9 +263,196 @@ static void transfer_b_to_x(double[] pairsbxA, int pairsbxP, int n, boolean zero } } + /** + * swap row/column i1 with i2 in the n*n matrix A. the leading dimension of + * A is nskip. this only references and swaps the lower triangle. + * if `do_fast_row_swaps' is nonzero and row pointers are being used, then + * rows will be swapped by exchanging row pointers. otherwise the data will + * be copied. + */ + private static void swapRowsAndCols (double[] A, int n, int i1, int i2, int nskip, + boolean do_fast_row_swaps) + { + //dAASSERT (A); + dAASSERT (n > 0 && i1 >= 0 && i2 >= 0 && i1 < n && i2 < n && + nskip >= n && i1 < i2); + + if (ROWPTRS) {//# ifdef ROWPTRS +// dReal *A_i1 = A[i1]; +// dReal *A_i2 = A[i2]; +// for (int i=i1+1; i0 && i1 < n && i2 < n && nskip >= n && i1 <= i2); + + if (i1 != i2) { + swapRowsAndCols (A, n, i1, i2, nskip, do_fast_row_swaps); + +// dxSwap((pairsbx + (size_t)i1 * PBX__MAX)[PBX_B], (pairsbx + (size_t)i2 * PBX__MAX)[PBX_B]); +// dxSwap((pairsbx + (size_t)i1 * PBX__MAX)[PBX_X], (pairsbx + (size_t)i2 * PBX__MAX)[PBX_X]); +// dSASSERT(PBX__MAX == 2); + dxSwap(pairsbxA, pairsbxP + i1 * PBX__MAX + PBX_B, pairsbxA, pairsbxP + i2 * PBX__MAX + PBX_B); + dxSwap(pairsbxA, pairsbxP + i1 * PBX__MAX + PBX_X, pairsbxA, pairsbxP + i2 * PBX__MAX + PBX_X); + dSASSERT(PBX__MAX == 2); + + dxSwap(w, i1, w, i2); + +// dxSwap((pairslh + (size_t)i1 * PLH__MAX)[PLH_LO], (pairslh + (size_t)i2 * PLH__MAX)[PLH_LO]); +// dxSwap((pairslh + (size_t)i1 * PLH__MAX)[PLH_HI], (pairslh + (size_t)i2 * PLH__MAX)[PLH_HI]); +// dSASSERT(PLH__MAX == 2); + dxSwap(pairslhA, pairslhP + i1 * PLH__MAX + PLH_LO, pairslhA, pairslhP + i2 * PLH__MAX + PLH_LO); + dxSwap(pairslhA, pairslhP + i1 * PLH__MAX + PLH_HI, pairslhA, pairslhP + i2 * PLH__MAX + PLH_HI); + dSASSERT(PLH__MAX == 2); + + dxSwap(p, i1, p, i2); + dxSwap(state, i1, state, i2); + + if (findex != null) { + dxSwap(findex, i1, findex, i2); + } + } + } + + + // for debugging - check that L,d is the factorization of A[C,C]. + // A[C,C] has size nC*nC and leading dimension nskip. + // L has size nC*nC and leading dimension nskip. + // d has size nC. + + //#ifdef DEBUG_LCP -> TZ see first 'return' + + //static void checkFactorization (ATYPE A, dReal *_L, dReal *_d, + // int nC, int *C, int nskip) + protected void checkFactorization (double[] A, double[]_L, double[]_d, + int nC, int[] C, int nskip) + { + if (!DEBUG_LCP) return; + int i,j; + if (nC==0) return; + + // get A1=A, copy the lower triangle to the upper triangle, get A2=A[C,C] + DMatrixN A1 = new DMatrixN(nC,nC); + for (i=0; i 1e-8) + dDebug (0,"L*D*L' check, maximum difference = %.6e\n",diff); + } + + //#endif + + + // for debugging + + //#ifdef DEBUG_LCP -> TZ see first 'return' + + //static void checkPermutations (int i, int n, int nC, int nN, int *p, int *C) + protected static void checkPermutations (int i, int n, int nC, int nN, + int[] p, int[] C) + { + if (!DEBUG_LCP) return; + int j,k; + dIASSERT(/*nC>=0 && nN>=0 &&*/ (nC + nN) == i && i < n); + for (k=0; k= 0 && p[k] < i); + for (k=i; k(m_pairsbx + PBX_X, m_n); dxtSetZero(m_pairsbxA, 0 + PBX_X, m_n, PBX__MAX); @@ -589,7 +774,7 @@ void transfer_i_from_N_to_C (int i) for (int j=0; j= lo[i] && xi <= hi[i] && wi == 0) { return 1; } - - /** - * swap row/column i1 with i2 in the n*n matrix A. the leading dimension of - * A is nskip. this only references and swaps the lower triangle. - * if `do_fast_row_swaps' is nonzero and row pointers are being used, then - * rows will be swapped by exchanging row pointers. otherwise the data will - * be copied. - */ - private static void swapRowsAndCols (double[] A, int n, int i1, int i2, int nskip, - boolean do_fast_row_swaps) - { - //dAASSERT (A); - dAASSERT (n > 0 && i1 >= 0 && i2 >= 0 && i1 < n && i2 < n && - nskip >= n && i1 < i2); - - if (ROWPTRS) {//# ifdef ROWPTRS -// dReal *A_i1 = A[i1]; -// dReal *A_i2 = A[i2]; -// for (int i=i1+1; i0 && i1 < n && i2 < n && nskip >= n && i1 <= i2); - - if (i1 != i2) { - swapRowsAndCols (A, n, i1, i2, nskip, do_fast_row_swaps); - -// dxSwap((pairsbx + (size_t)i1 * PBX__MAX)[PBX_B], (pairsbx + (size_t)i2 * PBX__MAX)[PBX_B]); -// dxSwap((pairsbx + (size_t)i1 * PBX__MAX)[PBX_X], (pairsbx + (size_t)i2 * PBX__MAX)[PBX_X]); -// dSASSERT(PBX__MAX == 2); - dxSwap(pairsbxA, pairsbxP + i1 * PBX__MAX + PBX_B, pairsbxA, pairsbxP + i2 * PBX__MAX + PBX_B); - dxSwap(pairsbxA, pairsbxP + i1 * PBX__MAX + PBX_X, pairsbxA, pairsbxP + i2 * PBX__MAX + PBX_X); - dSASSERT(PBX__MAX == 2); - - dxSwap(w, i1, w, i2); - -// dxSwap((pairslh + (size_t)i1 * PLH__MAX)[PLH_LO], (pairslh + (size_t)i2 * PLH__MAX)[PLH_LO]); -// dxSwap((pairslh + (size_t)i1 * PLH__MAX)[PLH_HI], (pairslh + (size_t)i2 * PLH__MAX)[PLH_HI]); -// dSASSERT(PLH__MAX == 2); - dxSwap(pairslhA, pairslhP + i1 * PLH__MAX + PLH_LO, pairslhA, pairslhP + i2 * PLH__MAX + PLH_LO); - dxSwap(pairslhA, pairslhP + i1 * PLH__MAX + PLH_HI, pairslhA, pairslhP + i2 * PLH__MAX + PLH_HI); - dSASSERT(PLH__MAX == 2); - - dxSwap(p, i1, p, i2); - dxSwap(state, i1, state, i2); - - if (findex != null) { - dxSwap(findex, i1, findex, i2); - } - } - } - - - // for debugging - check that L,d is the factorization of A[C,C]. - // A[C,C] has size nC*nC and leading dimension nskip. - // L has size nC*nC and leading dimension nskip. - // d has size nC. - - //#ifdef DEBUG_LCP -> TZ see first 'return' - - //static void checkFactorization (ATYPE A, dReal *_L, dReal *_d, - // int nC, int *C, int nskip) - protected void checkFactorization (double[] A, double[]_L, double[]_d, - int nC, int[] C, int nskip) - { - if (!DEBUG_LCP) return; - int i,j; - if (nC==0) return; - - // get A1=A, copy the lower triangle to the upper triangle, get A2=A[C,C] - DMatrixN A1 = new DMatrixN(nC,nC); - for (i=0; i 1e-8) - dDebug (0,"L*D*L' check, maximum difference = %.6e\n",diff); - } - - //#endif - - - // for debugging - - //#ifdef DEBUG_LCP -> TZ see first 'return' - - //static void checkPermutations (int i, int n, int nC, int nN, int *p, int *C) - protected static void checkPermutations (int i, int n, int nC, int nN, - int[] p, int[] C) - { - if (!DEBUG_LCP) return; - int j,k; - dIASSERT(/*nC>=0 && nN>=0 &&*/ (nC + nN) == i && i < n); - for (k=0; k= 0 && p[k] < i); - for (k=i; k - public static void dxtSolveL1 (final double[] L, double[] B, final int BPos, int rowCount, int rowSkip, int b_stride) + public static void solveL1Straight (final double[] L, double[] B, final int BPos, int rowCount, int rowSkip, int b_stride) { int LPos = 0; dIASSERT(rowCount != 0); From b05997e39eaeb3f85298c7a6a1414a782ce98c11 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Fri, 5 May 2023 18:49:46 +0200 Subject: [PATCH 18/27] Everything done except quicklstep and the stuff listed in TODO --- CHANGELOG.txt | 2 + TODO.txt | 9 +- core/src/main/java/org/ode4j/ode/DMatrix.java | 17 ++- .../java/org/ode4j/ode/internal/DLCP.java | 16 +-- .../{FastLDLT.java => FastLDLTFactor.java} | 28 ++--- .../org/ode4j/ode/internal/FastLDLTSolve.java | 53 +++++++++ .../org/ode4j/ode/internal/FastLSolve.java | 2 +- .../org/ode4j/ode/internal/FastLTSolve.java | 2 +- .../org/ode4j/ode/internal/FastVecScale.java | 89 +++++++++++++++ .../java/org/ode4j/ode/internal/Matrix.java | 104 ++---------------- 10 files changed, 202 insertions(+), 120 deletions(-) rename core/src/main/java/org/ode4j/ode/internal/{FastLDLT.java => FastLDLTFactor.java} (94%) create mode 100644 core/src/main/java/org/ode4j/ode/internal/FastLDLTSolve.java create mode 100644 core/src/main/java/org/ode4j/ode/internal/FastVecScale.java diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 99934873..8d79de5a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -44,9 +44,11 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col ===== - Port updates until 0.16.2. This includes some libCCD updates missing fro the 0.15.1 update. + TODO - Check DemoFeedback - Remove CollideTrimeshBoxOld.java + - Remove all "dxt" stuff DONE: all Except listed in TODO.txt and quickstep.cpp diff --git a/TODO.txt b/TODO.txt index 9f74ba6b..8798e5ff 100644 --- a/TODO.txt +++ b/TODO.txt @@ -11,10 +11,11 @@ Things left out for 0.5.0 (missing from 0.15.1 vs 0.16.2) - resource_control.* - simple_cooperation.* - Updates to DxWorldProcessContext - - threaded_solver.ldlt.h - - fastldlt.c -> cpp + fastldltfactor / fastldldvolve - - fastlsolve.c -> cpp + x: solveL1Straight() is done; Missing: ThreadedEquationSolverLDLT* and *Cooperative* - - fastltsolve.c -> cpp + fastvecscale + - ThreadedEquationSolverLDLT* and *Cooperative* is missing from: + - fastldltfactor(_impl).* + - fastlsolve(_impl).* + - fastltsolve(_impl).*: + - fastvecscale(_impl).*: - objects.h/.cpp / obstack.h/.cpp diff --git a/core/src/main/java/org/ode4j/ode/DMatrix.java b/core/src/main/java/org/ode4j/ode/DMatrix.java index 64eb90f8..bdc750f0 100644 --- a/core/src/main/java/org/ode4j/ode/DMatrix.java +++ b/core/src/main/java/org/ode4j/ode/DMatrix.java @@ -318,11 +318,26 @@ public static void dFactorLDLT (double[] A, double[] d, int n, int nskip) { // public void dSolveL1T (const dReal *L, dReal *b, int n, int nskip); + /* in matlab syntax: a(1:n) = a(1:n) .* d(1:n) + */ + + /** + * In matlab syntax: a(1:n) = a(1:n) .* d(1:n) + * @param a a + * @param d d + */ + // ODE_API + public static void dScaleVector (DVector3 a, DVector3C d) { + a.scale(d); + } + /** - * In matlab syntax: a(1:n) = a(1:n) .* d(1:n) + * The function is an alias for @c dScaleVector. + * It has been deprecated because of a wrong naming schema used. * @param a a * @param d d */ + @Deprecated // deprecated in ODE public static void dVectorScale (DVector3 a, DVector3C d) { a.scale(d); } diff --git a/core/src/main/java/org/ode4j/ode/internal/DLCP.java b/core/src/main/java/org/ode4j/ode/internal/DLCP.java index 0fa2d64a..0ce8fa53 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DLCP.java +++ b/core/src/main/java/org/ode4j/ode/internal/DLCP.java @@ -29,8 +29,10 @@ import static org.ode4j.ode.internal.Common.*; import static org.ode4j.ode.internal.ErrorHandler.dDebug; import static org.ode4j.ode.internal.ErrorHandler.dMessage; -import static org.ode4j.ode.internal.FastLDLT.dxtFactorLDLT; +import static org.ode4j.ode.internal.FastLDLTFactor.factorMatrixAsLDLT; +import static org.ode4j.ode.internal.FastLDLTSolve.solveEquationSystemWithLDLT; import static org.ode4j.ode.internal.FastLSolve.solveL1Straight; +import static org.ode4j.ode.internal.FastLTSolve.solveL1Transposed; import static org.ode4j.ode.internal.Matrix.*; import static org.ode4j.ode.internal.Misc.dClearUpperTriangle; import static org.ode4j.ode.internal.Misc.dMakeRandomMatrix; @@ -682,8 +684,8 @@ private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) { } } transfer_b_to_x(m_pairsbxA, 0, nub, false); - dxtFactorLDLT(m_L, m_d, nub, m_nskip, 1); - dxtSolveLDLT(m_L, m_d, 0, m_pairsbxA, 0 + PBX_X, nub, m_nskip, 1, PBX__MAX); + factorMatrixAsLDLT(m_L, m_d, nub, m_nskip, 1); + solveEquationSystemWithLDLT(m_L, m_d, 0, m_pairsbxA, 0 + PBX_X, nub, m_nskip, 1, PBX__MAX); dSetZero (m_w,nub); { int[] C = m_C; @@ -938,7 +940,7 @@ void solve1 (double[] a, int i, boolean dir_positive, boolean only_transfer) for (int j=0; j - public static void dxtFactorLDLT(double[] A, double[] d, int rowCount, int rowSkip, int d_stride) { + public static void factorMatrixAsLDLT(double[] A, double[] d, int rowCount, int rowSkip, int d_stride) { if (rowCount < 1) return; final int lastRowIndex = rowCount - 1; @@ -60,10 +60,10 @@ public static void dxtFactorLDLT(double[] A, double[] d, int rowCount, int rowSk for (; blockStartRow < lastRowIndex; subsequentPass = true, ARow_pos += 2 * rowSkip, blockStartRow += 2) { if (subsequentPass) { /* solve L*(D*l)=a, l is scaled elements in 2 x i block at A(i,0) */ - dxSolveL1_2(A, A, ARow_pos, blockStartRow, rowSkip); - dxScaleAndFactorizeL1_2(A, ARow_pos, d, blockStartRow, rowSkip, d_stride); + solveL1Stripe_2(A, A, ARow_pos, blockStartRow, rowSkip); + scaleAndFactorizeL1Stripe_2(A, ARow_pos, d, blockStartRow, rowSkip, d_stride); } else { - dxScaleAndFactorizeFirstL1Row_2(A, ARow_pos, d, rowSkip, d_stride); + scaleAndFactorizeL1FirstRowStripe_2(A, ARow_pos, d, rowSkip, d_stride); } /* done factorizing 2 x 2 block */ } @@ -71,10 +71,10 @@ public static void dxtFactorLDLT(double[] A, double[] d, int rowCount, int rowSk /* compute the (less than 2) rows at the bottom */ if (!subsequentPass || blockStartRow == lastRowIndex) { if (subsequentPass) { - dxSolveL1_1(A, A, ARow_pos, blockStartRow, rowSkip); - dxScaleAndFactorizeL1_1(A, ARow_pos, d, blockStartRow, d_stride); + solveStripeL1_1(A, A, ARow_pos, blockStartRow, rowSkip); + scaleAndFactorizeL1Stripe_1(A, ARow_pos, d, blockStartRow, d_stride); } else { - dxScaleAndFactorizeFirstL1Row_1(A, ARow_pos, d, d_stride); + scaleAndFactorizeL1FirstRowStripe_1(A, ARow_pos, d, d_stride); } /* done factorizing 1 x 1 block */ } @@ -89,7 +89,7 @@ public static void dxtFactorLDLT(double[] A, double[] d, int rowCount, int rowSk * this processes blocks of 2*2. * if this is in the factorizer source file, n must be a multiple of 2. */ - static void dxSolveL1_2(final double[] L, double[] B, int bPos, int rowCount, int rowSkip) { + static void solveL1Stripe_2(final double[] L, double[] B, int bPos, int rowCount, int rowSkip) { dIASSERT(rowCount != 0); dIASSERT(rowCount % 2 == 0); @@ -229,7 +229,7 @@ static void dxSolveL1_2(final double[] L, double[] B, int bPos, int rowCount, in } //template - private static void dxScaleAndFactorizeL1_2(double[] ARow, int aPos, double[] d, int factorizationRow, int rowSkip, int d_stride) { + private static void scaleAndFactorizeL1Stripe_2(double[] ARow, int aPos, double[] d, int factorizationRow, int rowSkip, int d_stride) { dIASSERT(factorizationRow != 0); dIASSERT(factorizationRow % 2 == 0); @@ -346,7 +346,7 @@ private static void dxScaleAndFactorizeL1_2(double[] ARow, int aPos, double[] d, } //template - private static void dxScaleAndFactorizeFirstL1Row_2(double[] ARow, int aPos, double[] d, int rowSkip, int d_stride) { + private static void scaleAndFactorizeL1FirstRowStripe_2(double[] ARow, int aPos, double[] d, int rowSkip, int d_stride) { int ptrAElement = aPos; //ARow; double[] ptrDElement = d; @@ -380,7 +380,7 @@ private static void dxScaleAndFactorizeFirstL1Row_2(double[] ARow, int aPos, dou * this processes blocks of 2*2. * if this is in the factorizer source file, n must be a multiple of 2. */ - static void dxSolveL1_1(final double[] L, double[] B, int bPos, int rowCount, int rowSkip) { + static void solveStripeL1_1(final double[] L, double[] B, int bPos, int rowCount, int rowSkip) { dIASSERT(rowCount != 0); dIASSERT(rowCount % 2 == 0); @@ -491,7 +491,7 @@ static void dxSolveL1_1(final double[] L, double[] B, int bPos, int rowCount, in } //template - private static void dxScaleAndFactorizeL1_1(double[] ARow, int APos, double[] d, int factorizationRow, int d_stride) { + private static void scaleAndFactorizeL1Stripe_1(double[] ARow, int APos, double[] d, int factorizationRow, int d_stride) { int ptrAElement = APos;//ARow; int ptrDElement = 0;//d; @@ -561,7 +561,7 @@ private static void dxScaleAndFactorizeL1_1(double[] ARow, int APos, double[] d, } //template - private static void dxScaleAndFactorizeFirstL1Row_1(double[] ARow, int APos, double[] d, int d_stride) { + private static void scaleAndFactorizeL1FirstRowStripe_1(double[] ARow, int APos, double[] d, int d_stride) { int ptrAElement = APos; //ARow; double[] ptrDElement = d; diff --git a/core/src/main/java/org/ode4j/ode/internal/FastLDLTSolve.java b/core/src/main/java/org/ode4j/ode/internal/FastLDLTSolve.java new file mode 100644 index 00000000..5159a8e5 --- /dev/null +++ b/core/src/main/java/org/ode4j/ode/internal/FastLDLTSolve.java @@ -0,0 +1,53 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * Open Dynamics Engine 4J, Copyright (C) 2009-2021 Tilmann Zaeschke * + * All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT and LICENSE-BSD.TXT for more details. * + * * + *************************************************************************/ +package org.ode4j.ode.internal; + + +import static org.ode4j.ode.internal.Common.dAASSERT; +import static org.ode4j.ode.internal.FastLSolve.solveL1Straight; +import static org.ode4j.ode.internal.FastLTSolve.solveL1Transposed; +import static org.ode4j.ode.internal.FastVecScale.scaleLargeVector; + +public class FastLDLTSolve { + + + // #ifndef _ODE_MATRIX_IMPL_H_ + // #define _ODE_MATRIX_IMPL_H_ + + + // template + // void solveEquationSystemWithLDLT (const dReal *L, const dReal *d, dReal *b, unsigned rowCount, unsigned rowSkip) + public static void solveEquationSystemWithLDLT(final double[] L, double[] dArray, int dPos, double[] bArray, int bPos, int rowCount, int rowSkip, int d_stride, int b_stride) { + dAASSERT(L != null); + dAASSERT(dArray != null); + dAASSERT(bArray != null); + dAASSERT(rowCount > 0); + dAASSERT(rowSkip >= rowCount); + + solveL1Straight(L, bArray, bPos, rowCount, rowSkip, b_stride); + scaleLargeVector(bArray, bPos, dArray, dPos, rowCount, b_stride, d_stride); + solveL1Transposed(L, bArray, bPos, rowCount, rowSkip, b_stride); + } + +} diff --git a/core/src/main/java/org/ode4j/ode/internal/FastLSolve.java b/core/src/main/java/org/ode4j/ode/internal/FastLSolve.java index e0ef68a7..75f039f5 100644 --- a/core/src/main/java/org/ode4j/ode/internal/FastLSolve.java +++ b/core/src/main/java/org/ode4j/ode/internal/FastLSolve.java @@ -45,7 +45,7 @@ public class FastLSolve { //template public static void solveL1Straight (final double[] L, double[] B, final int BPos, int rowCount, int rowSkip, int b_stride) { - int LPos = 0; + final int LPos = 0; dIASSERT(rowCount != 0); /* compute all 4 x 1 blocks of X */ diff --git a/core/src/main/java/org/ode4j/ode/internal/FastLTSolve.java b/core/src/main/java/org/ode4j/ode/internal/FastLTSolve.java index cb3c66f5..6afed4fc 100644 --- a/core/src/main/java/org/ode4j/ode/internal/FastLTSolve.java +++ b/core/src/main/java/org/ode4j/ode/internal/FastLTSolve.java @@ -40,7 +40,7 @@ public class FastLTSolve { * this processes blocks of 4. */ //template - public static void dxtSolveL1T(final double[] L, double[] B, int BPos, int rowCount, int rowSkip, int b_stride) + public static void solveL1Transposed(final double[] L, double[] B, int BPos, int rowCount, int rowSkip, int b_stride) { int LPos = 0; dIASSERT(rowCount != 0); diff --git a/core/src/main/java/org/ode4j/ode/internal/FastVecScale.java b/core/src/main/java/org/ode4j/ode/internal/FastVecScale.java new file mode 100644 index 00000000..d13ea1b6 --- /dev/null +++ b/core/src/main/java/org/ode4j/ode/internal/FastVecScale.java @@ -0,0 +1,89 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * Open Dynamics Engine 4J, Copyright (C) 2009-2021 Tilmann Zaeschke * + * All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT and LICENSE-BSD.TXT for more details. * + * * + *************************************************************************/ +package org.ode4j.ode.internal; + + +import static org.ode4j.ode.internal.Common.dAASSERT; + +public class FastVecScale { + + // #ifndef _ODE_FASTVECSCALE_IMPL_H_ + // #define _ODE_FASTVECSCALE_IMPL_H_ + + + + // matrix_impl.h + + // template + // void scaleLargeVector (dReal *aStart, const dReal *dStart, unsigned elementCount) + public static void scaleLargeVector(double[] A, final int aStart, final double[] D, int dStart, int elementCount, int a_stride, int d_stride) { + dAASSERT(aStart >= 0 && dStart >= 0 && elementCount >= 0); + + final int step = 4; + // dReal *ptrA = aStart; + // const dReal *ptrD = dStart; + // const dReal *const dStepsEnd = dStart + (size_t)(elementCount & ~(step - 1)) * d_stride; + int ptrA = aStart; + int ptrD = dStart; + final int dStepsEnd = dStart + (elementCount & ~(step - 1)) * d_stride; + + for (; ptrD != dStepsEnd; ptrA += step * a_stride, ptrD += step * d_stride) { + double a0 = A[ptrA + 0], a1 = A[ptrA + 1 * a_stride], a2 = A[ptrA + 2 * a_stride], a3 = A[ptrA + 3 * a_stride]; + double d0 = D[ptrD + 0], d1 = D[ptrD + 1 * d_stride], d2 = D[ptrD + 2 * d_stride], d3 = D[ptrD + 3 * d_stride]; + a0 *= d0; + a1 *= d1; + a2 *= d2; + a3 *= d3; + A[ptrA + 0] = a0; + A[ptrA + 1 * a_stride] = a1; + A[ptrA + 2 * a_stride] = a2; + A[ptrA + 3 * a_stride] = a3; + //dSASSERT(step == 4); + } + + switch (elementCount & (step - 1)) { + case 3: { + double a2 = A[ptrA + 2 * a_stride]; + double d2 = D[ptrD + 2 * d_stride]; + A[ptrA + 2 * a_stride] = a2 * d2; + // break; -- proceed to case 2 + } + + case 2: { + double a1 = A[ptrA + 1 * a_stride]; + double d1 = D[ptrD + 1 * d_stride]; + A[ptrA + 1 * a_stride] = a1 * d1; + // break; -- proceed to case 1 + } + + case 1: { + double a0 = A[ptrA + 0]; + double d0 = D[ptrD + 0]; + A[ptrA + 0] = a0 * d0; + break; + } + } + } + +} diff --git a/core/src/main/java/org/ode4j/ode/internal/Matrix.java b/core/src/main/java/org/ode4j/ode/internal/Matrix.java index 68e85aa6..c9aaafcf 100644 --- a/core/src/main/java/org/ode4j/ode/internal/Matrix.java +++ b/core/src/main/java/org/ode4j/ode/internal/Matrix.java @@ -24,8 +24,9 @@ *************************************************************************/ package org.ode4j.ode.internal; -import static org.ode4j.ode.internal.FastLSolve.dxtSolveL1; -import static org.ode4j.ode.internal.FastLTSolve.dxtSolveL1T; +import static org.ode4j.ode.internal.FastLDLTSolve.solveEquationSystemWithLDLT; +import static org.ode4j.ode.internal.FastLSolve.solveL1Straight; +import static org.ode4j.ode.internal.FastLTSolve.solveL1Transposed; import static org.ode4j.ode.internal.cpp4j.Cstring.memcpy; import static org.ode4j.ode.internal.cpp4j.Cstring.memmove; @@ -680,7 +681,6 @@ public static boolean dIsPositiveDefinite(DMatrix3C A) { } /** - * TODO CHECK-TZ This has been remve in 0.16.2 * given `L', a n*n lower triangular matrix with ones on the diagonal, and * `d', a n*1 vector of the reciprocal diagonal elements of an n*n matrix D, * solve L*D*L'*x=b where x,b are n*1. x overwrites b. the leading dimension @@ -695,7 +695,9 @@ public static void dSolveLDLT(final double[] L, final double[] d, double[] b, int n, int nskip) { dIASSERT(n != 0); - dxtSolveLDLT(L, d, 0, b, 0, n, nskip, 1, 1); + if (n != 0) { + solveEquationSystemWithLDLT(L, d, 0, b, 0, n, nskip, 1, 1); + } } /** @@ -1051,13 +1053,6 @@ public static boolean dInvertPDMatrix (final double[] A, double[] Ainv, int n) - static void dxSolveL1(final double[] L, double[] b, int n, int lskip1) - { - dIASSERT(n != 0); - - dxtSolveL1(L, b, 0, n, lskip1, 1); - } - public static void dSolveL1(final double[] L, double[] B, int n, int lskip1) { dAASSERT(n != 0); @@ -1067,25 +1062,20 @@ public static void dSolveL1(final double[] L, double[] B, int n, int lskip1) dAASSERT(L != null); dAASSERT(B != null); - dxSolveL1(L, B, n, lskip1); + solveL1Straight(L, B, 0, n, lskip1, 1); } } - static void dxSolveL1T(final double[] L, double[] b, int n, int lskip1) + public static void dSolveL1T (final double[] L, double[] B, int rowCount, int rowSkip) { - dxtSolveL1T(L, b, 0, n, lskip1, 1); - } + dAASSERT(rowCount != 0); - public static void dSolveL1T (final double[] L, double[] B, int n, int lskip1) - { - dAASSERT(n != 0); - - if (n != 0) + if (rowCount != 0) { dAASSERT(L != null); dAASSERT(B != null); - dxSolveL1T(L, B, n, lskip1); + solveL1Transposed(L, B, 0, rowCount, rowSkip, 1); } } @@ -1101,7 +1091,7 @@ public static void dSolveL1T (final double[] L, double[] B, int n, int lskip1) * @param nskip1 nskip */ public static void dFactorLDLT(double[] A, double[] d, int n, int nskip1) { - FastLDLT.dxtFactorLDLT(A, d, n, nskip1, 1); + FastLDLTFactor.factorMatrixAsLDLT(A, d, n, nskip1, 1); } private static int _dEstimateFactorCholeskyTmpbufSize(int n) @@ -1144,76 +1134,6 @@ private static int _dEstimateLDLTRemoveTmpbufSize(int n2, int nskip) public static int dEstimateLDLTAddTLTmpbufSize(int nskip) { return _dEstimateLDLTAddTLTmpbufSize(nskip); } public static int dEstimateLDLTRemoveTmpbufSize(int n2, int nskip) { return _dEstimateLDLTRemoveTmpbufSize(n2, nskip); } - - // matrix_impl.h - - // template - // void dxtVectorScale (dReal *aStart, const dReal *dStart, unsigned elementCount) - public static void dxtVectorScale(double[] A, final int aStart, final double[] D, int dStart, int elementCount, int a_stride, int d_stride) { - dAASSERT(aStart >= 0 && dStart >= 0 && elementCount >= 0); - - final int step = 4; - // dReal *ptrA = aStart; - // const dReal *ptrD = dStart; - // const dReal *const dStepsEnd = dStart + (size_t)(elementCount & ~(step - 1)) * d_stride; - int ptrA = aStart; - int ptrD = dStart; - final int dStepsEnd = dStart + (elementCount & ~(step - 1)) * d_stride; - - for (; ptrD != dStepsEnd; ptrA += step * a_stride, ptrD += step * d_stride) { - double a0 = A[ptrA + 0], a1 = A[ptrA + 1 * a_stride], a2 = A[ptrA + 2 * a_stride], a3 = A[ptrA + 3 * a_stride]; - double d0 = D[ptrD + 0], d1 = D[ptrD + 1 * d_stride], d2 = D[ptrD + 2 * d_stride], d3 = D[ptrD + 3 * d_stride]; - a0 *= d0; - a1 *= d1; - a2 *= d2; - a3 *= d3; - A[ptrA + 0] = a0; - A[ptrA + 1 * a_stride] = a1; - A[ptrA + 2 * a_stride] = a2; - A[ptrA + 3 * a_stride] = a3; - //dSASSERT(step == 4); - } - - switch (elementCount & (step - 1)) { - case 3: { - double a2 = A[ptrA + 2 * a_stride]; - double d2 = D[ptrD + 2 * d_stride]; - A[ptrA + 2 * a_stride] = a2 * d2; - // break; -- proceed to case 2 - } - - case 2: { - double a1 = A[ptrA + 1 * a_stride]; - double d1 = D[ptrD + 1 * d_stride]; - A[ptrA + 1 * a_stride] = a1 * d1; - // break; -- proceed to case 1 - } - - case 1: { - double a0 = A[ptrA + 0]; - double d0 = D[ptrD + 0]; - A[ptrA + 0] = a0 * d0; - break; - } - } - } - - - // TODO CHECK-TZ This has been remve in 0.16.2 - // template - // void dxtSolveLDLT (const dReal *L, const dReal *d, dReal *b, unsigned rowCount, unsigned rowSkip) - public static void dxtSolveLDLT(final double[] L, double[] dArray, int dPos, double[] bArray, int bPos, int rowCount, int rowSkip, int d_stride, int b_stride) { - dAASSERT(L != null); - dAASSERT(dArray != null); - dAASSERT(bArray != null); - dAASSERT(rowCount > 0); - dAASSERT(rowSkip >= rowCount); - - dxtSolveL1(L, bArray, bPos, rowCount, rowSkip, b_stride); - dxtVectorScale(bArray, bPos, dArray, dPos, rowCount, b_stride, d_stride); - dxtSolveL1T(L, bArray, bPos, rowCount, rowSkip, b_stride); - } - public static double dxDot(final double[] a, final double[] b, int n) { return dDot(a, b, n); } From f44c07ae6b16d6040a2534a6a5d5a1855566dce4 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Tue, 9 May 2023 11:32:33 +0200 Subject: [PATCH 19/27] Everything done except quicklstep and the stuff listed in TODO --- TODO.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TODO.txt b/TODO.txt index 8798e5ff..e40c4e0f 100644 --- a/TODO.txt +++ b/TODO.txt @@ -43,6 +43,8 @@ General cleanup: - Move tests to core/test - update DVector3 safeNormalize to use max() and then compare to 0. ALso see: https://github.com/JOML-CI/JOML/issues/66 - replace DVector3.clone() with dVector3.re() or copy() +- Create separate distribution (maven jar) with modules? -> Check how modul-projects have trouble with including + non-module projects... - reformat everything? At least indentation? @@ -56,7 +58,7 @@ Some minor things I found in the code: - http://opende.sourceforge.net/wiki/index.php/Joint_Param_Documentation This indicate that PU & PR joint have not parameters, I don't think that's correct? - GeomTransform is obsolete since 0.6 (according to the Wiki), but it is still used in several demos: - deom_boxstack, demo_heightfield, demo_jointPU, demo_motion, demo_spacestress. + demo_boxstack, demo_heightfield, demo_jointPU, demo_motion, demo_spacestress. I haven't used it myself, so is it still required? From 77e0484845ee91a9fd15e189c887554e83e75a86 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Tue, 9 May 2023 11:43:39 +0200 Subject: [PATCH 20/27] Everything done except quicklstep and the stuff listed in TODO --- TODO.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO.txt b/TODO.txt index e40c4e0f..56546fda 100644 --- a/TODO.txt +++ b/TODO.txt @@ -45,6 +45,8 @@ General cleanup: - replace DVector3.clone() with dVector3.re() or copy() - Create separate distribution (maven jar) with modules? -> Check how modul-projects have trouble with including non-module projects... + -> https://www.baeldung.com/java-9-modularity + -> https://stackoverflow.com/questions/40490520/what-do-i-need-to-build-jdk-9-project-with-non-modular-dependencies-using-maven - reformat everything? At least indentation? From 2719b575a4016163c1a159fdd9821df4af870970 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Tue, 9 May 2023 16:31:19 +0200 Subject: [PATCH 21/27] Quickstep works!! -> Test and do TODO --- .../org/ode4j/ode/internal/DxQuickStep.java | 322 ++++++++++++++---- 1 file changed, 255 insertions(+), 67 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java index e68f6e28..4608a252 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java @@ -40,6 +40,7 @@ import static org.ode4j.ode.internal.QuickStepEnums.*; import static org.ode4j.ode.internal.Timer.*; import static org.ode4j.ode.internal.Timer.dTimerReport; +import static org.ode4j.ode.internal.cpp4j.Cstring.memcpy; import java.io.PrintStream; import java.util.Arrays; @@ -85,7 +86,7 @@ public class DxQuickStep extends AbstractStepper implements dstepper_fn_t, public static int RRS_REORDERING = 0; // public static int RRS_REVERSAL = 1; // public static int RRS_MIN = 0; - public static int RRS_MAX = 2; + public static int RRS_MAX = 1; private static final boolean CHECK_VELOCITY_OBEYS_CONSTRAINT = false; @@ -145,6 +146,18 @@ private enum ReorderingMethod { // or hardly at all, but it doesn't seem to hurt. private static final ReorderingMethod CONSTRAINTS_REORDERING_METHOD = ReorderingMethod.REORDERING_METHOD__RANDOMLY; + // #if CONSTRAINTS_REORDERING_METHOD == REORDERING_METHOD__RANDOMLY + // #if !defined(RANDOM_CONSTRAINTS_REORDERING_FREQUENCY) + // #define RANDOM_CONSTRAINTS_REORDERING_FREQUENCY 8U + // #endif + // dSASSERT(RANDOM_CONSTRAINTS_REORDERING_FREQUENCY != 0); + // #endif + // TZ: see further up. + // enum dxRandomReorderStage { + // //RRS__MIN, + // RRS_REORDERING,// = RRS__MIN, + // RRS__MAX, + // }; //*************************************************************************** // macros, typedefs, forwards and inlines @@ -228,6 +241,17 @@ private static class DJointWithInfo1 // int mIndex; // int fbIndex; // } + private static void setMIndex(int[] mindex, int pos, int mIndex, int fbIndex) { + mindex[2 * pos] = mIndex; + mindex[2 * pos + 1] = fbIndex; + } + private static int getMIndex(int[] mindex, int pos) { + return mindex[2 * pos]; + } + private static int getFbIndex(int[] mindex, int pos) { + return mindex[pos * 2 + 1]; + } + // // private static class dxJBodiesItem { // int first; @@ -583,8 +607,9 @@ private static boolean IsSORConstraintsReorderRequiredForIteration(int iteration result = true; } else if (CONSTRAINTS_REORDERING_METHOD == ReorderingMethod.REORDERING_METHOD__RANDOMLY) { // This logic is intended to skip randomization on the very first iteration - if (iteration < RANDOM_CONSTRAINTS_REORDERING_FREQUENCY ? iteration == 0 - : iteration % RANDOM_CONSTRAINTS_REORDERING_FREQUENCY < RRS_MAX) { + if (iteration >= RANDOM_CONSTRAINTS_REORDERING_FREQUENCY + ? (iteration % RANDOM_CONSTRAINTS_REORDERING_FREQUENCY < RRS_MAX) + : iteration == 0) { result = true; } } else { @@ -911,9 +936,8 @@ void dxQuickStepIsland_Stage1(dxQuickStepperStage1CallContext stage1CallContext) { int mcurrO = 0;//mindex; int moffs = 0, mfboffs = 0; - mindex[mcurrO+0] = moffs; - mindex[mcurrO+1] = mfboffs; - mcurrO += 2; + setMIndex(mindex, mcurrO, moffs, mfboffs); + ++mcurrO; for (int i = 0; i < nj; i++) { DJointWithInfo1 jicurr = jointinfos[i]; @@ -924,9 +948,8 @@ void dxQuickStepIsland_Stage1(dxQuickStepperStage1CallContext stage1CallContext) DxJoint joint = jicurr.joint; moffs += jicurr.info.m; if (joint.feedback != null) { mfboffs += jicurr.info.m; } - mindex[mcurrO+0] = moffs; - mindex[mcurrO+1] = mfboffs; - mcurrO += 2; + setMIndex(mindex, mcurrO, moffs, mfboffs); + ++mcurrO; } } @@ -1095,8 +1118,8 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext int ji; while ((ji = Atomics.ThrsafeIncrementIntUpToLimit(stage2CallContext.m_ji_J, nj)) != nj) { - final int ofsi = mindex[ji * 2 + 0]; - final int infom = mindex[ji * 2 + 2] - ofsi; + final int ofsi = getMIndex(mindex, ji); + final int infom = getMIndex(mindex, ji + 1) - ofsi; int jRow = ofsi * JME__MAX; int jEnd = jRow + infom * JME__MAX; for (int jCurr = jRow; jCurr != jEnd; jCurr += JME__MAX) { @@ -1136,21 +1159,60 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext // because it gets destroyed by SOR solver // instead of saving all Jacobian, we can save just rows // for joints, that requested feedback (which is normally much less) - int mfbcurr = mindex[ji * 2 + 1], mfbnext = mindex[ji * 2 + 3]; - int mfbCount = mfbnext - mfbcurr; - if (mfbCount != 0) { - int jEndMfb = jRow + mfbCount * JME__MAX; - for (int jCurr = jRow; jCurr < jEndMfb ;jCurr += JME__MAX) { - System.arraycopy(J, jCurr + JME__J1_MIN, Jcopy, jCopy_ofs + JCE__J1_MIN, JME__J1_COUNT); - System.arraycopy(J, jCurr + JME__J2_MIN, Jcopy, jCopy_ofs + JCE__J2_MIN, JME__J2_COUNT); - jCopy_ofs += JCE__MAX; - } + int mfbIndex = getFbIndex(mindex, ji); //mindex[ji].fbIndex; + if (mfbIndex != getMIndex(mindex, ji + 1)) { //mindex[ji + 1].fbIndex) { + // dReal *const JEnd = JRow + infom * JME__MAX; + // dReal *JCopyRow = JCopy + mfbIndex * JCE__MAX; // Random access by mfbIndex here! Do not optimize! + final int jEndMfb = jRow + infom * JME__MAX; + int JCopyRow = jCopy_ofs + mfbIndex * JCE__MAX; // Random access by mfbIndex here! Do not optimize! + //for (const dReal *JCurr = JRow; ; ) { + for (int jCurr = jRow; jCurr < jEndMfb ;jCurr += JME__MAX) { + //for (unsigned i = 0; i != JME__J1_COUNT; ++i) { JCopyRow[i + JCE__J1_MIN] = JCurr[i + JME__J1_MIN]; } + //for (unsigned j = 0; j != JME__J2_COUNT; ++j) { JCopyRow[j + JCE__J2_MIN] = JCurr[j + JME__J2_MIN]; } + System.arraycopy(J, jCurr + JME__J1_MIN, Jcopy, jCopy_ofs + JCE__J1_MIN, JME__J1_COUNT); + System.arraycopy(J, jCurr + JME__J2_MIN, Jcopy, jCopy_ofs + JCE__J2_MIN, JME__J2_COUNT); + JCopyRow += JCE__MAX; + + // TODO CHECK-TZ + // TODO CHECK-TZ + // TODO CHECK-TZ + // TODO CHECK-TZ + // TODO CHECK-TZ + // TODO CHECK-TZ + // TODO CHECK-TZ + // TODO CHECK-TZ + + // TZ move this outside of loop + // dSASSERT((unsigned)JCE__J1_COUNT == JME__J1_COUNT); + // dSASSERT((unsigned)JCE__J2_COUNT == JME__J2_COUNT); + // dSASSERT(JCE__J1_COUNT + JCE__J2_COUNT == JCE__MAX); + +// int mfbcurr = mindex[ji * 2 + 1], mfbnext = mindex[ji * 2 + 3]; +// int mfbCount = mfbnext - mfbcurr; +// if (mfbCount != 0) { +// int jEndMfb = jRow + mfbCount * JME__MAX; +// for (int jCurr = jRow; jCurr < jEndMfb ;jCurr += JME__MAX) { +// System.arraycopy(J, jCurr + JME__J1_MIN, Jcopy, jCopy_ofs + JCE__J1_MIN, JME__J1_COUNT); +// System.arraycopy(J, jCurr + JME__J2_MIN, Jcopy, jCopy_ofs + JCE__J2_MIN, JME__J2_COUNT); +// jCopy_ofs += JCE__MAX; + } } } Atomics.ThrsafeAdd(localContext.m_valid_findices, validFIndices); } - { + // TZ moved this here from inside loop above. + dSASSERT(JCE__J1_COUNT == JME__J1_COUNT); + dSASSERT(JCE__J2_COUNT == JME__J2_COUNT); + dSASSERT(JCE__J1_COUNT + JCE__J2_COUNT == JCE__MAX); + + // TZ: additional assert for System.arraycopy optimization: + dSASSERT(JCE__J1_MIN == 0); + dSASSERT(JCE__J2_MIN == 6); + dSASSERT(JME__J1_COUNT + JME__J2_COUNT == JCE__MAX); + + + { int[] jb = localContext.m_jb; // create an array of body numbers for each joint row @@ -1664,7 +1726,10 @@ int dxQuickStepIsland_Stage4LCP_IterationStart(final dxQuickStepperStage4CallCon reorderRequired = true; } - // Increment iterations counter in advance as anyway it needs to be incremented + // TODO CHECK-TZ why don't we need this? + // unsigned syncCallDependencies = reorderRequired ? 1 : stage4LCP_Iteration_allowedThreads; + + // Increment iterations counter in advance as anyway it needs to be incremented // before independent tasks (the reordering or the iteration) are posted // (otherwise next iteration may complete before the increment // and the same iteration index may be used again). @@ -1743,15 +1808,25 @@ void dxQuickStepIsland_Stage4LCP_ConstraintsReordering(dxQuickStepperStage4CallC dxQuickStepIsland_Stage4LCP_DependencyMapForNewOrderRebuilding(stage4CallContext); } } + else { + // TODO CHECK-TZ + if (true) + throw new UnsupportedOperationException("THis was added in 16.2, why did I miss it?"); + // NOTE: So far, this branch is only called in CONSTRAINTS_REORDERING_METHOD == REORDERING_METHOD__BY_ERROR case + if (Atomics.ThrsafeExchangeAdd(stage4CallContext.m_SOR_reorderThreadsRemaining, -1) == 1) { // If last thread has exited the reordering routine... + dIASSERT(iteration != 0); + dxQuickStepIsland_Stage4LCP_DependencyMapFromSavedLevelsReconstruction(stage4CallContext); + } + } } private static boolean dxQuickStepIsland_Stage4LCP_ConstraintsShuffling(dxQuickStepperStage4CallContext stage4CallContext, int iteration) { boolean result = false; + // #if CONSTRAINTS_REORDERING_METHOD == REORDERING_METHOD__BY_ERROR if (CONSTRAINTS_REORDERING_METHOD == ReorderingMethod.REORDERING_METHOD__BY_ERROR) { /* - #if CONSTRAINTS_REORDERING_METHOD == REORDERING_METHOD__BY_ERROR struct ConstraintsReorderingHelper { void operator ()(dxQuickStepperStage4CallContext *stage4CallContext, int int startIndex, int int endIndex) @@ -1784,6 +1859,13 @@ else if (last_lambda[i] != REAL(0.0)) { if (iteration > 1) { // Only reorder starting from iteration #2 // sort the constraints so that the ones converging slowest // get solved last. use the absolute (not relative) error. + // + // Full reorder needs to be done. + // Even though this contradicts the initial idea of moving dependent constraints + // to the order end the algorithm does not work the other way well. + // It looks like the iterative method needs a shake after it already found + // some initial approximations and those incurred errors help it to converge even better. + // if (ThrsafeExchange(&stage4CallContext->m_SOR_reorderHeadTaken, 1) == 0) { // Process the head const dxQuickStepperLocalContext *localContext = stage4CallContext->m_localContext; @@ -1822,37 +1904,55 @@ else if (iteration == 1) { else { result = true; // return true on 0th iteration to build dependency map for the initial order } - #elif CONSTRAINTS_REORDERING_METHOD == REORDERING_METHOD__RANDOMLY */ throw new UnsupportedOperationException(); + // #elif CONSTRAINTS_REORDERING_METHOD == REORDERING_METHOD__RANDOMLY } else if (CONSTRAINTS_REORDERING_METHOD == ReorderingMethod.REORDERING_METHOD__RANDOMLY) { if (iteration != 0) { - if (iteration % RANDOM_CONSTRAINTS_REORDERING_FREQUENCY == RRS_REORDERING) { + dIASSERT(!dIN_RANGE(iteration, 0, RANDOM_CONSTRAINTS_REORDERING_FREQUENCY)); + + dIASSERT(iteration % RANDOM_CONSTRAINTS_REORDERING_FREQUENCY == RRS_REORDERING); + { + dIASSERT(!dIN_RANGE(iteration, 0, RANDOM_CONSTRAINTS_REORDERING_FREQUENCY)); + + dIASSERT(iteration % RANDOM_CONSTRAINTS_REORDERING_FREQUENCY == RRS_REORDERING); + // { + // class ConstraintsReorderingHelper { + // void operator ()(dxQuickStepperStage4CallContext *stage4CallContext, unsigned int startIndex, unsigned int indicesCount) + // { + // IndexError *order = stage4CallContext->m_order + startIndex; + // + // for (unsigned int index = 1; index < indicesCount; ++index) { + // int swapIndex = dRandInt(index + 1); + // IndexError tmp = order[index]; + // order[index] = order[swapIndex]; + // order[swapIndex] = tmp; + // } + // } + // }; + + /* + * Full reorder needs to be done. + * Even though this contradicts the initial idea of moving dependent constraints + * to the order end the algorithm does not work the other way well. + * It looks like the iterative method needs a shake after it already found + * some initial approximations and those incurred errors help it to converge even better. + */ if (Atomics.ThrsafeExchange(stage4CallContext.m_SOR_reorderHeadTaken, 1) == 0) { // Process the head - dxQuickStepperLocalContext localContext = stage4CallContext.m_localContext; - ConstraintsReorderingHelper(stage4CallContext, 0, - localContext.m_m - localContext.m_valid_findices.get()); - } - if (Atomics.ThrsafeExchange(stage4CallContext.m_SOR_reorderTailTaken, 1) == 0) { - // Process the tail - dxQuickStepperLocalContext localContext = stage4CallContext.m_localContext; - ConstraintsReorderingHelper(stage4CallContext, localContext.m_m - localContext.m_valid_findices.get(), - localContext.m_valid_findices.get()); + final dxQuickStepperLocalContext localContext = stage4CallContext.m_localContext; + ConstraintsReorderingHelper(stage4CallContext, 0, localContext.m_m); } - } else { - // Revert to the normal order on the next step after the shuffling - dxQuickStepIsland_Stage4LCP_ReorderPrep(stage4CallContext); - } + } + // dIASSERT((RRS__MAX, true)); // A reference to RRS__MAX to be located by Find in Files } else { // Just return true and skip the randomization for the very first iteration } result = true; + // #else // #if CONSTRAINTS_REORDERING_METHOD != REORDERING_METHOD__BY_ERROR && CONSTRAINTS_REORDERING_METHOD != REORDERING_METHOD__RANDOMLY } else { - // TODO CHECK-TZ Confirm that this works, otherwise remove condition again - if (iteration == 0) { - result = true; // return true on 0th iteration to build dependency map for initial order - } + dIASSERT(iteration == 0); // The reordering request is only returned for the first iteration + result = true; } return result; } @@ -1966,6 +2066,23 @@ void dxQuickStepIsland_Stage4LCP_DependencyMapFromSavedLevelsReconstruction(dxQu AtomicInteger[] mi_levels = stage4CallContext.m_bi_links_or_mi_levels; AtomicInteger[] mi_links = stage4CallContext.m_mi_links; + // NOTE! + // OD: The mi_links array is not zero-filled before the reconstruction. + // Iteration ends with all the down links zeroed. And since down links + // are moved to the next level links when parent-child relations are established, + // the horizontal levels are properly terminated. + // The leaf nodes had their links zero-initialized initially + // and those zeros remain intact during the solving. This way the down links + // are properly terminated as well. + // This is very obscure and error prone and would need an assertion check at least + // but the simplest assertion approach I can imagine would be + // zero filling and building another tree with the memory buffer comparison afterwards. + // That would be stupid, obviously. + // + // NOTE! + // OD: This routine can be threaded. However having two threads messing + // in one integer array with random access and kicking each other memory lines + // out of cache would probably work worse than letting a single thread do the whole job. int m = localContext.m_m; for (int i = 0; i != m; ++i) { int currentLevelRoot = mi_levels[i].get(); @@ -1998,10 +2115,37 @@ public void run() { } dxQuickStepIsland_Stage4LCP_MTIteration(stage4CallContext, knownToBeCompletedLevel); } - - public static AtomicInteger mtIterations = new AtomicInteger(); - - private static + + public static AtomicInteger mtIterations = new AtomicInteger(); + + /* + * +0 +0 + * Root───┬─────────────────┬──... + * +1│ +1│ + * ┌┴┐+0 ┌─┐+0 . + * │A├─────┤B├─... + * └┬┘ └┬┘ + * +1│ +1│ + * ┌┴┐+0 . + * │C├─... + * └┬┘ + * +1│ + * . + * + * Lower tree levels depend on their parents. Same level nodes are independent with respect to each other. + * + * 1. B is linked in place of A + * 2. A is processed + * 3. C is inserted at the Root level + * + * The tree starts with a single child subtree at the root level ("down" link of slot #0 is used for that). + * Then, additional "C" nodes are added to the root level by building horizontal link via slots of + * their former parent "A"s that had become free. + * The "level" link of slot #0 is used to find the root level head. + * + * Since the tree is altered during iteration, mi_levels record each node parents so that the tree could be reconstructed. + */ + private static void dxQuickStepIsland_Stage4LCP_MTIteration(final dxQuickStepperStage4CallContext stage4CallContext, final int initiallyKnownToBeCompletedLevel) { mtIterations.incrementAndGet(); @@ -2247,6 +2391,8 @@ void dxQuickStepIsland_Stage4b(dxQuickStepperStage4CallContext stage4CallContext // they should not be used again. if (IsStage4bJointInfosIterationRequired(localContext)) { + DVector3 dataL = new DVector3(); //JVE__MAX; + DVector3 dataA = new DVector3(); //JVE__MAX; double[] Jcopy = localContext.m_Jcopy; double[] lambda = stage4CallContext.m_lambda; int[] mindex = localContext.m_mindex; @@ -2259,33 +2405,75 @@ void dxQuickStepIsland_Stage4b(dxQuickStepperStage4CallContext stage4CallContext int ji_step; while ((ji_step = Atomics.ThrsafeIncrementIntUpToLimit(stage4CallContext.m_ji_4b, nj_steps)) != nj_steps) { int ji = ji_step * step_size; - int lambdacurr = mindex[ji * 2]; - int Jcopycurr = mindex[ji * 2 + 1] * JCE__MAX; - int jicurr = ji; - int jiend = jicurr + Math.min(step_size, nj - ji); + final int jiend = ji + Math.min(step_size, nj - ji); - while (true) { - DxJoint joint = jointinfos[jicurr].joint; - int infom = jointinfos[jicurr].info.m; + //const dReal *Jcopycurr = Jcopy + (sizeint)mindex[ji].fbIndex * JCE__MAX; + int Jcopycurr = getFbIndex(mindex, ji) * JCE__MAX; + while (true) { // straightforward computation of joint constraint forces: // multiply related lambdas with respective J' block for joints // where feedback was requested - DJoint.DJointFeedback fb = joint.feedback; - if (fb != null) { - dAssertVec3Element(); // Assigning fb.f1/f2/t1/t2 inside multiply, see ODE code. - Multiply1_12q1 (fb.f1, fb.t1, Jcopy, Jcopycurr + JCE__J1_MIN, lambda, lambdacurr, infom); - if (joint.node[1].body != null) { - Multiply1_12q1 (fb.f2, fb.t2, Jcopy, Jcopycurr + JCE__J2_MIN, lambda, lambdacurr, infom); - } - Jcopycurr += infom * JCE__MAX; - } + final int fb_infom = getFbIndex(mindex, ji + 1) - getFbIndex(mindex, ji); + if (fb_infom != 0) { + dIASSERT(fb_infom == getMIndex(mindex, ji + 1) - getMIndex(mindex, ji)); + + //const dReal *lambdacurr = lambda + mindex[ji].mIndex; + final int lambdacurrOfs = getMIndex(mindex, ji); + DxJoint joint = jointinfos[ji].joint; + + // #ifdef WARM_STARTING + if (WARM_STARTING) { + memcpy(joint.lambda, 0, lambda, lambdacurrOfs, fb_infom); + } + // #endif + + DJoint.DJointFeedback fb = joint.feedback; + + dAssertVec3Element(); // ode4j specific assertion + if (joint.node[1].body != null) { + Multiply1_12q1 (dataL, dataA, Jcopy, Jcopycurr + JCE__J2_MIN, lambda, lambdacurrOfs, fb_infom); + dSASSERT(JCE__MAX == 12); + + // fb.f2[dSA_X] = data[JVE_LX]; + // fb->f2[dSA_Y] = data[JVE_LY]; + // fb->f2[dSA_Z] = data[JVE_LZ]; + // fb->t2[dSA_X] = data[JVE_AX]; + // fb->t2[dSA_Y] = data[JVE_AY]; + // fb->t2[dSA_Z] = data[JVE_AZ]; + fb.f2.set(dataL); + fb.t2.set(dataA); + } + + Multiply1_12q1 (dataL, dataA, Jcopy, Jcopycurr + JCE__J1_MIN, lambda, lambdacurrOfs, fb_infom); + dSASSERT(JCE__MAX == 12); + + // fb->f1[dSA_X] = data[JVE_LX]; + // fb->f1[dSA_Y] = data[JVE_LY]; + // fb->f1[dSA_Z] = data[JVE_LZ]; + // fb->t1[dSA_X] = data[JVE_AX]; + // fb->t1[dSA_Y] = data[JVE_AY]; + // fb->t1[dSA_Z] = data[JVE_AZ]; + fb.f2.set(dataL); + fb.t2.set(dataA); + + Jcopycurr += fb_infom * JCE__MAX; + } + else { + // #ifdef WARM_STARTING + if (WARM_STARTING) { + int lambdacurrOfs = getMIndex(mindex, ji); + int infom = getMIndex(mindex, ji + 1) - getMIndex(mindex, ji); + DxJoint joint = jointinfos[ji].joint; + memcpy(joint.lambda, 0, lambda, lambdacurrOfs, infom); + // #endif + } + } - if (++jicurr == jiend) { - break; - } - lambdacurr += infom; - } + if (++ji == jiend) { + break; + } + } } } } From 6bb29e4789d34e1869bf40b76ab3a770f41ebd60 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Tue, 9 May 2023 16:49:31 +0200 Subject: [PATCH 22/27] Quickstep works!! -> Test and do TODO --- core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java | 3 +-- demo/src/test/java/org/ode4j/tests/TestIssue0008_Gimpact.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java index 4608a252..94b4fa7b 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java @@ -939,10 +939,9 @@ void dxQuickStepIsland_Stage1(dxQuickStepperStage1CallContext stage1CallContext) setMIndex(mindex, mcurrO, moffs, mfboffs); ++mcurrO; + //for (DJointWithInfo1 jicurr: jointinfos) { for (int i = 0; i < nj; i++) { DJointWithInfo1 jicurr = jointinfos[i]; - //TODO fix issue #18 - //for (DJointWithInfo1 jicurr: jointinfos) { //const dJointWithInfo1 *const jiend = jointinfos + nj; //for (const dJointWithInfo1 *jicurr = jointinfos; jicurr != jiend; ++jicurr) { DxJoint joint = jicurr.joint; diff --git a/demo/src/test/java/org/ode4j/tests/TestIssue0008_Gimpact.java b/demo/src/test/java/org/ode4j/tests/TestIssue0008_Gimpact.java index 7cf8604f..3a0077a5 100644 --- a/demo/src/test/java/org/ode4j/tests/TestIssue0008_Gimpact.java +++ b/demo/src/test/java/org/ode4j/tests/TestIssue0008_Gimpact.java @@ -57,8 +57,7 @@ public class TestIssue0008_Gimpact { */ @Test public void testLargeTrimesh() { - //TODO Test does not fail yet, even if the last part (0x3FF) is removed from line 76 in - //RadixSort. + //TODO Test does not fail yet, even if the last part (0x3FF) is removed from line 76 in RadixSort. // float[] size = new float[]{ 5.0f, 5.0f, 2.5f }; // From e45f2084ee7cf242f37ceddde15f4d2d190bc31c Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 10 May 2023 11:24:21 +0200 Subject: [PATCH 23/27] Quickstep works!! -> Test and do TODO --- README.md | 12 ++++++++---- demo/src/main/java/org/ode4j/demo/DemoPlane2d.java | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6299cd47..2f7307c0 100644 --- a/README.md +++ b/README.md @@ -68,16 +68,20 @@ News * This is the last release built with Java 6. +Basic Usage Tips +================ + * Use `World.quickStep(...)` instead of `World.step()`. The latter is slower and appears to be less stable. + * Make sure to set `Common.dNODEBUG = true` for best performance. + * Avoid using `core-cpp` and ignore demos in `demo-cpp`. + + Legal ===== ode4j: -Copyright (c) 2009-2017 Tilmann Zäschke . +Copyright (c) 2009-2023 Tilmann Zäschke . All rights reserved. - - - Like the original ODE, ode4j is licensed under LGPL v2.1 and BSD 3-clause. Choose whichever license suits your needs. diff --git a/demo/src/main/java/org/ode4j/demo/DemoPlane2d.java b/demo/src/main/java/org/ode4j/demo/DemoPlane2d.java index c0135bcd..8108fb4a 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoPlane2d.java +++ b/demo/src/main/java/org/ode4j/demo/DemoPlane2d.java @@ -177,7 +177,9 @@ public void step (boolean pause) { { //dSpaceCollide (coll_space_id, 0, cb_near_collision); OdeHelper.spaceCollide (g_globals_ptr.coll_space_id, null, myNearCallBack ); - g_globals_ptr.dyn_world.step (TIME_STEP/n); + // TODO See issue #15, step() causes weird spinning and console errors + // g_globals_ptr.dyn_world.step (TIME_STEP/n); + g_globals_ptr.dyn_world.quickStep (TIME_STEP/n); g_globals_ptr.coll_contacts.empty (); } } From 3e3646a06c5f0c6e5d89fd9d84703db92fb638b9 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 10 May 2023 11:33:13 +0200 Subject: [PATCH 24/27] Quickstep works!! -> Test and do TODO --- .../src/main/java/org/ode4j/ode/internal/DxQuickStep.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java index 94b4fa7b..126aabf6 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java @@ -1222,8 +1222,8 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext int b1 = (joint.node[0].body!=null) ? (joint.node[0].body.tag) : -1; int b2 = (joint.node[1].body!=null) ? (joint.node[1].body.tag) : -1; - int jb_end = 2 * mindex[ji * 2 + 2]; - int jb_ptr = 2 * mindex[ji * 2 + 0]; + int jb_end = 2 * getMIndex(mindex, ji + 1); + int jb_ptr = 2 * getMIndex(mindex, ji); for (; jb_ptr != jb_end; jb_ptr += 2) { jb[jb_ptr] = b1; jb[jb_ptr+1] = b2; @@ -1468,8 +1468,8 @@ void dxQuickStepIsland_Stage4a(dxQuickStepperStage4CallContext stage4CallContext int ji_step; while ((ji_step = Atomics.ThrsafeIncrementIntUpToLimit(stage4CallContext.m_ji_4a, nj_steps)) != nj_steps) { int ji = ji_step * step_size; - int lambdacurr = mindex[ji * 2]; - int lambdsnext = mindex[2 * (ji + Math.min(step_size, nj - ji))]; + int lambdacurr = getMIndex(mindex, ji); + int lambdsnext = getMIndex(mindex, ji + Math.min(step_size, nj - ji)); dSetZero(lambda, lambdacurr, lambdsnext - lambdacurr); } } From 4c60175d682d9af0059ad39d007511585bc265ef Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 10 May 2023 15:11:28 +0200 Subject: [PATCH 25/27] Quickstep works!! -> Test and do TODO --- TODO.txt | 1 + .../java/org/ode4j/ode/internal/Common.java | 29 ++--- .../org/ode4j/ode/internal/DxQuickStep.java | 112 ++++++++---------- .../java/org/ode4j/demo/DemoFeedback.java | 1 - 4 files changed, 63 insertions(+), 80 deletions(-) diff --git a/TODO.txt b/TODO.txt index 56546fda..ac103e67 100644 --- a/TODO.txt +++ b/TODO.txt @@ -48,6 +48,7 @@ General cleanup: -> https://www.baeldung.com/java-9-modularity -> https://stackoverflow.com/questions/40490520/what-do-i-need-to-build-jdk-9-project-with-non-modular-dependencies-using-maven - reformat everything? At least indentation? +- Consider porting stuff in "contrib" July 6th 2009: diff --git a/core/src/main/java/org/ode4j/ode/internal/Common.java b/core/src/main/java/org/ode4j/ode/internal/Common.java index 3634d90c..2c86eaf7 100644 --- a/core/src/main/java/org/ode4j/ode/internal/Common.java +++ b/core/src/main/java/org/ode4j/ode/internal/Common.java @@ -72,7 +72,7 @@ public class Common extends OdeConstants { throw new RuntimeException("dDOUBLE == dSINGLE"); } if (dDOUBLE) { - //TODO use MIN_VALUE instead? IEEE 754 ... + // dEpsilon = FLT_EPSILON or DBL_EPSILON dEpsilon = Double.MIN_NORMAL; MAX_FLOAT = Double.MAX_VALUE; } else { @@ -99,8 +99,7 @@ public class Common extends OdeConstants { public static final int d_MEMORY_OUT_OF_MEMORY = 1; -//From config-defaults.h - //TODO ??? + //From config-defaults.h /** @deprecated TZ this can be removed? */ @Deprecated public static final boolean dATOMICS_ENABLED = false; @@ -108,8 +107,6 @@ public class Common extends OdeConstants { public static final boolean dTRIMESH_OPCODE_USE_OLD_TRIMESH_TRIMESH_COLLIDER = false; - //TODO - //http://www.codeguru.com/forum/printthread.php?t=323835 //TODO use MACRO //#define EPSILON 0.0001 // Define your own tolerance //#define FLOAT_EQ(x,v) (((v - EPSILON) < x) && (x <( v + EPSILON))) @@ -161,11 +158,7 @@ public static void dUASSERT(int a, String msg) { } public static void dDEBUGMSG(String msg) { - StringWriter sw = new StringWriter(); - new PrintWriter(sw); - new RuntimeException(msg).printStackTrace(new PrintWriter(sw)); - String msg2 = sw.toString(); - dMessage (d_ERR_UASSERT, msg2); + dMessage (d_ERR_UASSERT, msg); } // #ifdef __GNUC__ @@ -498,21 +491,21 @@ static class dDynamicsAxis { //#elif defined(dDOUBLE) //#define REAL(x) (x) - //#define dRecip(x) (1.0/(x)) //TODO replace + //#define dRecip(x) (1.0/(x)) public static double dRecip(double x) { return 1.0/x; } - //#define dSqrt(x) sqrt(x) //TODO replace + //#define dSqrt(x) sqrt(x) public static double dSqrt(double x) { return Math.sqrt(x); } //#define dRecipSqrt(x) (1.0/sqrt(x)) public static double dRecipSqrt(double x) { return 1.0/Math.sqrt(x); } - //#define dSin(x) sin(x)//TODO replace + //#define dSin(x) sin(x) public static double dSin(double x) { return Math.sin(x); } - //#define dCos(x) cos(x) //TODO replace + //#define dCos(x) cos(x) public static double dCos(double x) { return Math.cos(x); } - //#define dFabs(x) fabs(x) //TODO replace + //#define dFabs(x) fabs(x) public static double dFabs(double x) { return Math.abs(x); } - //#define dAtan2(y,x) atan2((y),(x)) //TODO replace + //#define dAtan2(y,x) atan2((y),(x)) public static double dAtan2(double y, double x) { return Math.atan2(y, x); } @@ -525,12 +518,12 @@ public static double dAcos(double x) { return Math.acos(x); } - //#define dFMod(a,b) (fmod((a),(b))) //TODO replace + //#define dFMod(a,b) (fmod((a),(b))) public static double dFMod(double x) { throw new UnsupportedOperationException(); //return Math.fmod(x); } - //#define dFloor(x) floor(x) //TODO replace + //#define dFloor(x) floor(x) public static double dFloor(double x) { return Math.floor(x); } //#define dCeil(x) ceilf(x) /* ceil */ diff --git a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java index 126aabf6..ef1fcb4a 100644 --- a/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java +++ b/core/src/main/java/org/ode4j/ode/internal/DxQuickStep.java @@ -1120,16 +1120,18 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext final int ofsi = getMIndex(mindex, ji); final int infom = getMIndex(mindex, ji + 1) - ofsi; int jRow = ofsi * JME__MAX; - int jEnd = jRow + infom * JME__MAX; - for (int jCurr = jRow; jCurr != jEnd; jCurr += JME__MAX) { - dSetZero(J, jCurr + JME__J1_MIN, JME__J1_COUNT); - J[jCurr + JME_RHS] = 0.0; - J[jCurr + JME_CFM] = worldCFM; - dSetZero(J, jCurr + JME__J2_MIN, JME__J2_COUNT); - J[jCurr + JME_LO] = -dInfinity; - J[jCurr + JME_HI] = dInfinity; - } - dSASSERT(JME__J1_COUNT + 2 + JME__J2_COUNT + 2 == JME__MAX); + { + int jEnd = jRow + infom * JME__MAX; + for (int jCurr = jRow; jCurr != jEnd; jCurr += JME__MAX) { + dSetZero(J, jCurr + JME__J1_MIN, JME__J1_COUNT); + J[jCurr + JME_RHS] = 0.0; + J[jCurr + JME_CFM] = worldCFM; + dSetZero(J, jCurr + JME__J2_MIN, JME__J2_COUNT); + J[jCurr + JME_LO] = -dInfinity; + J[jCurr + JME_HI] = dInfinity; + } + dSASSERT(JME__J1_COUNT + 2 + JME__J2_COUNT + 2 == JME__MAX); + } int findexRow = ofsi; dSetValue(findex, findexRow, infom, -1); @@ -1138,22 +1140,34 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext JME__MAX, J, jRow + JME__RHS_CFM_MIN, J, jRow + JME__LO_HI_MIN, findex, findexRow); // findex iteration is compact and is not going to pollute caches - do it first - // adjust returned findex values for global index numbering - // TZ: This looks alright, but is different from the original where we use findexRow - for (int j = infom; j != 0; ) { - --j; - int fival = findex[j+ofsi]; - if (fival != -1) { - findex[j+ofsi] = fival + ofsi; - validFIndices++; - } - } - - for (int jCurr = jRow; jCurr != jEnd; jCurr += JME__MAX) { - J[jCurr + JME_RHS] *= stepsizeRecip; - J[jCurr + JME_CFM] *= stepsizeRecip; - } - + { + // adjust returned findex values for global index numbering + int findicesEndOfs = findexRow + infom; + for (int findexCurrOfs = findexRow; findexCurrOfs != findicesEndOfs; ++findexCurrOfs) { + int fival = findex[findexCurrOfs]; // *findexCurr; + if (fival != -1) { + findex[findexCurrOfs] = fival + ofsi; // *findexCurr = fival + ofsi; + ++validFIndices; + } + } + // TZ: This looks alright, but is different from the original where we use findexRow +// for (int j = infom; j != 0; ) { +// --j; +// int fival = findex[j + ofsi]; +// if (fival != -1) { +// findex[j + ofsi] = fival + ofsi; +// ++validFIndices; +// } +// } + } + { + // dReal *const JEnd = JRow + infom * JME__MAX; + int jEnd = jRow + infom * JME__MAX; + for (int jCurr = jRow; jCurr != jEnd; jCurr += JME__MAX) { + J[jCurr + JME_RHS] *= stepsizeRecip; + J[jCurr + JME_CFM] *= stepsizeRecip; + } + } // we need a copy of Jacobian for joint feedbacks // because it gets destroyed by SOR solver // instead of saving all Jacobian, we can save just rows @@ -1162,38 +1176,24 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext if (mfbIndex != getMIndex(mindex, ji + 1)) { //mindex[ji + 1].fbIndex) { // dReal *const JEnd = JRow + infom * JME__MAX; // dReal *JCopyRow = JCopy + mfbIndex * JCE__MAX; // Random access by mfbIndex here! Do not optimize! - final int jEndMfb = jRow + infom * JME__MAX; + final int jEnd = jRow + infom * JME__MAX; int JCopyRow = jCopy_ofs + mfbIndex * JCE__MAX; // Random access by mfbIndex here! Do not optimize! //for (const dReal *JCurr = JRow; ; ) { - for (int jCurr = jRow; jCurr < jEndMfb ;jCurr += JME__MAX) { + for (int jCurr = jRow; jCurr < jEnd ;) { //for (unsigned i = 0; i != JME__J1_COUNT; ++i) { JCopyRow[i + JCE__J1_MIN] = JCurr[i + JME__J1_MIN]; } //for (unsigned j = 0; j != JME__J2_COUNT; ++j) { JCopyRow[j + JCE__J2_MIN] = JCurr[j + JME__J2_MIN]; } - System.arraycopy(J, jCurr + JME__J1_MIN, Jcopy, jCopy_ofs + JCE__J1_MIN, JME__J1_COUNT); - System.arraycopy(J, jCurr + JME__J2_MIN, Jcopy, jCopy_ofs + JCE__J2_MIN, JME__J2_COUNT); + System.arraycopy(J, jCurr + JME__J1_MIN, Jcopy, JCopyRow + JCE__J1_MIN, JME__J1_COUNT); + System.arraycopy(J, jCurr + JME__J2_MIN, Jcopy, JCopyRow + JCE__J2_MIN, JME__J2_COUNT); JCopyRow += JCE__MAX; - // TODO CHECK-TZ - // TODO CHECK-TZ - // TODO CHECK-TZ - // TODO CHECK-TZ - // TODO CHECK-TZ - // TODO CHECK-TZ - // TODO CHECK-TZ - // TODO CHECK-TZ - // TZ move this outside of loop // dSASSERT((unsigned)JCE__J1_COUNT == JME__J1_COUNT); // dSASSERT((unsigned)JCE__J2_COUNT == JME__J2_COUNT); // dSASSERT(JCE__J1_COUNT + JCE__J2_COUNT == JCE__MAX); -// int mfbcurr = mindex[ji * 2 + 1], mfbnext = mindex[ji * 2 + 3]; -// int mfbCount = mfbnext - mfbcurr; -// if (mfbCount != 0) { -// int jEndMfb = jRow + mfbCount * JME__MAX; -// for (int jCurr = jRow; jCurr < jEndMfb ;jCurr += JME__MAX) { -// System.arraycopy(J, jCurr + JME__J1_MIN, Jcopy, jCopy_ofs + JCE__J1_MIN, JME__J1_COUNT); -// System.arraycopy(J, jCurr + JME__J2_MIN, Jcopy, jCopy_ofs + JCE__J2_MIN, JME__J2_COUNT); -// jCopy_ofs += JCE__MAX; + if ((jCurr += JME__MAX) == jEnd) { + break; + } } } } @@ -1205,12 +1205,6 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext stage2CallContext dSASSERT(JCE__J2_COUNT == JME__J2_COUNT); dSASSERT(JCE__J1_COUNT + JCE__J2_COUNT == JCE__MAX); - // TZ: additional assert for System.arraycopy optimization: - dSASSERT(JCE__J1_MIN == 0); - dSASSERT(JCE__J2_MIN == 6); - dSASSERT(JME__J1_COUNT + JME__J2_COUNT == JCE__MAX); - - { int[] jb = localContext.m_jb; @@ -1663,11 +1657,12 @@ void dxQuickStepIsland_Stage4LCP_ReorderPrep(dxQuickStepperStage4CallContext sta { dxQuickStepperLocalContext localContext = stage4CallContext.m_localContext; int m = localContext.m_m; + int valid_findices = localContext.m_valid_findices.get(); IndexError []order = stage4CallContext.m_order; // make sure constraints with findex < 0 come first. int orderhead = 0; - int ordertail = m; + int ordertail = m - valid_findices; int[] findex = localContext.m_findex; // Fill the array from both ends @@ -1676,13 +1671,8 @@ void dxQuickStepIsland_Stage4LCP_ReorderPrep(dxQuickStepperStage4CallContext sta order[orderhead].index = i; // Place them at the front ++orderhead; } else { - // TODO CHECK-TZ Has this been fixed with the recent bug fixes? - // WARNING!!! - // The dependent constraints are put in reverse order here (backwards to front). - // They MUST be ordered this way. - // Putting them in normal order makes simulation less stable for some mysterious reason. - --ordertail; - order[ordertail].index = i; // Place them at the end + order[ordertail].index = i; // Place them at the end + ++ordertail; } } } diff --git a/demo/src/main/java/org/ode4j/demo/DemoFeedback.java b/demo/src/main/java/org/ode4j/demo/DemoFeedback.java index f21fb758..d648e895 100644 --- a/demo/src/main/java/org/ode4j/demo/DemoFeedback.java +++ b/demo/src/main/java/org/ode4j/demo/DemoFeedback.java @@ -89,7 +89,6 @@ private void nearCallback (Object data, DGeom o1, DGeom o2) if ( o1 instanceof DSpace || o2 instanceof DSpace ) { - System.err.println("testing space " + o1 + " " + o2); // colliding a space with something OdeHelper.spaceCollide2(o1,o2,data,nearCallback); // Note we do not want to test intersections within a space, From 4e4dcd429189f4ed31b3301f946eeaa38f8d8fc8 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 10 May 2023 15:13:06 +0200 Subject: [PATCH 26/27] Quickstep works!! -> Test and do TODO --- core/src/main/java/org/ode4j/ode/internal/Common.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/ode4j/ode/internal/Common.java b/core/src/main/java/org/ode4j/ode/internal/Common.java index 2c86eaf7..f8caae3a 100644 --- a/core/src/main/java/org/ode4j/ode/internal/Common.java +++ b/core/src/main/java/org/ode4j/ode/internal/Common.java @@ -24,9 +24,6 @@ *************************************************************************/ package org.ode4j.ode.internal; -import java.io.PrintWriter; -import java.io.StringWriter; - import org.ode4j.math.DVector3; import org.ode4j.ode.DGeom.DNearCallback; import org.ode4j.ode.DWorld; @@ -178,7 +175,6 @@ public static void dDEBUGMSG(String msg) { // #endif public static void dSASSERT(boolean a) { - assert(a); if (!a) { dDebug (d_ERR_SASSERT, "Static assert failed"); } @@ -295,7 +291,7 @@ public static void dAVERIFY(Object a) { * @return Padded offset */ public static int dPAD(int a) { - return (((a) > 1) ? (((a) + 3) & (int)(~3)) : (a)); + return (((a) > 1) ? (((a) + 3) & (~3)) : (a)); } //#define dPAD(a) (((a) > 1) ? (((a) + 3) & (int)(~3)) : (a)) @@ -757,10 +753,10 @@ public static void dxSwap(boolean[] one, int oneP, boolean[] another, int anothe // return value < lo ? (value_type)lo : value > hi ? (value_type)hi : value; // } static double dxClamp(double value, double lo, double hi) { - return value < lo ? lo : value > hi ? hi : value; + return value < lo ? lo : Math.min(value, hi); } static int dxClamp(int value, int lo, int hi) { - return value < lo ? lo : value > hi ? hi : value; + return value < lo ? lo : Math.min(value, hi); } From 1b06a309ddb59175d9c014ebe90cb20e2fd46071 Mon Sep 17 00:00:00 2001 From: tzaeschke Date: Wed, 10 May 2023 15:17:07 +0200 Subject: [PATCH 27/27] Quickstep works!! -> Test and do TODO --- CHANGELOG.txt | 10 +- .../ode/internal/CollideTrimeshBoxOld.java | 1646 ----------------- 2 files changed, 2 insertions(+), 1654 deletions(-) delete mode 100644 core/src/main/java/org/ode4j/ode/internal/CollideTrimeshBoxOld.java diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8d79de5a..d7ba324b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -44,14 +44,8 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col ===== - Port updates until 0.16.2. This includes some libCCD updates missing fro the 0.15.1 update. - - TODO - - Check DemoFeedback - - Remove CollideTrimeshBoxOld.java - - Remove all "dxt" stuff - - DONE: all Except listed in TODO.txt and quickstep.cpp - + This excludes improved solution finders with anything from *Cooperative* and ThreadedEquationSolverLDLT*. + [#97](https://github.com/tzaeschke/ode4j/pull/97) - Added GutHub Actions CI builds for Java 8 and 9. [#95](https://github.com/tzaeschke/ode4j/pull/95) - Added default logger for demos and tests. [#94](https://github.com/tzaeschke/ode4j/pull/94) - Added Android API compliance checker, now for API level 24 (the lowest that ode4j passed without changes) diff --git a/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshBoxOld.java b/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshBoxOld.java deleted file mode 100644 index db25acc1..00000000 --- a/core/src/main/java/org/ode4j/ode/internal/CollideTrimeshBoxOld.java +++ /dev/null @@ -1,1646 +0,0 @@ -/************************************************************************* - * * - * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * - * All rights reserved. Email: russ@q12.org Web: www.q12.org * - * Open Dynamics Engine 4J, Copyright (C) 2009-2014 Tilmann Zaeschke * - * All rights reserved. Email: ode4j@gmx.de Web: www.ode4j.org * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of EITHER: * - * (1) The GNU Lesser General Public License as published by the Free * - * Software Foundation; either version 2.1 of the License, or (at * - * your option) any later version. The text of the GNU Lesser * - * General Public License is included with this library in the * - * file LICENSE.TXT. * - * (2) The BSD-style license that is included with this library in * - * the file ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * - * LICENSE.TXT, ODE-LICENSE-BSD.TXT and ODE4J-LICENSE-BSD.TXT for more * - * details. * - * * - *************************************************************************/ -package org.ode4j.ode.internal; - -import org.ode4j.math.DMatrix3; -import org.ode4j.math.DMatrix3C; -import org.ode4j.math.DVector3; -import org.ode4j.math.DVector3C; -import org.ode4j.math.DVector4; -import org.ode4j.math.DVector4C; -import org.ode4j.ode.DAABBC; -import org.ode4j.ode.DColliderFn; -import org.ode4j.ode.DContactGeom; -import org.ode4j.ode.DContactGeomBuffer; -import org.ode4j.ode.DGeom; -import org.ode4j.ode.internal.cpp4j.java.RefBoolean; -import org.ode4j.ode.internal.cpp4j.java.RefDouble; -import org.ode4j.ode.internal.cpp4j.java.RefInt; -import org.ode4j.ode.internal.gimpact.GimDynArrayInt; -import org.ode4j.ode.internal.gimpact.GimTrimesh; -import org.ode4j.ode.internal.gimpact.GimGeometry.aabb3f; -import org.ode4j.ode.internal.gimpact.GimGeometry.vec3f; -import org.ode4j.ode.internal.trimesh.DxTriMesh; - -import static org.ode4j.ode.OdeConstants.*; -import static org.ode4j.ode.internal.Common.*; - -/************************************************************************* - * * - * Triangle-box collider by Alen Ladavac and Vedran Klanac. * - * Ported to ODE by Oskari Nyman. * - * Ported to Java by Tilmann Zaeschke. * - * * - *************************************************************************/ -public class CollideTrimeshBoxOld implements DColliderFn { - - @Override - public int dColliderFn(DGeom o1, DGeom o2, int flags, - DContactGeomBuffer contacts) { - return dCollideBTL((DxTriMesh)o1, (DxBox)o2, flags, contacts, 1); - } - - // #if dTRIMESH_ENABLED - - - // static void - // GenerateContact(int in_Flags, dContactGeom* in_Contacts, int in_Stride, - // dxGeom* in_g1, dxGeom* in_g2, int TriIndex, - // const dVector3 in_ContactPos, const dVector3 in_Normal, dReal in_Depth, - // int& OutTriCount); - - - // largest number, double or float - // #if defined(dSINGLE) - // #define MAXVALUE FLT_MAX - // #else - // #define MAXVALUE DBL_MAX - // #endif - private static final double MAXVALUE = Double.MAX_VALUE; - - - // dVector3 - // r=a-b - // #define SUBTRACT(a,b,r) do{ \ - // (r)[0]=(a)[0] - (b)[0]; \ - // (r)[1]=(a)[1] - (b)[1]; \ - // (r)[2]=(a)[2] - (b)[2]; }while(0) - private void SUBTRACT(DVector3C a, DVector3C b, DVector3 r) { - r.eqDiff(a, b); - } - - - // dVector3 - // a=b - // #define SET(a,b) do{ \ - // (a)[0]=(b)[0]; \ - // (a)[1]=(b)[1]; \ - // (a)[2]=(b)[2]; }while(0) - private void SET(DVector3 a, DVector3C b) { - a.set(b); - } - - - // dMatrix3 - // a=b - // #define SETM(a,b) do{ \ - // (a)[0]=(b)[0]; \ - // (a)[1]=(b)[1]; \ - // (a)[2]=(b)[2]; \ - // (a)[3]=(b)[3]; \ - // (a)[4]=(b)[4]; \ - // (a)[5]=(b)[5]; \ - // (a)[6]=(b)[6]; \ - // (a)[7]=(b)[7]; \ - // (a)[8]=(b)[8]; \ - // (a)[9]=(b)[9]; \ - // (a)[10]=(b)[10]; \ - // (a)[11]=(b)[11]; }while(0) - // /** a.set(b); */ - // private void SETM(DMatrix3 a, DMatrix3C b) { - // a.set(b); - // } - - - // dVector3 - // r=a+b - // #define ADD(a,b,r) do{ \ - // (r)[0]=(a)[0] + (b)[0]; \ - // (r)[1]=(a)[1] + (b)[1]; \ - // (r)[2]=(a)[2] + (b)[2]; }while(0) - private void ADD(DVector3C a, DVector3C b, DVector3 r) { - r.eqSum(a, b); - } - - - // dMatrix3, int, dVector3 - // v=column a from m - // #define GETCOL(m,a,v) do{ \ - // (v)[0]=(m)[(a)+0]; \ - // (v)[1]=(m)[(a)+4]; \ - // (v)[2]=(m)[(a)+8]; }while(0) - private void GETCOL(DMatrix3C m, int a, DVector3 v) { - if (a==0) { v.set(m.get00(), m.get10(), m.get20()); } - else if (a==1) { v.set(m.get01(), m.get11(), m.get21()); } - else if (a==2) { v.set(m.get02(), m.get12(), m.get22()); } - else throw new IllegalArgumentException("col=" + a); - } - - - // dVector4, dVector3 - // distance between plane p and point v - // #define POINTDISTANCE(p,v) \ - // ( p[0]*v[0] + p[1]*v[1] + p[2]*v[2] + p[3] ) - private double POINTDISTANCE(DVector4C p, DVector3C v) { - return p.get0()*v.get0() + p.get1()*v.get1() + p.get2()*v.get2() + p.get3(); - } - - - // dVector4, dVector3, dReal - // construct plane from normal and d - // #define CONSTRUCTPLANE(plane,normal,d) do{ \ - // plane[0]=normal[0];\ - // plane[1]=normal[1];\ - // plane[2]=normal[2];\ - // plane[3]=d; }while(0) - private void CONSTRUCTPLANE(DVector4 plane, DVector3C n, double d) { - plane.set( n.get0(), n.get1(), n.get2(), d); - } - - - // dVector3 - // length of vector a - // #define LENGTHOF(a) \ - // dSqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]) - private double LENGTHOF(DVector3C a) { - return a.length(); - } - - - private class sTrimeshBoxColliderData - { - //sTrimeshBoxColliderData(): m_iBestAxis(0), m_iExitAxis(0), m_ctContacts(0) {} - sTrimeshBoxColliderData() { m_iBestAxis=(0); m_iExitAxis=(0); m_ctContacts=new RefInt(0); } - - // void SetupInitialContext(dxTriMesh *TriMesh, dxGeom *BoxGeom, - // int Flags, dContactGeom* Contacts, int Stride); - // int TestCollisionForSingleTriangle(int ctContacts0, int Triint, - // dVector3 dv[3], bool &bOutFinishSearching); - // - // bool _cldTestNormal(dReal fp0, dReal fR, dVector3 vNormal, int iAxis); - // bool _cldTestFace(dReal fp0, dReal fp1, dReal fp2, dReal fR, dReal fD, - // dVector3 vNormal, int iAxis); - // bool _cldTestEdge(dReal fp0, dReal fp1, dReal fR, dReal fD, - // dVector3 vNormal, int iAxis); - // bool _cldTestSeparatingAxes(const dVector3 &v0, const dVector3 &v1, const dVector3 &v2); - // void _cldClipping(const dVector3 &v0, const dVector3 &v1, const dVector3 &v2, int TriIndex); - // void _cldTestOneTriangle(const dVector3 &v0, const dVector3 &v1, const dVector3 &v2, int TriIndex); - - // box data - final DMatrix3 m_mHullBoxRot = new DMatrix3(); - final DVector3 m_vHullBoxPos = new DVector3(); - final DVector3 m_vBoxHalfSize = new DVector3(); - - // mesh data - final DVector3 m_vHullDstPos = new DVector3(); - - // global collider data - final DVector3 m_vBestNormal = new DVector3(); - //dReal m_fBestDepth; - double m_fBestDepth; - int m_iBestAxis; - @SuppressWarnings("unused") - int m_iExitAxis; - final DVector3 m_vE0 = new DVector3(), m_vE1 = new DVector3(), m_vE2 = new DVector3(), m_vN = new DVector3(); - - // global info for contact creation - int m_iFlags; - // dContactGeom *m_ContactGeoms; - DContactGeomBuffer m_ContactGeoms; - int m_iStride; - // dxGeom *m_Geom1; - // dxGeom *m_Geom2; - DxGeom m_Geom1; - DxGeom m_Geom2; - RefInt m_ctContacts; - // }; - - // Test normal of mesh face as separating axis for intersection - //boolean sTrimeshBoxColliderData::_cldTestNormal(dReal fp0, dReal fR, dVector3 vNormal, int iAxis) - boolean _cldTestNormal(double fp0, double fR, DVector3C vNormal, int iAxis) - { - // calculate overlapping interval of box and triangle - double fDepth = fR+fp0; - - // if we do not overlap - if ( fDepth<0 ) { - // do nothing - return false; - } - - // calculate normal's length - double fLength = LENGTHOF(vNormal); - // if long enough - if ( fLength > 0.0f ) { - - double fOneOverLength = 1.0f/fLength; - // normalize depth - fDepth = fDepth*fOneOverLength; - - // get minimum depth - if (fDepth < m_fBestDepth) { - // m_vBestNormal[0] = -vNormal[0]*fOneOverLength; - // m_vBestNormal[1] = -vNormal[1]*fOneOverLength; - // m_vBestNormal[2] = -vNormal[2]*fOneOverLength; - m_vBestNormal.set(vNormal).scale(-fOneOverLength); - m_iBestAxis = iAxis; - //dAASSERT(fDepth>=0); - m_fBestDepth = fDepth; - } - } - - return true; - } - - - - - // Test box axis as separating axis - // bool sTrimeshBoxColliderData::_cldTestFace(dReal fp0, dReal fp1, dReal fp2, dReal fR, dReal fD, - // dVector3 vNormal, int iAxis) - boolean _cldTestFace(double fp0, double fp1, double fp2, double fR, double fD, - DVector3 vNormal, int iAxis) - { - double fMin, fMax; - - // find min of triangle interval - if ( fp0 < fp1 ) { - if ( fp0 < fp2 ) { - fMin = fp0; - } else { - fMin = fp2; - } - } else { - if( fp1 < fp2 ) { - fMin = fp1; - } else { - fMin = fp2; - } - } - - // find max of triangle interval - if ( fp0 > fp1 ) { - if ( fp0 > fp2 ) { - fMax = fp0; - } else { - fMax = fp2; - } - } else { - if( fp1 > fp2 ) { - fMax = fp1; - } else { - fMax = fp2; - } - } - - // calculate minimum and maximum depth - double fDepthMin = fR - fMin; - double fDepthMax = fMax + fR; - - // if we dont't have overlapping interval - if ( fDepthMin < 0 || fDepthMax < 0 ) { - // do nothing - return false; - } - - double fDepth = 0; - - // if greater depth is on negative side - if ( fDepthMin > fDepthMax ) { - // use smaller depth (one from positive side) - fDepth = fDepthMax; - // flip normal direction - // vNormal[0] = -vNormal[0]; - // vNormal[1] = -vNormal[1]; - // vNormal[2] = -vNormal[2]; - vNormal.scale(-1); - fD = -fD; - // if greater depth is on positive side - } else { - // use smaller depth (one from negative side) - fDepth = fDepthMin; - } - - // if lower depth than best found so far - if (fDepth < m_fBestDepth) { - // remember current axis as best axis - // m_vBestNormal[0] = vNormal[0]; - // m_vBestNormal[1] = vNormal[1]; - // m_vBestNormal[2] = vNormal[2]; - m_vBestNormal.set(vNormal); - m_iBestAxis = iAxis; - //dAASSERT(fDepth>=0); - m_fBestDepth = fDepth; - } - - return true; - } - - // Test cross products of box axis and triangle edges as separating axis - // bool sTrimeshBoxColliderData::_cldTestEdge(dReal fp0, dReal fp1, dReal fR, dReal fD, - // dVector3 vNormal, int iAxis) - boolean _cldTestEdge(double fp0, double fp1, double fR, double fD, - DVector3 vNormal, int iAxis) - { - double fMin, fMax; - - // ===== Begin Patch by Francisco Leon, 2006/10/28 ===== - - // Fixed Null Normal. This prevents boxes passing - // through trimeshes at certain contact angles - - // fMin = vNormal[0] * vNormal[0] + - // vNormal[1] * vNormal[1] + - // vNormal[2] * vNormal[2]; - fMin = vNormal.lengthSquared(); - - if ( fMin <= dEpsilon ) /// THIS NORMAL WOULD BE DANGEROUS - return true; - - // ===== Ending Patch by Francisco Leon ===== - - - // calculate min and max interval values - if ( fp0 < fp1 ) { - fMin = fp0; - fMax = fp1; - } else { - fMin = fp1; - fMax = fp0; - } - - // check if we overlapp - double fDepthMin = fR - fMin; - double fDepthMax = fMax + fR; - - // if we don't overlapp - if ( fDepthMin < 0 || fDepthMax < 0 ) { - // do nothing - return false; - } - - double fDepth; - - // if greater depth is on negative side - if ( fDepthMin > fDepthMax ) { - // use smaller depth (one from positive side) - fDepth = fDepthMax; - // flip normal direction - // vNormal[0] = -vNormal[0]; - // vNormal[1] = -vNormal[1]; - // vNormal[2] = -vNormal[2]; - vNormal.scale(-1); - fD = -fD; - // if greater depth is on positive side - } else { - // use smaller depth (one from negative side) - fDepth = fDepthMin; - } - - // calculate normal's length - double fLength = LENGTHOF(vNormal); - - // if long enough - if ( fLength > 0.0f ) { - - // normalize depth - double fOneOverLength = 1.0f/fLength; - fDepth = fDepth*fOneOverLength; - fD*=fOneOverLength; - - // if lower depth than best found so far (favor face over edges) - if (fDepth*1.5f < m_fBestDepth) { - // remember current axis as best axis - // m_vBestNormal[0] = vNormal[0]*fOneOverLength; - // m_vBestNormal[1] = vNormal[1]*fOneOverLength; - // m_vBestNormal[2] = vNormal[2]*fOneOverLength; - m_vBestNormal.set(vNormal).scale(fOneOverLength); // TODO TZ here positive, above negative, correct? - m_iBestAxis = iAxis; - //dAASSERT(fDepth>=0); - m_fBestDepth = fDepth; - } - } - - return true; - } - - - // clip polygon with plane and generate new polygon points - // static void _cldClipPolyToPlane( dVector3 avArrayIn[], int ctIn, - // dVector3 avArrayOut[], int &ctOut, - // const dVector4 &plPlane ) - void _cldClipPolyToPlane( DVector3 avArrayIn[], int ctIn, - DVector3 avArrayOut[], RefInt ctOut, - final DVector4C plPlane ) - { - // start with no output points - ctOut.i = 0; - - int i0 = ctIn-1; - - // for each edge in input polygon - for (int i1=0; i1= 0 ) { - // emit point - // avArrayOut[ctOut][0] = avArrayIn[i0][0]; - // avArrayOut[ctOut][1] = avArrayIn[i0][1]; - // avArrayOut[ctOut][2] = avArrayIn[i0][2]; - avArrayOut[ctOut.i].set( avArrayIn[i0] ); - ctOut.i++; - } - - // if points are on different sides - if( (fDistance0 > 0 && fDistance1 < 0) || ( fDistance0 < 0 && fDistance1 > 0) ) { - - // find intersection point of edge and plane - DVector3 vIntersectionPoint = new DVector3(); - // vIntersectionPoint[0]= avArrayIn[i0][0] - (avArrayIn[i0][0]-avArrayIn[i1][0])*fDistance0/(fDistance0-fDistance1); - // vIntersectionPoint[1]= avArrayIn[i0][1] - (avArrayIn[i0][1]-avArrayIn[i1][1])*fDistance0/(fDistance0-fDistance1); - // vIntersectionPoint[2]= avArrayIn[i0][2] - (avArrayIn[i0][2]-avArrayIn[i1][2])*fDistance0/(fDistance0-fDistance1); - vIntersectionPoint.eqDiff( avArrayIn[i0], avArrayIn[i1] ); - vIntersectionPoint.scale( - fDistance0/(fDistance0-fDistance1) ); //negate! - vIntersectionPoint.add( avArrayIn[i0] ); - - // emit intersection point - // avArrayOut[ctOut][0] = vIntersectionPoint[0]; - // avArrayOut[ctOut][1] = vIntersectionPoint[1]; - // avArrayOut[ctOut][2] = vIntersectionPoint[2]; - avArrayOut[ctOut.i].set( vIntersectionPoint ); - ctOut.i++; - } - } - - } - - - // bool sTrimeshBoxColliderData::_cldTestSeparatingAxes(const dVector3 &v0, const dVector3 &v1, const dVector3 &v2) { - boolean _cldTestSeparatingAxes(final DVector3C v0, final DVector3C v1, final DVector3C v2) { - // reset best axis - m_iBestAxis = 0; - m_iExitAxis = -1; - m_fBestDepth = MAXVALUE; - - // calculate edges - SUBTRACT(v1,v0,m_vE0); - SUBTRACT(v2,v0,m_vE1); - SUBTRACT(m_vE1,m_vE0,m_vE2); - - // calculate poly normal - //dCROSS(m_vN,=,m_vE0,m_vE1); - m_vN.eqCross(m_vE0, m_vE1); - - // calculate length of face normal - double fNLen = LENGTHOF(m_vN); - - // Even though all triangles might be initially valid, - // a triangle may degenerate into a segment after applying - // space transformation. - if (fNLen == 0) { - return false; - } - - // extract box axes as vectors - DVector3 vA0 = new DVector3(), vA1 = new DVector3(), vA2 = new DVector3(); - GETCOL(m_mHullBoxRot,0,vA0); - GETCOL(m_mHullBoxRot,1,vA1); - GETCOL(m_mHullBoxRot,2,vA2); - - // box halfsizes - double fa0 = m_vBoxHalfSize.get0(); - double fa1 = m_vBoxHalfSize.get1(); - double fa2 = m_vBoxHalfSize.get2(); - - // calculate relative position between box and triangle - DVector3 vD = new DVector3(); - SUBTRACT(v0,m_vHullBoxPos,vD); - - DVector3 vL = new DVector3(); - double fp0, fp1, fp2, fR, fD; - - // Test separating axes for intersection - // ************************************************ - // Axis 1 - Triangle Normal - SET(vL,m_vN); - fp0 = vL.dot(vD); - fp1 = fp0; - fp2 = fp0; - fR=fa0*dFabs( m_vN.dot(vA0) ) + fa1 * dFabs( m_vN.dot(vA1) ) + fa2 * dFabs( m_vN.dot(vA2) ); - - if (!_cldTestNormal(fp0, fR, vL, 1)) { - m_iExitAxis=1; - return false; - } - - // ************************************************ - - // Test Faces - // ************************************************ - // Axis 2 - Box X-Axis - SET(vL,vA0); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 + vA0.dot(m_vE0); - fp2 = fp0 + vA0.dot(m_vE1); - fR = fa0; - - if (!_cldTestFace(fp0, fp1, fp2, fR, fD, vL, 2)) { - m_iExitAxis=2; - return false; - } - // ************************************************ - - // ************************************************ - // Axis 3 - Box Y-Axis - SET(vL,vA1); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 + vA1.dot(m_vE0); - fp2 = fp0 + vA1.dot(m_vE1); - fR = fa1; - - if (!_cldTestFace(fp0, fp1, fp2, fR, fD, vL, 3)) { - m_iExitAxis=3; - return false; - } - - // ************************************************ - - // ************************************************ - // Axis 4 - Box Z-Axis - SET(vL,vA2); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 + vA2.dot(m_vE0); - fp2 = fp0 + vA2.dot(m_vE1); - fR = fa2; - - if (!_cldTestFace(fp0, fp1, fp2, fR, fD, vL, 4)) { - m_iExitAxis=4; - return false; - } - - // ************************************************ - - // Test Edges - // ************************************************ - // Axis 5 - Box X-Axis cross Edge0 - //dCROSS(vL,=,vA0,m_vE0); - vL.eqCross(vA0, m_vE0); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0; - fp2 = fp0 + vA0.dot(m_vN); - fR = fa1 * dFabs(vA2.dot(m_vE0)) + fa2 * dFabs(vA1.dot(m_vE0)); - - if (!_cldTestEdge(fp1, fp2, fR, fD, vL, 5)) { - m_iExitAxis=5; - return false; - } - // ************************************************ - - // ************************************************ - // Axis 6 - Box X-Axis cross Edge1 - //dCROSS(vL,=,vA0,m_vE1); - vL.eqCross(vA0, m_vE1); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 - vA0.dot(m_vN); - fp2 = fp0; - fR = fa1 * dFabs(vA2.dot(m_vE1)) + fa2 * dFabs(vA1.dot(m_vE1)); - - if (!_cldTestEdge(fp0, fp1, fR, fD, vL, 6)) { - m_iExitAxis=6; - return false; - } - // ************************************************ - - // ************************************************ - // Axis 7 - Box X-Axis cross Edge2 - //dCROSS(vL,=,vA0,m_vE2); - vL.eqCross(vA0, m_vE2); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 - vA0.dot(m_vN); - fp2 = fp0 - vA0.dot(m_vN); - fR = fa1 * dFabs(vA2.dot(m_vE2)) + fa2 * dFabs(vA1.dot(m_vE2)); - - if (!_cldTestEdge(fp0, fp1, fR, fD, vL, 7)) { - m_iExitAxis=7; - return false; - } - - // ************************************************ - - // ************************************************ - // Axis 8 - Box Y-Axis cross Edge0 - //dCROSS(vL,=,vA1,m_vE0); - vL.eqCross(vA1, m_vE0); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0; - fp2 = fp0 + vA1.dot(m_vN); - fR = fa0 * dFabs(vA2.dot(m_vE0)) + fa2 * dFabs(vA0.dot(m_vE0)); - - if (!_cldTestEdge(fp0, fp2, fR, fD, vL, 8)) { - m_iExitAxis=8; - return false; - } - - // ************************************************ - - // ************************************************ - // Axis 9 - Box Y-Axis cross Edge1 - //dCROSS(vL,=,vA1,m_vE1); - vL.eqCross(vA1, m_vE1); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 - vA1.dot(m_vN); - fp2 = fp0; - fR = fa0 * dFabs(vA2.dot(m_vE1)) + fa2 * dFabs(vA0.dot(m_vE1)); - - if (!_cldTestEdge(fp0, fp1, fR, fD, vL, 9)) { - m_iExitAxis=9; - return false; - } - - // ************************************************ - - // ************************************************ - // Axis 10 - Box Y-Axis cross Edge2 - //dCROSS(vL,=,vA1,m_vE2); - vL.eqCross(vA1, m_vE2); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 - vA1.dot(m_vN); - fp2 = fp0 - vA1.dot(m_vN); - fR = fa0 * dFabs(vA2.dot(m_vE2)) + fa2 * dFabs(vA0.dot(m_vE2)); - - if (!_cldTestEdge(fp0, fp1, fR, fD, vL, 10)) { - m_iExitAxis=10; - return false; - } - - // ************************************************ - - // ************************************************ - // Axis 11 - Box Z-Axis cross Edge0 - //dCROSS(vL,=,vA2,m_vE0); - vL.eqCross(vA2, m_vE0); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0; - fp2 = fp0 + vA2.dot(m_vN); - fR = fa0 * dFabs(vA1.dot(m_vE0)) + fa1 * dFabs(vA0.dot(m_vE0)); - - if (!_cldTestEdge(fp0, fp2, fR, fD, vL, 11)) { - m_iExitAxis=11; - return false; - } - // ************************************************ - - // ************************************************ - // Axis 12 - Box Z-Axis cross Edge1 - //dCROSS(vL,=,vA2,m_vE1); - vL.eqCross(vA2, m_vE1); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 - vA2.dot(m_vN); - fp2 = fp0; - fR = fa0 * dFabs(vA1.dot(m_vE1)) + fa1 * dFabs(vA0.dot(m_vE1)); - - if (!_cldTestEdge(fp0, fp1, fR, fD, vL, 12)) { - m_iExitAxis=12; - return false; - } - // ************************************************ - - // ************************************************ - // Axis 13 - Box Z-Axis cross Edge2 - // OdeMath.dCROSS(vL,OP.EQ,vA2,m_vE2); - vL.eqCross(vA2, m_vE2); - fD = vL.dot(m_vN)/fNLen; - fp0 = vL.dot(vD); - fp1 = fp0 - vA2.dot(m_vN); - fp2 = fp0 - vA2.dot(m_vN); - fR = fa0 * dFabs(vA1.dot(m_vE2)) + fa1 * dFabs(vA0.dot(m_vE2)); - - if (!_cldTestEdge(fp0, fp1, fR, fD, vL, 13)) { - m_iExitAxis=13; - return false; - } - - // ************************************************ - return true; - } - - - - - - // find two closest points on two lines - // static bool _cldClosestPointOnTwoLines( dVector3 vPoint1, dVector3 vLenVec1, - // dVector3 vPoint2, dVector3 vLenVec2, - // dReal &fvalue1, dReal &fvalue2) - boolean _cldClosestPointOnTwoLines( DVector3C vPoint1, DVector3C vLenVec1, - DVector3C vPoint2, DVector3C vLenVec2, - RefDouble fvalue1, RefDouble fvalue2) - { - // calculate denominator - DVector3 vp = new DVector3(); - SUBTRACT(vPoint2,vPoint1,vp); - double fuaub = vLenVec1.dot(vLenVec2); - double fq1 = vLenVec1.dot(vp); - double fq2 = -vLenVec2.dot(vp); - double fd = 1.0f - fuaub * fuaub; - - // if denominator is positive - if (fd > 0.0f) { - // calculate points of closest approach - fd = 1.0f/fd; - fvalue1.d = (fq1 + fuaub*fq2)*fd; - fvalue2.d = (fuaub*fq1 + fq2)*fd; - return true; - // otherwise - } else { - // lines are parallel - fvalue1.d = 0.0f; - fvalue2.d = 0.0f; - return false; - } - } - - - - - - // clip and generate contacts - // void sTrimeshBoxColliderData::_cldClipping(const dVector3 &v0, const dVector3 &v1, const dVector3 &v2, int TriIndex) { - void _cldClipping(final DVector3C v0, final DVector3C v1, final DVector3C v2, final int TriIndex) { - dIASSERT( ((m_iFlags & CONTACTS_UNIMPORTANT)==0) || m_ctContacts.i < (m_iFlags & DxGeom.NUMC_MASK) ); // Do not call the function if there is no room to store results - - // if we have edge/edge intersection - if (m_iBestAxis > 4 ) { - DVector3 vub = new DVector3(), vPb = new DVector3(), vPa = new DVector3(); - - SET(vPa,m_vHullBoxPos); - - // calculate point on box edge - for( int i=0; i<3; i++) { - DVector3 vRotCol = new DVector3(); - GETCOL(m_mHullBoxRot,i,vRotCol); - double fSign = m_vBestNormal.dot(vRotCol) > 0 ? 1.0f : -1.0f; - - // vPa[0] += fSign * m_vBoxHalfSize[i] * vRotCol[0]; - // vPa[1] += fSign * m_vBoxHalfSize[i] * vRotCol[1]; - // vPa[2] += fSign * m_vBoxHalfSize[i] * vRotCol[2]; - vPa.addScaled( vRotCol, fSign * m_vBoxHalfSize.get(i)); //TODO use colView! - } - - int iEdge = (m_iBestAxis-5)%3; - - // decide which edge is on triangle - if ( iEdge == 0 ) { - SET(vPb,v0); - SET(vub,m_vE0); - } else if ( iEdge == 1) { - SET(vPb,v2); - SET(vub,m_vE1); - } else { - SET(vPb,v1); - SET(vub,m_vE2); - } - - - // setup direction parameter for face edge - //dNormalize3(vub); - vub.normalize(); - - RefDouble fParam1 = new RefDouble(), fParam2 = new RefDouble(); - - // setup direction parameter for box edge - DVector3 vua = new DVector3(); - int col=(m_iBestAxis-5)/3; - GETCOL(m_mHullBoxRot,col,vua); - - // find two closest points on both edges - _cldClosestPointOnTwoLines( vPa, vua, vPb, vub, fParam1, fParam2 ); - // vPa[0] += vua[0]*fParam1; - // vPa[1] += vua[1]*fParam1; - // vPa[2] += vua[2]*fParam1; - vPa.addScaled( vua, fParam1.d ); - - // vPb[0] += vub[0]*fParam2; - // vPb[1] += vub[1]*fParam2; - // vPb[2] += vub[2]*fParam2; - vPb.addScaled( vub, fParam2.d ); - - // calculate collision point - DVector3 vPntTmp = new DVector3(); - ADD(vPa,vPb,vPntTmp); - - // vPntTmp[0]*=0.5f; - // vPntTmp[1]*=0.5f; - // vPntTmp[2]*=0.5f; - vPntTmp.scale( 0.5 ); - - // generate contact point between two closest points - // #if 0 //#ifdef ORIG -- if to use conditional define, GenerateContact must be moved into #else - // dContactGeom* Contact = SAFECONTACT(m_iFlags, m_ContactGeoms, m_ctContacts, m_iStride); - // Contact->depth = m_fBestDepth; - // SET(Contact->normal,m_vBestNormal); - // SET(Contact->pos,vPntTmp); - // Contact->g1 = Geom1; - // Contact->g2 = Geom2; - // Contact->side1 = TriIndex; - // Contact->side2 = -1; - // m_ctContacts++; - // #endif - GenerateContact(m_iFlags, m_ContactGeoms, m_iStride, m_Geom1, m_Geom2, TriIndex, - vPntTmp, m_vBestNormal, m_fBestDepth, m_ctContacts); - - - // if triangle is the referent face then clip box to triangle face - } else if (m_iBestAxis == 1) { - - DVector3 vNormal2 = new DVector3(); - // vNormal2[0]=-m_vBestNormal[0]; - // vNormal2[1]=-m_vBestNormal[1]; - // vNormal2[2]=-m_vBestNormal[2]; - vNormal2.set( m_vBestNormal ).scale( -1 ); - - - // vNr is normal in box frame, pointing from triangle to box - DMatrix3 mTransposed;// = new DMatrix3(); - // mTransposed[0*4+0]=m_mHullBoxRot[0*4+0]; - // mTransposed[0*4+1]=m_mHullBoxRot[1*4+0]; - // mTransposed[0*4+2]=m_mHullBoxRot[2*4+0]; - // - // mTransposed[1*4+0]=m_mHullBoxRot[0*4+1]; - // mTransposed[1*4+1]=m_mHullBoxRot[1*4+1]; - // mTransposed[1*4+2]=m_mHullBoxRot[2*4+1]; - // - // mTransposed[2*4+0]=m_mHullBoxRot[0*4+2]; - // mTransposed[2*4+1]=m_mHullBoxRot[1*4+2]; - // mTransposed[2*4+2]=m_mHullBoxRot[2*4+2]; - mTransposed = m_mHullBoxRot.reTranspose(); - - DVector3 vNr = new DVector3(); - // vNr[0]=mTransposed[0*4+0]*vNormal2[0]+ mTransposed[0*4+1]*vNormal2[1]+ mTransposed[0*4+2]*vNormal2[2]; - // vNr[1]=mTransposed[1*4+0]*vNormal2[0]+ mTransposed[1*4+1]*vNormal2[1]+ mTransposed[1*4+2]*vNormal2[2]; - // vNr[2]=mTransposed[2*4+0]*vNormal2[0]+ mTransposed[2*4+1]*vNormal2[1]+ mTransposed[2*4+2]*vNormal2[2]; - vNr.eqProd(mTransposed, vNormal2); - - - DVector3 vAbsNormal = new DVector3(); - // vAbsNormal[0] = dFabs( vNr[0] ); - // vAbsNormal[1] = dFabs( vNr[1] ); - // vAbsNormal[2] = dFabs( vNr[2] ); - vAbsNormal.set( vNr ).eqAbs(); - - // get closest face from box - int iB0, iB1, iB2; - if (vAbsNormal.get1() > vAbsNormal.get0()) { - if (vAbsNormal.get1() > vAbsNormal.get2()) { - iB1 = 0; iB0 = 1; iB2 = 2; - } else { - iB1 = 0; iB2 = 1; iB0 = 2; - } - } else { - - if (vAbsNormal.get0() > vAbsNormal.get2()) { - iB0 = 0; iB1 = 1; iB2 = 2; - } else { - iB1 = 0; iB2 = 1; iB0 = 2; - } - } - - // Here find center of box face we are going to project - DVector3 vCenter = new DVector3(); - DVector3 vRotCol = new DVector3(); - GETCOL(m_mHullBoxRot,iB0,vRotCol); - - if (vNr.get(iB0) > 0) { - // vCenter[0] = m_vHullBoxPos[0] - v0[0] - m_vBoxHalfSize[iB0] * vRotCol[0]; - // vCenter[1] = m_vHullBoxPos[1] - v0[1] - m_vBoxHalfSize[iB0] * vRotCol[1]; - // vCenter[2] = m_vHullBoxPos[2] - v0[2] - m_vBoxHalfSize[iB0] * vRotCol[2]; - vCenter.eqSum(v0, -1, vRotCol, -m_vBoxHalfSize.get(iB0)); - vCenter.add(m_vHullBoxPos); - } else { - // vCenter[0] = m_vHullBoxPos[0] - v0[0] + m_vBoxHalfSize[iB0] * vRotCol[0]; - // vCenter[1] = m_vHullBoxPos[1] - v0[1] + m_vBoxHalfSize[iB0] * vRotCol[1]; - // vCenter[2] = m_vHullBoxPos[2] - v0[2] + m_vBoxHalfSize[iB0] * vRotCol[2]; - vCenter.eqSum(v0, -1, vRotCol, m_vBoxHalfSize.get(iB0)); - vCenter.add(m_vHullBoxPos); - } - - // Here find 4 corner points of box - DVector3[] avPoints = { new DVector3(), new DVector3(), new DVector3(), new DVector3() };//[4]; - - DVector3 vRotCol2 = new DVector3(); - GETCOL(m_mHullBoxRot,iB1,vRotCol); - GETCOL(m_mHullBoxRot,iB2,vRotCol2); - - // for(int x=0;x<3;x++) { - // avPoints[0][x] = vCenter[x] + (m_vBoxHalfSize[iB1] * vRotCol[x]) - (m_vBoxHalfSize[iB2] * vRotCol2[x]); - // avPoints[1][x] = vCenter[x] - (m_vBoxHalfSize[iB1] * vRotCol[x]) - (m_vBoxHalfSize[iB2] * vRotCol2[x]); - // avPoints[2][x] = vCenter[x] - (m_vBoxHalfSize[iB1] * vRotCol[x]) + (m_vBoxHalfSize[iB2] * vRotCol2[x]); - // avPoints[3][x] = vCenter[x] + (m_vBoxHalfSize[iB1] * vRotCol[x]) + (m_vBoxHalfSize[iB2] * vRotCol2[x]); - // } - double tz1 = m_vBoxHalfSize.get(iB1); - double tz2 = m_vBoxHalfSize.get(iB2); - avPoints[0].eqSum( vRotCol, tz1, vRotCol2, -tz2).add (vCenter); - avPoints[1].eqSum( vRotCol, -tz1, vRotCol2, -tz2).add (vCenter); - avPoints[2].eqSum( vRotCol, -tz1, vRotCol2, tz2).add (vCenter); - avPoints[3].eqSum( vRotCol, tz1, vRotCol2, tz2).add (vCenter); - - // clip Box face with 4 planes of triangle (1 face plane, 3 egde planes) - DVector3[] avTempArray1 = DVector3.newArray(9); - DVector3[] avTempArray2 = DVector3.newArray(9); - DVector4 plPlane = new DVector4(); - - RefInt iTempCnt1 = new RefInt(0); - RefInt iTempCnt2 = new RefInt(0); - - // zeroify vectors - necessary? - // for(int i=0; i<9; i++) { - // // avTempArray1[i][0]=0; - // // avTempArray1[i][1]=0; - // // avTempArray1[i][2]=0; - // avTempArray1[i] = new DVector3(); - // - // // avTempArray2[i][0]=0; - // // avTempArray2[i][1]=0; - // // avTempArray2[i][2]=0; - // avTempArray2[i] = new DVector3(); - // } - - - // Normal plane - DVector3 vTemp = new DVector3(); - // vTemp[0]=-m_vN[0]; - // vTemp[1]=-m_vN[1]; - // vTemp[2]=-m_vN[2]; - vTemp.set( m_vN ).scale(-1); - //dNormalize3(vTemp); - vTemp.normalize(); - CONSTRUCTPLANE(plPlane,vTemp,0); - - _cldClipPolyToPlane( avPoints, 4, avTempArray1, iTempCnt1, plPlane ); - - - // Plane p0 - DVector3 vTemp2 = new DVector3(); - SUBTRACT(v1,v0,vTemp2); - //dCROSS(vTemp,=,m_vN,vTemp2); - vTemp.eqCross(m_vN, vTemp2); - //dNormalize3(vTemp); - vTemp.normalize(); - CONSTRUCTPLANE(plPlane,vTemp,0); - - _cldClipPolyToPlane( avTempArray1, iTempCnt1.i, avTempArray2, iTempCnt2, plPlane ); - - // Plane p1 - SUBTRACT(v2,v1,vTemp2); - //dCROSS(vTemp,=,m_vN,vTemp2); - vTemp.eqCross(m_vN, vTemp2); - //dNormalize3(vTemp); - vTemp.normalize(); - SUBTRACT(v0,v2,vTemp2); - CONSTRUCTPLANE(plPlane,vTemp,vTemp2.dot(vTemp)); - - _cldClipPolyToPlane( avTempArray2, iTempCnt2.i, avTempArray1, iTempCnt1, plPlane ); - - // Plane p2 - SUBTRACT(v0,v2,vTemp2); - //dCROSS(vTemp,=,m_vN,vTemp2); - vTemp.eqCross(m_vN, vTemp2); - //dNormalize3(vTemp); - vTemp.normalize(); - CONSTRUCTPLANE(plPlane,vTemp,0); - - _cldClipPolyToPlane( avTempArray1, iTempCnt1.i, avTempArray2, iTempCnt2, plPlane ); - - // END of clipping polygons - - // for each generated contact point - for ( int i=0; i 0) { - fTempDepth = 0; - } - - DVector3 vPntTmp = new DVector3(); - ADD(avTempArray2[i],v0,vPntTmp); - - // #if 0 //#ifdef ORIG -- if to use conditional define, GenerateContact must be moved into #else - // dContactGeom* Contact = SAFECONTACT(m_iFlags, m_ContactGeoms, m_ctContacts, m_iStride); - // - // Contact->depth = -fTempDepth; - // SET(Contact->normal,m_vBestNormal); - // SET(Contact->pos,vPntTmp); - // Contact->g1 = Geom1; - // Contact->g2 = Geom2; - // Contact->side1 = TriIndex; - // Contact->side2 = -1; - // m_ctContacts++; - // #endif - GenerateContact(m_iFlags, m_ContactGeoms, m_iStride, m_Geom1, m_Geom2, TriIndex, - vPntTmp, m_vBestNormal, -fTempDepth, m_ctContacts); - - if ((m_ctContacts.i | CONTACTS_UNIMPORTANT) == (m_iFlags & (DxGeom.NUMC_MASK | CONTACTS_UNIMPORTANT))) { - break; - } - } - - //dAASSERT(m_ctContacts>0); - - // if box face is the referent face, then clip triangle on box face - } else { // 2 <= if iBestAxis <= 4 - - // get normal of box face - DVector3 vNormal2 = new DVector3(); - SET(vNormal2,m_vBestNormal); - - // get indices of box axes in correct order - int iA0,iA1,iA2; - iA0 = m_iBestAxis-2; - if ( iA0 == 0 ) { - iA1 = 1; iA2 = 2; - } else if ( iA0 == 1 ) { - iA1 = 0; iA2 = 2; - } else { - iA1 = 0; iA2 = 1; - } - - DVector3[] avPoints = { new DVector3(), new DVector3(), new DVector3() };//new DVector3[3]; - // calculate triangle vertices in box frame - SUBTRACT(v0,m_vHullBoxPos,avPoints[0]); - SUBTRACT(v1,m_vHullBoxPos,avPoints[1]); - SUBTRACT(v2,m_vHullBoxPos,avPoints[2]); - - // CLIP Polygons - // define temp data for clipping - DVector3[] avTempArray1 = DVector3.newArray(9); - DVector3[] avTempArray2 = DVector3.newArray(9); - - RefInt iTempCnt1 = new RefInt(), iTempCnt2 = new RefInt(); - - // zeroify vectors - necessary? - // for(int i=0; i<9; i++) { - // // avTempArray1[i][0]=0; - // // avTempArray1[i][1]=0; - // // avTempArray1[i][2]=0; - // avTempArray1[i] = new DVector3(); - // - // // avTempArray2[i][0]=0; - // // avTempArray2[i][1]=0; - // // avTempArray2[i][2]=0; - // avTempArray2[i] = new DVector3(); - // } - - // clip triangle with 5 box planes (1 face plane, 4 edge planes) - - DVector4 plPlane = new DVector4(); - - // Normal plane - DVector3 vTemp = new DVector3(); - // vTemp[0]=-vNormal2[0]; - // vTemp[1]=-vNormal2[1]; - // vTemp[2]=-vNormal2[2]; - vTemp.set(vNormal2).scale(-1); - CONSTRUCTPLANE(plPlane,vTemp,m_vBoxHalfSize.get(iA0)); - - _cldClipPolyToPlane( avPoints, 3, avTempArray1, iTempCnt1, plPlane ); - - - // Plane p0 - GETCOL(m_mHullBoxRot,iA1,vTemp); - CONSTRUCTPLANE(plPlane,vTemp,m_vBoxHalfSize.get(iA1)); - - _cldClipPolyToPlane( avTempArray1, iTempCnt1.i, avTempArray2, iTempCnt2, plPlane ); - - - // Plane p1 - GETCOL(m_mHullBoxRot,iA1,vTemp); - // vTemp[0]=-vTemp[0]; - // vTemp[1]=-vTemp[1]; - // vTemp[2]=-vTemp[2]; - vTemp.scale(-1); - CONSTRUCTPLANE(plPlane,vTemp,m_vBoxHalfSize.get(iA1)); - - _cldClipPolyToPlane( avTempArray2, iTempCnt2.i, avTempArray1, iTempCnt1, plPlane ); - - // Plane p2 - GETCOL(m_mHullBoxRot,iA2,vTemp); - CONSTRUCTPLANE(plPlane,vTemp,m_vBoxHalfSize.get(iA2)); - - _cldClipPolyToPlane( avTempArray1, iTempCnt1.i, avTempArray2, iTempCnt2, plPlane ); - - // Plane p3 - GETCOL(m_mHullBoxRot,iA2,vTemp); - // vTemp[0]=-vTemp[0]; - // vTemp[1]=-vTemp[1]; - // vTemp[2]=-vTemp[2]; - vTemp.scale(-1); - CONSTRUCTPLANE(plPlane,vTemp,m_vBoxHalfSize.get(iA2)); - - _cldClipPolyToPlane( avTempArray2, iTempCnt2.i, avTempArray1, iTempCnt1, plPlane ); - - - // for each generated contact point - for ( int i=0; i 0) { - fTempDepth = 0; - } - - // generate contact data - DVector3 vPntTmp = new DVector3(); - ADD(avTempArray1[i],m_vHullBoxPos,vPntTmp); - - // #if 0 //#ifdef ORIG -- if to use conditional define, GenerateContact must be moved into #else - // dContactGeom* Contact = SAFECONTACT(m_iFlags, m_ContactGeoms, m_ctContacts, m_iStride); - // - // Contact->depth = -fTempDepth; - // SET(Contact->normal,m_vBestNormal); - // SET(Contact->pos,vPntTmp); - // Contact->g1 = Geom1; - // Contact->g2 = Geom2; - // Contact->side1 = TriIndex; - // Contact->side2 = -1; - // m_ctContacts++; - // #endif - GenerateContact(m_iFlags, m_ContactGeoms, m_iStride, m_Geom1, m_Geom2, TriIndex, - vPntTmp, m_vBestNormal, -fTempDepth, m_ctContacts); - - if ((m_ctContacts.i | CONTACTS_UNIMPORTANT) == (m_iFlags & (DxGeom.NUMC_MASK | CONTACTS_UNIMPORTANT))) { - break; - } - } - - //dAASSERT(m_ctContacts>0); - } - } - - - - - - // test one mesh triangle on intersection with given box - // void sTrimeshBoxColliderData::_cldTestOneTriangle(const dVector3 &v0, const dVector3 &v1, const dVector3 &v2, int TriIndex)//, void *pvUser) - private void _cldTestOneTriangle(final DVector3C v0, final DVector3C v1, - final DVector3C v2, int TriIndex)//, void *pvUser) - { - // do intersection test and find best separating axis - if(!_cldTestSeparatingAxes(v0, v1, v2)) { - // if not found do nothing - return; - } - - // if best separation axis is not found - if (m_iBestAxis == 0) { - // this should not happen (we should already exit in that case) - //dMessage (0, "best separation axis not found"); - // do nothing - return; - } - - _cldClipping(v0, v1, v2, TriIndex); - } - - - // void sTrimeshBoxColliderData::SetupInitialContext(dxTriMesh *TriMesh, dxGeom *BoxGeom, - // int Flags, dContactGeom* Contacts, int Stride) - void SetupInitialContext(DxTriMesh TriMesh, DxBox BoxGeom, - int Flags, DContactGeomBuffer Contacts, int Stride) - { - // // get source hull position, orientation and half size - // const dMatrix3& mRotBox=*(const dMatrix3*)dGeomGetRotation(BoxGeom); - // const dVector3& vPosBox=*(const dVector3*)dGeomGetPosition(BoxGeom); - // - // // to global - // SETM(m_mHullBoxRot,mRotBox); - // SET(m_vHullBoxPos,vPosBox); - m_mHullBoxRot.set(BoxGeom.getRotation()); - m_vHullBoxPos.set(BoxGeom.getPosition()); - - //dGeomBoxGetLengths(BoxGeom, m_vBoxHalfSize); - m_vBoxHalfSize.set(BoxGeom.getLengths()); - // m_vBoxHalfSize[0] *= 0.5f; - // m_vBoxHalfSize[1] *= 0.5f; - // m_vBoxHalfSize[2] *= 0.5f; - m_vBoxHalfSize.scale(0.5f); - - // get destination hull position and orientation - // const dVector3& vPosMesh=*(const dVector3*)dGeomGetPosition(TriMesh); - // - // // to global - // SET(m_vHullDstPos,vPosMesh); - m_vHullDstPos.set(TriMesh.getPosition()); - - // global info for contact creation - m_ctContacts.i = 0; - if (Stride != 1) throw new IllegalArgumentException("stride = " + Stride); - m_iStride=Stride; - m_iFlags=Flags; - m_ContactGeoms=Contacts; - m_Geom1=TriMesh; - m_Geom2=BoxGeom; - - // reset stuff - m_fBestDepth = MAXVALUE; - // m_vBestNormal[0]=0; - // m_vBestNormal[1]=0; - // m_vBestNormal[2]=0; - m_vBestNormal.setZero(); - } - - // int sTrimeshBoxColliderData::TestCollisionForSingleTriangle(int ctContacts0, int Triint, - // dVector3 dv[3], bool &bOutFinishSearching) - private int TestCollisionForSingleTriangle(int ctContacts0, int Triint, - DVector3 dv[], RefBoolean bOutFinishSearching) - { - // test this triangle - _cldTestOneTriangle(dv[0],dv[1],dv[2],Triint); - - // fill-in tri index for generated contacts - for (; ctContacts0 < m_ctContacts.i; ctContacts0++) { - //DContactGeom pContact = SAFECONTACT(m_iFlags, m_ContactGeoms, ctContacts0, m_iStride); - DContactGeom pContact = m_ContactGeoms.getSafe(m_iFlags, ctContacts0); - pContact.side1 = Triint; - pContact.side2 = -1; - } - - /* - NOTE by Oleh_Derevenko: - The function continues checking triangles after maximal number - of contacts is reached because it selects maximal penetration depths. - See also comments in GenerateContact() - */ - bOutFinishSearching.b = ((m_ctContacts.i | CONTACTS_UNIMPORTANT) == (m_iFlags & (DxGeom.NUMC_MASK | CONTACTS_UNIMPORTANT))); - - return ctContacts0; - } - - - // // OPCODE version of box to mesh collider - // #if dTRIMESH_OPCODE - // static void dQueryBTLPotentialCollisionTriangles(OBBCollider &Collider, - // const sTrimeshBoxColliderData &cData, dxTriMesh *TriMesh, dxGeom *BoxGeom, - // OBBCache &BoxCache) - // { - // // get source hull position, orientation and half size - // const dMatrix3& mRotBox=*(const dMatrix3*)dGeomGetRotation(BoxGeom); - // const dVector3& vPosBox=*(const dVector3*)dGeomGetPosition(BoxGeom); - // - // // Make OBB - // OBB Box; - // Box.mCenter.x = vPosBox[0]; - // Box.mCenter.y = vPosBox[1]; - // Box.mCenter.z = vPosBox[2]; - // - // // It is a potential issue to explicitly cast to float - // // if custom width floating point type is introduced in OPCODE. - // // It is necessary to make a typedef and cast to it - // // (e.g. typedef float opc_float;) - // // However I'm not sure in what header it should be added. - // - // Box.mExtents.x = /*(float)*/cData.m_vBoxHalfSize[0]; - // Box.mExtents.y = /*(float)*/cData.m_vBoxHalfSize[1]; - // Box.mExtents.z = /*(float)*/cData.m_vBoxHalfSize[2]; - // - // Box.mRot.m[0][0] = /*(float)*/mRotBox[0]; - // Box.mRot.m[1][0] = /*(float)*/mRotBox[1]; - // Box.mRot.m[2][0] = /*(float)*/mRotBox[2]; - // - // Box.mRot.m[0][1] = /*(float)*/mRotBox[4]; - // Box.mRot.m[1][1] = /*(float)*/mRotBox[5]; - // Box.mRot.m[2][1] = /*(float)*/mRotBox[6]; - // - // Box.mRot.m[0][2] = /*(float)*/mRotBox[8]; - // Box.mRot.m[1][2] = /*(float)*/mRotBox[9]; - // Box.mRot.m[2][2] = /*(float)*/mRotBox[10]; - // - // Matrix4x4 amatrix; - // Matrix4x4 BoxMatrix = MakeMatrix(vPosBox, mRotBox, amatrix); - // - // Matrix4x4 InvBoxMatrix; - // InvertPRMatrix(InvBoxMatrix, BoxMatrix); - // - // // get destination hull position and orientation - // const dMatrix3& mRotMesh=*(const dMatrix3*)dGeomGetRotation(TriMesh); - // const dVector3& vPosMesh=*(const dVector3*)dGeomGetPosition(TriMesh); - // - // // TC results - // if (TriMesh->doBoxTC) { - // dxTriMesh::BoxTC* BoxTC = 0; - // for (int i = 0; i < TriMesh->BoxTCCache.size(); i++){ - // if (TriMesh->BoxTCCache[i].Geom == BoxGeom){ - // BoxTC = &TriMesh->BoxTCCache[i]; - // break; - // } - // } - // if (!BoxTC){ - // TriMesh->BoxTCCache.push(dxTriMesh::BoxTC()); - // - // BoxTC = &TriMesh->BoxTCCache[TriMesh->BoxTCCache.size() - 1]; - // BoxTC->Geom = BoxGeom; - // BoxTC->FatCoeff = 1.1f; // Pierre recommends this, instead of 1.0 - // } - // - // // Intersect - // Collider.SetTemporalCoherence(true); - // Collider.Collide(*BoxTC, Box, TriMesh->Data->BVTree, null, &MakeMatrix(vPosMesh, mRotMesh, amatrix)); - // } - // else { - // Collider.SetTemporalCoherence(false); - // Collider.Collide(BoxCache, Box, TriMesh->Data->BVTree, null, - // &MakeMatrix(vPosMesh, mRotMesh, amatrix)); - // } - // } - // - // int dCollideBTL(dxGeom* g1, dxGeom* BoxGeom, int Flags, dContactGeom* Contacts, int Stride){ - // dIASSERT (Stride >= (int)sizeof(dContactGeom)); - // dIASSERT (g1->type == dTriMeshClass); - // dIASSERT (BoxGeom->type == dBoxClass); - // dIASSERT ((Flags & NUMC_MASK) >= 1); - // - // dxTriMesh* TriMesh = (dxTriMesh*)g1; - // - // sTrimeshBoxColliderData cData; - // cData.SetupInitialContext(TriMesh, BoxGeom, Flags, Contacts, Stride); - // - // const unsigned uiTLSKind = TriMesh->getParentSpaceTLSKind(); - // dIASSERT(uiTLSKind == BoxGeom->getParentSpaceTLSKind()); // The colliding spaces must use matching cleanup method - // TrimeshCollidersCache *pccColliderCache = GetTrimeshCollidersCache(uiTLSKind); - // OBBCollider& Collider = pccColliderCache->_OBBCollider; - // - // dQueryBTLPotentialCollisionTriangles(Collider, cData, TriMesh, BoxGeom, - // pccColliderCache->defaultBoxCache); - // - // if (!Collider.GetContactStatus()) { - // // no collision occurred - // return 0; - // } - // - // // Retrieve data - // int TriCount = Collider.GetNbTouchedPrimitives(); - // const int* Triangles = (const int*)Collider.GetTouchedPrimitives(); - // - // if (TriCount != 0){ - // if (TriMesh->ArrayCallback != null){ - // TriMesh->ArrayCallback(TriMesh, BoxGeom, Triangles, TriCount); - // } - // - // // get destination hull position and orientation - // const dMatrix3& mRotMesh=*(const dMatrix3*)dGeomGetRotation(TriMesh); - // const dVector3& vPosMesh=*(const dVector3*)dGeomGetPosition(TriMesh); - // - // int ctContacts0 = 0; - // - // // loop through all intersecting triangles - // for (int i = 0; i < TriCount; i++){ - // const int Triint = Triangles[i]; - // if (!Callback(TriMesh, BoxGeom, Triint)) continue; - // - // dVector3 dv[3]; - // FetchTriangle(TriMesh, Triint, vPosMesh, mRotMesh, dv); - // - // bool bFinishSearching; - // ctContacts0 = cData.TestCollisionForSingleTriangle(ctContacts0, Triint, dv, bFinishSearching); - // - // if (bFinishSearching) { - // break; - // } - // } - // } - // - // return cData.m_ctContacts; - // } - // #endif - - } //TZ end of data? - - // GIMPACT version of box to mesh collider - // #if dTRIMESH_GIMPACT - // int dCollideBTL(dxGeom* g1, dxGeom* BoxGeom, int Flags, dContactGeom* Contacts, int Stride) - int dCollideBTL(DxTriMesh g1, DxBox BoxGeom, int Flags, DContactGeomBuffer Contacts, int Stride) - { - dIASSERT (Stride >= 1);//(int)sizeof(dContactGeom)); - // dIASSERT (g1.type == dTriMeshClass); - // dIASSERT (BoxGeom.type == dBoxClass); - dIASSERT ((Flags & DxGeom.NUMC_MASK) >= 1); - - - DxGimpact TriMesh = (DxGimpact) g1; - - g1.recomputeAABB(); - BoxGeom.recomputeAABB(); - - - sTrimeshBoxColliderData cData = new sTrimeshBoxColliderData(); - cData.SetupInitialContext(TriMesh, BoxGeom, Flags, Contacts, Stride); - - //*****at first , collide box aabb******// - - //GIM_TRIMESH * ptrimesh = &TriMesh.m_collision_trimesh; - GimTrimesh ptrimesh = TriMesh.m_collision_trimesh(); - aabb3f test_aabb = new aabb3f(); - - DAABBC aabb = BoxGeom.getAABB(); - test_aabb.minX = (float) aabb.getMin0(); - test_aabb.maxX = (float) aabb.getMax0(); - test_aabb.minY = (float) aabb.getMin1(); - test_aabb.maxY = (float) aabb.getMax1(); - test_aabb.minZ = (float) aabb.getMin2(); - test_aabb.maxZ = (float) aabb.getMax2(); - - GimDynArrayInt collision_result = GimDynArrayInt.GIM_CREATE_BOXQUERY_LIST(); - - ptrimesh.getAabbSet().gim_aabbset_box_collision(test_aabb, collision_result); - - if(collision_result.size()==0) - { - collision_result.GIM_DYNARRAY_DESTROY(); - return 0; - } - //*****Set globals for box collision******// - - //collide triangles - - //GUINT32 * boxesresult = GIM_DYNARRAY_POINTER(GUINT32,collision_result); - int[] boxesresult = collision_result.GIM_DYNARRAY_POINTER(); - ptrimesh.gim_trimesh_locks_work_data(); - - int ctContacts0 = 0; - - DVector3[] dv = { new DVector3(), new DVector3(), new DVector3() }; - //vec3f[] dv = new vec3f[] { new vec3f(), new vec3f(), new vec3f() };//[3]; - for(int i=0;i