public static void checkTrunk3D(BasicTreeTrunk3D trunk3D, float expectedHeight, float expectedRadius,
Point3d expectedLowerBottom, Point3d expectedUpperBottom, Point3d expectedMovedLowerBottom,
Point3d expectedMovedUpperBottom, Point3d expectedLowerTop, Point3d expectedUpperTop,
Point3d expectedMovedLowerTop, Point3d expectedMovedUpperTop) {
Cylinder trunkCylinder = trunk3D.getTrunk();
assertEquals(expectedHeight, trunkCylinder.getHeight());
assertEquals(expectedRadius, trunkCylinder.getRadius());
TransformGroup trunkTransformGroup = (TransformGroup) trunk3D.getGroup().getChild(0);
Enumeration transformChilds = trunkTransformGroup.getAllChildren();
// check at least one element
assertTrue(transformChilds.hasMoreElements());
SceneGraphObject child = (SceneGraphObject) transformChilds.nextElement();
assertEquals(trunkCylinder, child);
// check only one element
assertFalse(transformChilds.hasMoreElements());
// get transform object
Transform3D transform3D = new Transform3D();
trunkTransformGroup.getTransform(transform3D);
// check bottom of trunk
Shape3D bottom = trunkCylinder.getShape(Cylinder.BOTTOM);
BoundingBox bottomBounds = (BoundingBox) bottom.getBounds();
Point3d lowerBottom = new Point3d();
bottomBounds.getLower(lowerBottom);
Point3d movedLowerBottom = new Point3d();
transform3D.transform(lowerBottom, movedLowerBottom);
Point3d upperBottom = new Point3d();
bottomBounds.getUpper(upperBottom);
Point3d movedUpperBottom = new Point3d();
transform3D.transform(upperBottom, movedUpperBottom);
PointTestHelper.assertPointEquals(expectedLowerBottom, lowerBottom, 0.02, 0.0001, 0.02);
PointTestHelper.assertPointEquals(expectedMovedLowerBottom, movedLowerBottom, 0.02, 0.0001, 0.02);
PointTestHelper.assertPointEquals(expectedUpperBottom, upperBottom, 0.02, 0.0001, 0.02);
PointTestHelper.assertPointEquals(expectedMovedUpperBottom, movedUpperBottom, 0.02, 0.0001, 0.02);
// check top of trunk
Shape3D top = trunkCylinder.getShape(Cylinder.TOP);
BoundingBox topBounds = (BoundingBox) top.getBounds();
Point3d lowerTop = new Point3d();
topBounds.getLower(lowerTop);
Point3d movedLowerTop = new Point3d();
transform3D.transform(lowerTop, movedLowerTop);