[fixes #868] Fin tabs correctly adjust their location when the fin tab _length_ is changed.
This commit is contained in:
parent
3d7fb20ae9
commit
ac96222964
@ -792,7 +792,9 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
this.centerOfMass = Coordinate.NaN;
|
this.centerOfMass = Coordinate.NaN;
|
||||||
this.totalVolume = Double.NaN;
|
this.totalVolume = Double.NaN;
|
||||||
this.cantRotation = null;
|
this.cantRotation = null;
|
||||||
|
validateFinTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.componentChanged(e);
|
super.componentChanged(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package net.sf.openrocket.rocketcomponent;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import net.sf.openrocket.material.Material;
|
import net.sf.openrocket.material.Material;
|
||||||
|
import net.sf.openrocket.util.TestRockets;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.position.*;
|
import net.sf.openrocket.rocketcomponent.position.*;
|
||||||
@ -103,25 +104,57 @@ public class FinSetTest extends BaseTestCase {
|
|||||||
assertEquals("incorrect fin length:", 0.06, fins.getLength(), EPSILON);
|
assertEquals("incorrect fin length:", 0.06, fins.getLength(), EPSILON);
|
||||||
assertEquals("incorrect fin tab length:", 0.02, fins.getTabLength(), EPSILON);
|
assertEquals("incorrect fin tab length:", 0.02, fins.getTabLength(), EPSILON);
|
||||||
|
|
||||||
// TOP -> native(TOP)
|
{ // TOP -> native(TOP)
|
||||||
fins.setTabOffsetMethod(AxialMethod.TOP);
|
fins.setTabOffsetMethod(AxialMethod.TOP);
|
||||||
fins.setTabOffset(0.0);
|
fins.setTabOffset(0.0);
|
||||||
|
|
||||||
assertEquals("Setting by TOP method failed!", 0.0, fins.getTabFrontEdge(), EPSILON);
|
assertEquals("Setting by TOP method failed!", 0.0, fins.getTabFrontEdge(), EPSILON);
|
||||||
assertEquals("Setting by TOP method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
assertEquals("Setting by TOP method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
||||||
|
assertEquals("Setting by TOP method failed!", 0.02, fins.getTabLength(), EPSILON);
|
||||||
// MIDDLE -> native
|
}
|
||||||
|
{ // MIDDLE -> native
|
||||||
fins.setTabOffsetMethod(AxialMethod.MIDDLE);
|
fins.setTabOffsetMethod(AxialMethod.MIDDLE);
|
||||||
fins.setTabOffset(0.0);
|
fins.setTabOffset(0.0);
|
||||||
assertEquals("Setting by TOP method failed!", 0.02, fins.getTabFrontEdge(), EPSILON);
|
assertEquals("Setting by MIDDLE method failed!", 0.02, fins.getTabFrontEdge(), EPSILON);
|
||||||
assertEquals("Setting by TOP method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
assertEquals("Setting by MIDDLE method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
||||||
|
assertEquals("Setting by MIDDLE method failed!", 0.02, fins.getTabLength(), EPSILON);
|
||||||
// BOTTOM -> native
|
}
|
||||||
|
{// BOTTOM -> native
|
||||||
fins.setTabOffsetMethod(AxialMethod.BOTTOM);
|
fins.setTabOffsetMethod(AxialMethod.BOTTOM);
|
||||||
fins.setTabOffset(0.0);
|
fins.setTabOffset(0.0);
|
||||||
|
|
||||||
assertEquals("Setting by TOP method failed!", 0.04, fins.getTabFrontEdge(), EPSILON);
|
assertEquals("Setting by BOTTOM method failed!", 0.04, fins.getTabFrontEdge(), EPSILON);
|
||||||
assertEquals("Setting by TOP method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
assertEquals("Setting by BOTTOM method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
||||||
|
assertEquals("Setting by BOTTOM method failed!", 0.02, fins.getTabLength(), EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTabSetLength() {
|
||||||
|
final Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||||
|
|
||||||
|
final BodyTube body = (BodyTube)rocket.getChild(0).getChild(1);
|
||||||
|
assertEquals("incorrect body tube length:", 0.20, body.getLength(), EPSILON);
|
||||||
|
|
||||||
|
final FinSet fins = (FinSet)body.getChild(0);
|
||||||
|
fins.setTabHeight(0.01);
|
||||||
|
fins.setTabLength(0.02);
|
||||||
|
assertEquals("incorrect fin length:", 0.05, fins.getLength(), EPSILON);
|
||||||
|
assertEquals("incorrect fin tab height:", 0.01, fins.getTabHeight(), EPSILON);
|
||||||
|
assertEquals("incorrect fin tab length:", 0.02, fins.getTabLength(), EPSILON);
|
||||||
|
assertEquals("incorrect fin location", 0.015, fins.getTabFrontEdge(), EPSILON);
|
||||||
|
|
||||||
|
{ // MIDDLE -> native
|
||||||
|
fins.setTabOffsetMethod(AxialMethod.MIDDLE);
|
||||||
|
fins.setTabOffset(0.0);
|
||||||
|
fins.setTabHeight(0.02);
|
||||||
|
fins.setTabLength(0.04);
|
||||||
|
|
||||||
|
assertEquals("Setting by MIDDLE method failed!", 0.005, fins.getTabFrontEdge(), EPSILON);
|
||||||
|
assertEquals("Setting by MIDDLE method failed!", 0.0, fins.getTabOffset(), EPSILON);
|
||||||
|
assertEquals("Setting by MIDDLE method failed!", 0.04, fins.getTabLength(), EPSILON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user