public void CompoundBody_Of_TwoCuboids_BoundingBox_Correct(double x0, double y0, double z0, double x1, double y1, double z1, double expectedSizeX, double expectedSizeY, double expectedSizeZ) { var compoundBody = new CompoundBody(new[] { new RectangularCuboid(new Vector3(x0, y0, z0), 4, 4, 4), new RectangularCuboid(new Vector3(x1, y1, z1), 4, 4, 4), }); var boundingBox = compoundBody.TryAcceptVisitor <RectangularCuboid>(new BoundingBoxVisitor()); Assert.AreEqual(expectedSizeX, boundingBox.SizeX, "SizeX"); Assert.AreEqual(expectedSizeY, boundingBox.SizeY, "SizeY"); Assert.AreEqual(expectedSizeZ, boundingBox.SizeZ, "SizeZ"); }
public void CompoundBody_BoxifyVisitor_IsCorrect() { var ball = new Ball(new Vector3(1, 2, 3), 4); var box = new RectangularCuboid(new Vector3(8, 9, 10), 2, 3, 4); var cylinder = new Cylinder(new Vector3(-5, -6, -10), 3, 5); var cBall = new Ball(new Vector3(12, 12, 12), 2); var cBox = new RectangularCuboid(new Vector3(-12, -12, -12), 2, 2, 2); var cCylinder = new Cylinder(new Vector3(25, 25, 25), 2, 3); var compound = new CompoundBody(new List <Body> { cBall, cBox, cCylinder }); var compoundBody = new CompoundBody(new List <Body> { ball, box, cylinder, compound }); var actual = compoundBody.TryAcceptVisitor <CompoundBody>(new BoxifyVisitor()); AssertCompoundBodyBoxified(compoundBody, actual); }