package net.sf.openrocket.rocketcomponent;
+import static java.lang.Math.*;
+import static net.sf.openrocket.util.MathUtil.*;
+
+import java.util.Collection;
+
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.MathUtil;
-import java.util.Collection;
-
-import static java.lang.Math.sin;
-import static java.lang.Math.sqrt;
-import static net.sf.openrocket.util.Chars.FRAC12;
-import static net.sf.openrocket.util.Chars.FRAC34;
-import static net.sf.openrocket.util.MathUtil.pow2;
-import static net.sf.openrocket.util.MathUtil.pow3;
-
public class Transition extends SymmetricComponent {
+ private static final Translator trans = Application.getTranslator();
private static final double CLIP_PRECISION = 0.0001;
private double aftShoulderThickness;
private double aftShoulderLength;
private boolean aftShoulderCapped;
- private static final Translator trans = Application.getTranslator();
+
// Used to cache the clip length
private double clipLength = -1;
clipLength = -1;
}
- /**
- * Accept a visitor to this Transition in the component hierarchy.
- *
- * @param theVisitor the visitor that will be called back with a reference to this Transition
- */
- @Override
- public void accept (final ComponentVisitor theVisitor) {
- theVisitor.visit(this);
- }
-
/**
* Check whether the given type can be added to this component. Transitions allow any
* InternalComponents to be added.
- *
- * @param type The RocketComponent class type to add.
+ *
+ * @param ctype The RocketComponent class type to add.
* @return Whether such a component can be added.
*/
@Override
- public boolean isCompatible(Class<? extends RocketComponent> type) {
- if (InternalComponent.class.isAssignableFrom(type))
+ public boolean isCompatible(Class<? extends RocketComponent> ctype) {
+ if (InternalComponent.class.isAssignableFrom(ctype))
return true;
return false;
}
/**
* An enumeration listing the possible shapes of transitions.
- *
+ *
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public static enum Shape {
return sqrt(2 * radius * x - x * x); // radius/length * sphere
}
},
+
//// Power series
POWER(trans.get("Shape.Powerseries"),
- //// A power series nose cone has a profile of <i>Radius</i> × (<i>x</i> / <i>Length</i>)<sup><i>k</i></sup> where <i>k</i> is the shape parameter. For <i>k</i>=0.5 this is a <b>
- trans.get("Shape.Powerseries.descA1") + FRAC12 +
- //// -power</b> or <b>parabolic</b> nose cone, for <i>k</i>=0.75 a <b>
- trans.get("Shape.Powerseries.descA2") + FRAC34 +
- //// -power</b>, and for <i>k</i>=1 a <b>conical</b> nose cone.
- trans.get("Shape.Powerseries.descA3"),
- //// A power series transition has a profile of <i>Radius</i> × (<i>x</i> / <i>Length</i>)<sup><i>k</i></sup> where <i>k</i> is the shape parameter. For <i>k</i>=0.5 the transition is <b>
- trans.get("Shape.Powerseries.descB1") + FRAC12 +
- //// -power</b> or <b>parabolic</b>, for <i>k</i>=0.75 a <b>
- trans.get("Shape.Powerseries.descB2") + FRAC34 +
- //// -power</b>, and for <i>k</i>=1 <b>conical</b>.
- trans.get("Shape.Powerseries.descB3"), true) {
+ trans.get("Shape.Powerseries.desc1"),
+ trans.get("Shape.Powerseries.desc2"), true) {
@Override
public boolean usesParameter() { // Range 0...1
return true;
}
},
+
//// Parabolic series
PARABOLIC(trans.get("Shape.Parabolicseries"),
////A parabolic series nose cone has a profile of a parabola. The shape parameter defines the segment of the parabola to utilize. The shape parameter 1.0 produces a <b>full parabola</b> which is tangent to the body tube, 0.75 produces a <b>3/4 parabola</b>, 0.5 procudes a <b>1/2 parabola</b> and 0 produces a <b>conical</b> nose cone.
// In principle a parabolic transition is clippable, but the difference is
// negligible.
-
+
@Override
public boolean usesParameter() { // Range 0...1
return true;
}
},
-
//// Haack series
HAACK(trans.get("Shape.Haackseries"),
//// The Haack series nose cones are designed to minimize drag. The shape parameter 0 produces an <b>LD-Haack</b> or <b>Von Karman</b> nose cone, which minimizes drag for fixed length and diameter, while a value of 0.333 produces an <b>LV-Haack</b> nose cone, which minimizes drag for fixed length and volume.
trans.get("Shape.Haackseries.desc1"),
//// The Haack series <i>nose cones</i> are designed to minimize drag. These transition shapes are their equivalents, but do not necessarily produce optimal drag for transitions. The shape parameter 0 produces an <b>LD-Haack</b> or <b>Von Karman</b> shape, while a value of 0.333 produces an <b>LV-Haack</b> shape.
trans.get("Shape.Haackseries.desc2"), true) {
+
@Override
public boolean usesParameter() {
return true;
* shape parameter at the point x from the tip of the component. It is assumed
* that the fore radius if zero and the aft radius is <code>radius >= 0</code>.
* Boattails are achieved by reversing the component.
- *
+ *
* @param x Position from the tip of the component.
* @param radius Aft end radius >= 0.
* @param length Length of the transition >= 0.