Fix FreeformFinSetTest unit test
FreeformFinSetTest.testFreeformCMComputation_triangleOnTransition was broken with the last merge. This change updates the expected area for the fin tab to be the area of the triangle under the curve as well as update the new CG contants in the tests. Identified in #631 Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
parent
4326c71c71
commit
58b92be39e
@ -1,13 +1,17 @@
|
|||||||
package net.sf.openrocket.rocketcomponent;
|
package net.sf.openrocket.rocketcomponent;
|
||||||
|
|
||||||
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
|
||||||
import static org.hamcrest.CoreMatchers.not;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import net.sf.openrocket.aerodynamics.AerodynamicForces;
|
import net.sf.openrocket.aerodynamics.AerodynamicForces;
|
||||||
import net.sf.openrocket.aerodynamics.FlightConditions;
|
import net.sf.openrocket.aerodynamics.FlightConditions;
|
||||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||||
@ -16,14 +20,13 @@ import net.sf.openrocket.material.Material;
|
|||||||
import net.sf.openrocket.material.Material.Type;
|
import net.sf.openrocket.material.Material.Type;
|
||||||
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
|
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
|
||||||
import net.sf.openrocket.rocketcomponent.FinSet.CrossSection;
|
import net.sf.openrocket.rocketcomponent.FinSet.CrossSection;
|
||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
|
||||||
import net.sf.openrocket.rocketcomponent.Transition.Shape;
|
import net.sf.openrocket.rocketcomponent.Transition.Shape;
|
||||||
|
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||||
import net.sf.openrocket.util.Color;
|
import net.sf.openrocket.util.Color;
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
import net.sf.openrocket.util.LineStyle;
|
import net.sf.openrocket.util.LineStyle;
|
||||||
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
|
|
||||||
import net.sf.openrocket.util.Transformation;
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
|
||||||
|
|
||||||
public class FreeformFinSetTest extends BaseTestCase {
|
public class FreeformFinSetTest extends BaseTestCase {
|
||||||
|
|
||||||
@ -301,13 +304,14 @@ public class FreeformFinSetTest extends BaseTestCase {
|
|||||||
|
|
||||||
// fin is a simple trapezoid against a linearly changing body...
|
// fin is a simple trapezoid against a linearly changing body...
|
||||||
// height is set s.t. the tab trailing edge height == 0
|
// height is set s.t. the tab trailing edge height == 0
|
||||||
final double expectedTabArea = (fins.getTabHeight())*3/4 * fins.getTabLength();
|
final double tabLength = fins.getFinFront().x + fins.getTabOffset();
|
||||||
final double expectedTotalVolume = (expectedWettedArea + expectedTabArea)*fins.getThickness();
|
final double expectedTabArea = (fins.getTabHeight()) * 0.5 * tabLength;
|
||||||
|
final double expectedTotalVolume = (expectedWettedArea + expectedTabArea) * fins.getThickness();
|
||||||
assertEquals("Calculated fin volume is wrong: ", expectedTotalVolume, fins.getComponentVolume(), EPSILON);
|
assertEquals("Calculated fin volume is wrong: ", expectedTotalVolume, fins.getComponentVolume(), EPSILON);
|
||||||
|
|
||||||
Coordinate tcg = fins.getCG(); // relative to parent. also includes fin tab CG.
|
Coordinate tcg = fins.getCG(); // relative to parent. also includes fin tab CG.
|
||||||
assertEquals("Calculated fin centroid is wrong! ", 0.245454, tcg.x, EPSILON);
|
assertEquals("Calculated fin centroid is wrong! ", 0.238461, tcg.x, EPSILON);
|
||||||
assertEquals("Calculated fin centroid is wrong! ", 0.75303, tcg.y, EPSILON);
|
assertEquals("Calculated fin centroid is wrong! ", 0.714102, tcg.y, EPSILON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user