[fix] Added new BoundingBox tests; adjusted Falcon 9H Properties

This commit is contained in:
Daniel_M_Williams 2020-06-20 22:48:42 -04:00
parent 22160dbe5d
commit 358b3dc527
11 changed files with 147 additions and 101 deletions

View File

@ -732,37 +732,14 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
public BoundingBox getInstanceBoundingBox(){
BoundingBox singleFinBounds= new BoundingBox().update(getFinPoints());
final double finLength = singleFinBounds.max.x;
final double finHeight = singleFinBounds.max.y;
Coordinate[] locations = getInstanceLocations();
double[] angles = getInstanceAngles();
final BoundingBox singleFinBounds = new BoundingBox();
BoundingBox finSetBox = new BoundingBox();
/*
* The fins themselves will be offset by the location itself to match
* the outside radius of a body tube. The bounds encapsulate the outer
* portion of all the tips of the fins.
*
* The height of each fin along the Y axis can be determined by:
* yHeight = cos(angle) * finHeight
*
* The height (depth?) of each fin along the Z axis can be determined by:
* zHeight = sin(angle) * finHeight
*
* The boundingBox should be that box which is the smallest box where
* a convex hull will contain all Coordinates.
*/
for (int i = 0; i < locations.length; i++) {
double y = Math.cos(angles[i]) * finHeight;
double z = Math.sin(angles[i]) * finHeight;
finSetBox.update(locations[i].add(0, y, z));
finSetBox.update(locations[i].add(finLength, y, z));
}
return finSetBox;
singleFinBounds.update(getFinPoints());
singleFinBounds.update(new Coordinate( 0, 0, -this.thickness/2));
singleFinBounds.update(new Coordinate( 0, 0, this.thickness/2));
return singleFinBounds;
}
/**
@ -773,7 +750,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
*/
@Override
public Collection<Coordinate> getComponentBounds() {
Collection<Coordinate> bounds = new ArrayList<Coordinate>(8);
Collection<Coordinate> bounds = new ArrayList<>(8);
// should simply return this component's bounds in this component's body frame.

View File

@ -558,9 +558,20 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
BoundingBox componentBounds = new BoundingBox();
List<InstanceContext> contexts = entry.getValue();
/* FinSets already provide a bounding box, so let's use that.
*/
if( ! component.isAerodynamic()){
// all non-aerodynamic components should be surrounded by aerodynamic ones
continue;
}
// FinSets already provide a bounding box, so let's use that.
// System.err.println(String.format("@[%s]: (#%d)", component.getName(), contexts.size()));
if (component instanceof BoxBounded) {
final BoundingBox instanceBounds = ((BoxBounded) component).getInstanceBoundingBox();
if(instanceBounds.isEmpty()) {
// this component is probably non-physical (like an assembly) or has invalid bounds. Skip.
continue;
}
for (InstanceContext context : contexts) {
/*
* If the instance is not active in the current context, then
@ -570,16 +581,11 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
* the context indicates if it is active or not.
*/
if (!context.active) {
continue;
}
BoundingBox instanceBounds = ((BoxBounded) component).getInstanceBoundingBox();
if(instanceBounds.isEmpty()) {
// this component is probably non-physical (like an assembly) or has invalid bounds. Skip.
// i.e. 'break' out of the per-instance-context loop, and let the per-component loop continue
// break out of per-instance loop.
break;
}
componentBounds = instanceBounds.transform(context.transform);
componentBounds.update(instanceBounds.transform(context.transform));
}
} else {
// Legacy Case: These components do not implement the BoxBounded Interface.
@ -606,7 +612,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
}
}
// System.err.println(String.format(" << global: %s", componentBounds.toString()));
rocketBounds.update(componentBounds);
// System.err.println(String.format("<<++ rocket: %s", rocketBounds.toString()));
}
boundsModID = rocket.getModID();

View File

