Skip to content

Commit

Permalink
test003: verify the default properties of a MeshCollisionShape
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Apr 21, 2024
1 parent bdfc86d commit 4ff1a71
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<!-- Checks for size violations -->
<!-- See https://checkstyle.org/checks/sizes -->
<module name="FileLength">
<property name="max" value="2200"/>
<property name="max" value="2250"/>
</module>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
Expand Down Expand Up @@ -380,7 +380,7 @@
<!-- Checks for size violations -->
<!-- See https://checkstyle.org/checks/sizes -->
<module name="MethodLength">
<property name="max" value="330"/>
<property name="max" value="350"/>
</module>
<module name="ParameterNumber">
<property name="max" value="12"/>
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/TestLibbulletjme.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,29 @@ protected Vector3f locateSupport(
hull, DebugShapeFactory.lowResolution);
Assert.assertEquals(720, buf.capacity());

// MeshCollisionShape with compressed BVH:
int[] indexArray = {0, 0, 0};
Vector3f[] positionArray = {new Vector3f(0f, 0f, 0f)};
IndexedMesh indexedMesh = new IndexedMesh(positionArray, indexArray);
MeshCollisionShape mesh = new MeshCollisionShape(true, indexedMesh);
verifyCollisionShapeDefaults(mesh);
Assert.assertTrue(mesh.canSplit());
Assert.assertEquals(1, mesh.countSubmeshes());
Assert.assertEquals(1, mesh.countMeshTriangles());
Assert.assertEquals(1, mesh.countMeshVertices());
Assert.assertNotNull(mesh.getBvh());
Assert.assertTrue(mesh.getBvh().isCompressed());
Assert.assertEquals(0.04f, mesh.getMargin(), 0f);
Assert.assertEquals(21, mesh.getShapeType());
Assert.assertTrue(mesh.isConcave());
Assert.assertFalse(mesh.isConvex());
Assert.assertFalse(mesh.isInfinite());
Assert.assertTrue(mesh.isNonMoving());
Assert.assertFalse(mesh.isPolyhedral());
buf = DebugShapeFactory.getDebugTriangles(
mesh, DebugShapeFactory.lowResolution);
Assert.assertEquals(9, buf.capacity());

// MinkowkiSum
MinkowskiSum sum = new MinkowskiSum(box, cone);
verifyCollisionShapeDefaults(sum);
Expand Down

0 comments on commit 4ff1a71

Please sign in to comment.