@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.ArrayList;
import net.sf.openrocket.util.BoundingBox;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.MathUtil;
import net.sf.openrocket.util.StateChangeListener;
@ -83,7 +83,16 @@ public class Rocket extends ComponentAssembly {
configSet = new FlightConfigurableParameterSet<>( defaultConfig );
this.selectedConfiguration = defaultConfig;
}
/**
* Return a bounding box enveloping the rocket. By definition, the bounding box is a convex hull.
*
* Note: this function gets the bounding box for the entire rocket.
*
* @return Return a bounding box enveloping the rocket
*/
public BoundingBox getBoundingBox (){ return selectedConfiguration.getBoundingBox(); }
public String getDesigner() {
checkState();
return designer;

View File

@ -9,6 +9,7 @@ import java.util.List;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.rocketcomponent.PodSet;
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
import net.sf.openrocket.util.BoundingBox;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.MathUtil;
@ -20,7 +21,7 @@ import net.sf.openrocket.util.MathUtil;
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public abstract class SymmetricComponent extends BodyComponent implements RadialParent {
public abstract class SymmetricComponent extends BodyComponent implements BoxBounded, RadialParent {
public static final double DEFAULT_RADIUS = 0.025;
public static final double DEFAULT_THICKNESS = 0.002;
@ -40,13 +41,23 @@ public abstract class SymmetricComponent extends BodyComponent implements Radial
private double rotationalInertia = -1;
private Coordinate cg = null;
public SymmetricComponent() {
super();
}
public BoundingBox getInstanceBoundingBox(){
BoundingBox instanceBounds = new BoundingBox();
instanceBounds.update(new Coordinate(this.getLength(), 0,0));
final double r = Math.max(getForeRadius(), getAftRadius());
instanceBounds.update(new Coordinate(0,r,r));
instanceBounds.update(new Coordinate(0,-r,-r));
return instanceBounds;
}
/**
* Return the component radius at position x.
* @param x Position on x-axis.

View File

@ -39,11 +39,22 @@ public class BoundingBox {
}
/**
* return a copy of this bounding box, transformed by the given transformation matrix
* @return
* Generate a new bounding box, transformed by the given transformation matrix
*
* Note: This implementation is not _exact_! Do not use this for Aerodynamic, Mass or Simulation calculations....
* But it will be sufficiently close for UI purposes.
*
* @return a new box, transform by the given transform
*/
public BoundingBox transform(Transformation transform){
return new BoundingBox(transform.transform(this.min), transform.transform(this.max));
final Coordinate p1 = transform.transform(this.min);
final Coordinate p2 = transform.transform(this.max);
final BoundingBox newBox = new BoundingBox();
newBox.update(p1);
newBox.update(p2);
return newBox;
}
private void update_x_min( final double xVal) {
@ -92,7 +103,7 @@ public class BoundingBox {
update_x_min(c.x);
update_y_min(c.y);
update_z_min(c.z);
update_x_max(c.x);
update_y_max(c.y);
update_z_max(c.z);
@ -126,7 +137,7 @@ public class BoundingBox {
}
update_x_min(other.min.x);
update_y_min(other.min.y);
update_z_min(other.min.y);
update_z_min(other.min.z);
update_x_max(other.max.x);
update_y_max(other.max.y);

View File

@ -62,8 +62,8 @@ public final class Coordinate implements Cloneable, Serializable {
public static final Coordinate ZERO = new Coordinate(0, 0, 0, 0);
public static final Coordinate NUL = new Coordinate(0, 0, 0, 0);
public static final Coordinate NaN = new Coordinate(Double.NaN, Double.NaN,Double.NaN, Double.NaN);
public static final Coordinate MAX = new Coordinate(Double.MAX_VALUE,Double.MAX_VALUE,Double.MAX_VALUE,Double.MAX_VALUE);
public static final Coordinate MIN = new Coordinate(Double.MIN_VALUE,Double.MIN_VALUE,Double.MIN_VALUE,Double.MIN_VALUE);
public static final Coordinate MAX = new Coordinate( Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE,Double.MAX_VALUE);
public static final Coordinate MIN = new Coordinate(-Double.MAX_VALUE,-Double.MAX_VALUE,-Double.MAX_VALUE,0.0);
public static final Coordinate X_UNIT = new Coordinate(1, 0, 0);
public static final Coordinate Y_UNIT = new Coordinate(0, 1, 0);

View File

@ -1038,12 +1038,11 @@ public class TestRockets {
boosterBody.addChild(boosterFins);
boosterFins.setName("Booster Fins");
boosterFins.setFinCount(3);
boosterFins.setAngleOffset( Math.PI / 4);
boosterFins.setThickness(0.003);
boosterFins.setCrossSection(CrossSection.ROUNDED);
boosterFins.setRootChord(0.32);
boosterFins.setTipChord(0.12);
boosterFins.setHeight(0.12);
boosterFins.setHeight(0.10);
boosterFins.setSweep(0.18);
boosterFins.setAxialMethod(AxialMethod.BOTTOM);
boosterFins.setAxialOffset(0.0);

View File

@ -123,22 +123,23 @@ public class BarrowmanCalculatorTest {
{
boosterFins.setFinCount(3);
final Coordinate cp_3fin = calc.getCP(config, conditions, warnings);
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 21.5111598, cp_3fin.weight, EPSILON);
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 1.04662388, cp_3fin.x, EPSILON);
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 16.51651439, cp_3fin.weight, EPSILON);
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 1.00667319, cp_3fin.x, EPSILON);
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0.0, cp_3fin.y, EPSILON);
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0.0, cp_3fin.z, EPSILON);
}{
boosterFins.setFinCount(2);
boosterFins.setAngleOffset(Math.PI/4);
final Coordinate cp_2fin = calc.getCP(config, conditions, warnings);
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 15.43711196967902, cp_2fin.weight, EPSILON);
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.9946423753010524, cp_2fin.x, EPSILON);
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 12.1073483560, cp_2fin.weight, EPSILON);
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.9440139181, cp_2fin.x, EPSILON);
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0.0, cp_2fin.y, EPSILON);
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0.0, cp_2fin.z, EPSILON);
}{
boosterFins.setFinCount(1);
final Coordinate cp_1fin = calc.getCP(config, conditions, warnings);
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 9.36306412, cp_1fin.weight, EPSILON);
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.87521867, cp_1fin.x, EPSILON);
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 7.6981823141, cp_1fin.weight, EPSILON);
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.8095779106, cp_1fin.x, EPSILON);
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0f, cp_1fin.y, EPSILON);
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0f, cp_1fin.z, EPSILON);
}

View File

@ -240,7 +240,7 @@ public class MassCalculatorTest extends BaseTestCase {
compMass = mmt.getComponentMass();
assertEquals(mmt.getName() + " mass calculated incorrectly: ", expMass, compMass, EPSILON);
expMass = 0.15995232;
expMass = 0.13329359999999998;
final FinSet boosterFins = (FinSet) boosters.getChild(1).getChild(1);
compMass = boosterFins.getComponentMass();
assertEquals(boosterFins.getName() + " mass calculated incorrectly: ", expMass, compMass, EPSILON);
@ -442,10 +442,10 @@ public class MassCalculatorTest extends BaseTestCase {
assertEquals(cc.getName() + " Longitudinal MOI calculated incorrectly: ", expInertia, compInertia, EPSILON);
final FinSet boosterFins = (FinSet) boosters.getChild(1).getChild(1);
expInertia = 0.001377661595723823;
expInertia = 0.000928545614574877;
compInertia = boosterFins.getRotationalInertia();
assertEquals(boosterFins.getName() + " Rotational MOI calculated incorrectly: ", expInertia, compInertia, EPSILON);
expInertia = 0.0016272177418619116;
expInertia = 0.001246261927287438;
compInertia = boosterFins.getLongitudinalInertia();
assertEquals(boosterFins.getName() + " Longitudinal MOI calculated incorrectly: ", expInertia, compInertia, EPSILON);
@ -558,8 +558,8 @@ public class MassCalculatorTest extends BaseTestCase {
final RigidBody actualData = MassCalculator.calculateStructure(config);
final Coordinate actualCM = actualData.getCM();
double expMass = 0.66198084;
double expCMx = 1.08642949;
double expMass = 0.608663395;
double expCMx = 1.073157592;
assertEquals("Heavy Booster Mass is incorrect: ", expMass, actualCM.weight, EPSILON);
assertEquals("Heavy Booster CM.x is incorrect: ", expCMx, actualCM.x, EPSILON);
@ -578,11 +578,11 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody actualBoosterLaunchData = MassCalculator.calculateLaunch(config);
double actualMass = actualBoosterLaunchData.getMass();
double expectedMass = 1.64598084;
double expectedMass = 1.592663395;
assertEquals(" Booster Launch Mass is incorrect: ", expectedMass, actualMass, EPSILON);
final Coordinate actualCM = actualBoosterLaunchData.getCM();
double expectedCMx = 1.22267891;
double expectedCMx = 1.22216804;
Coordinate expCM = new Coordinate(expectedCMx, 0, 0, expectedMass);
assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, actualCM.x, EPSILON);
assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, actualCM.y, EPSILON);
@ -602,8 +602,8 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody spentData = MassCalculator.calculateBurnout(config);
Coordinate spentCM = spentData.getCM();
double expSpentMass = 1.17398084;
double expSpentCMx = 1.18582650;
double expSpentMass = 1.12066339;
double expSpentCMx = 1.18334714;
Coordinate expLaunchCM = new Coordinate(expSpentCMx, 0, 0, expSpentMass);
assertEquals(" Booster Launch Mass is incorrect: ", expLaunchCM.weight, spentCM.weight, EPSILON);
assertEquals(" Booster Launch CM.x is incorrect: ", expLaunchCM.x, spentCM.x, EPSILON);
@ -668,11 +668,11 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody spent = MassCalculator.calculateBurnout(config);
double expMOIRotational = 0.010420016485489425;
double expMOIRotational = 0.009205665421431532;
double boosterMOIRotational = spent.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOIRotational, boosterMOIRotational, EPSILON);
double expMOI_tr = 0.05913869705973017;
double expMOI_tr = 0.0582250994240395;
double boosterMOI_tr = spent.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
}
@ -688,9 +688,9 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody launchData = MassCalculator.calculateLaunch(config);
final double expIxx = 0.013480523485489424;
final double expIxx = 0.01226617242143153;
final double actIxx = launchData.getRotationalInertia();
final double expIyy = 0.06532830810235105;
final double expIyy = 0.06455356411879717;
final double actIyy = launchData.getLongitudinalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expIxx, actIxx, EPSILON);
@ -731,11 +731,11 @@ public class MassCalculatorTest extends BaseTestCase {
assertEquals(" Booster Launch CM is incorrect: ", expCM, boosterSetCM);
// Validate MOI
double expMOI_axial = 0.007100144485489424;
double expMOI_axial = 0.005885793421431532;
double boosterMOI_xx = burnout.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
double expMOI_tr = 16.025778716205167;
double expMOI_tr = 14.815925423036177;
double boosterMOI_tr = burnout.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
}
@ -774,10 +774,10 @@ public class MassCalculatorTest extends BaseTestCase {
Coordinate boosterCM = boosterData.getCM();
// cm= 3.409905g@[0.853614,-0.000000,0.000000]
double expTotalMass = 3.40990464;
double expTotalMass = 3.3565872;
assertEquals(" Booster Launch Mass is incorrect: ", expTotalMass, boosterData.getMass(), EPSILON);
double expCMx = 0.85361377;
double expCMx = 0.847508988;
Coordinate expCM = new Coordinate(expCMx, 0, 0, expTotalMass);
assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, boosterCM.x, EPSILON);
assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, boosterCM.y, EPSILON);
@ -785,11 +785,11 @@ public class MassCalculatorTest extends BaseTestCase {
assertEquals(" Booster Launch CM is incorrect: ", expCM, boosterCM);
// Validate MOI
double expMOI_axial = 0.026027963480146098;
double expMOI_axial = 0.024813612416088204;
double boosterMOI_xx = boosterData.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
double expMOI_tr = 0.35444021118310487;
double expMOI_tr = 0.34567788938578525;
double boosterMOI_tr = boosterData.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
}
@ -820,11 +820,11 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody structure = MassCalculator.calculateStructure(config);
final double expMass = 0.66198084;
final double expMass = 0.6086633952494;
double calcTotalMass = structure.getMass();
assertEquals(" Booster Launch Mass is incorrect: ", expMass, calcTotalMass, EPSILON);
final double expCMx = 1.12869951;
final double expCMx = 1.1191303646;
Coordinate expCM = new Coordinate(expCMx, 0, 0, expMass);
assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, structure.getCM().x, EPSILON);
assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, structure.getCM().y, EPSILON);
@ -832,11 +832,11 @@ public class MassCalculatorTest extends BaseTestCase {
assertEquals(" Booster Launch CM is incorrect: ", expCM, structure.getCM());
// Validate MOI
final double expMOI_axial = 0.007100144485489424;
final double expMOI_axial = 0.005885793421431532;
double boosterMOI_xx = structure.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
final double expMOI_tr = 0.04244299775219597;
final double expMOI_tr = 0.04098909591063;
double boosterMOI_tr = structure.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
}
@ -886,8 +886,8 @@ public class MassCalculatorTest extends BaseTestCase {
// =======================================================================
// DEBUG
System.err.println(rocket.toDebugTree());
// // DEBUG
// System.err.println(rocket.toDebugTree());
RigidBody structure = MassCalculator.calculateStructure(config);
final double expMass = 0.0900260149;

View File

@ -463,25 +463,24 @@ public class FlightConfigurationTest extends BaseTestCase {
assertThat(boosterFinContext0.instanceNumber, equalTo(0));
final Coordinate boosterFin0Location = boosterFinContext0.getLocation();
assertEquals(1.044, boosterFin0Location.x, EPSILON);
assertEquals( -0.104223611, boosterFin0Location.y, EPSILON);
assertEquals( -0.027223611, boosterFin0Location.z, EPSILON);
assertEquals( -0.1155, boosterFin0Location.y, EPSILON);
assertEquals( 0.0, boosterFin0Location.z, EPSILON);
final InstanceContext boosterFinContext1 = finContextList.get(4);
assertThat((Class<TrapezoidFinSet>) boosterFinContext1.component.getClass(), equalTo(TrapezoidFinSet.class));
assertThat(boosterFinContext1.instanceNumber, equalTo(1));
final Coordinate boosterFin1Location = boosterFinContext1.getLocation();
assertEquals(boosterFin1Location.x, 1.044, EPSILON);
assertEquals(boosterFin1Location.y, -0.03981186, EPSILON);
assertEquals(boosterFin1Location.z, -0.00996453, EPSILON);
assertEquals( 1.044, boosterFin1Location.x, EPSILON);
assertEquals(-0.05775, boosterFin1Location.y, EPSILON);
assertEquals(-0.033341978, boosterFin1Location.z, EPSILON);
final InstanceContext boosterFinContext2 = finContextList.get(5);
assertThat((Class<TrapezoidFinSet>) boosterFinContext2.component.getClass(), equalTo(TrapezoidFinSet.class));
assertThat(boosterFinContext2.instanceNumber, equalTo(2));
final Coordinate boosterFin2Location = boosterFinContext2.getLocation();
assertEquals(boosterFin2Location.x, 1.044, EPSILON);
assertEquals(boosterFin2Location.y, -0.08696453, EPSILON);
assertEquals(boosterFin2Location.z, 0.03718814, EPSILON);
assertEquals(1.044, boosterFin2Location.x, EPSILON);
assertEquals(-0.05775, boosterFin2Location.y, EPSILON);
assertEquals( 0.03334, boosterFin2Location.z, EPSILON);
}
}

View File

@ -6,6 +6,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
import net.sf.openrocket.util.BoundingBox;
import org.junit.Test;
import net.sf.openrocket.rocketcomponent.position.AngleMethod;
@ -58,10 +59,10 @@ public class RocketTest extends BaseTestCase {
@Test
public void testEstesAlphaIII(){
Rocket rocket = TestRockets.makeEstesAlphaIII();
AxialStage stage= (AxialStage)rocket.getChild(0);
final Rocket rocket = TestRockets.makeEstesAlphaIII();
final AxialStage stage= (AxialStage)rocket.getChild(0);
Coordinate expLoc;
Coordinate actLoc;
{
@ -136,6 +137,15 @@ public class RocketTest extends BaseTestCase {
}
}
final BoundingBox bounds = rocket.getBoundingBox();
assertEquals(bounds.min.x, 0.0, EPSILON);
assertEquals(bounds.max.x, 0.27, EPSILON);
assertEquals( -0.032385640, bounds.min.y, EPSILON);
assertEquals( -0.054493575, bounds.min.z, EPSILON);
assertEquals( 0.062000000, bounds.max.y, EPSILON);
assertEquals( 0.052893575, bounds.max.z, EPSILON);
}
@Test
@ -270,6 +280,15 @@ public class RocketTest extends BaseTestCase {
assertThat(mmt.getName()+" not positioned correctly: ", actLoc, equalTo( expLoc ));
}
}
final BoundingBox bounds = rocket.getBoundingBox();
assertEquals( bounds.min.x, 0.0, EPSILON);
assertEquals( bounds.max.x, 0.335, EPSILON);
assertEquals( -0.032385640, bounds.min.y, EPSILON);
assertEquals( -0.054493575, bounds.min.z, EPSILON);
assertEquals( 0.062000000, bounds.max.y, EPSILON);
assertEquals( 0.052893575, bounds.max.z, EPSILON);
}
@Test
@ -389,8 +408,20 @@ public class RocketTest extends BaseTestCase {
assertEquals(coreFins.getName()+" location is incorrect: ", 1.044, loc.x, EPSILON);
}
}
}
// DEBUG
System.err.println(rocket.toDebugTree());
final BoundingBox bounds = rocket.getBoundingBox();
assertEquals( 0.0, bounds.min.x, EPSILON);
assertEquals( 1.364, bounds.max.x, EPSILON);
assertEquals( -0.215500, bounds.min.y, EPSILON);
assertEquals( 0.215500, bounds.max.y, EPSILON);
assertEquals( -0.12069451, bounds.min.z, EPSILON);
assertEquals( 0.12069451, bounds.max.z, EPSILON);
}
}