diff --git a/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java b/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java index 089107197..76b833584 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java @@ -68,7 +68,7 @@ public class TubeFinSet extends ExternalComponent implements RingInstanceable, A } /** - * Return the outer radius of the body tube. + * Return the outer radius of the tube-fin * * @return the outside radius of the tube */ @@ -104,7 +104,7 @@ public class TubeFinSet extends ExternalComponent implements RingInstanceable, A } /** - * Set the outer radius of the body tube. If the radius is less than the wall thickness, + * Set the outer radius of the tube-fin. If the radius is less than the wall thickness, * the wall thickness is decreased accordingly of the value of the radius. * This method sets the automatic radius off. * diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java index 7b124b55a..60d17b31d 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java @@ -25,19 +25,16 @@ public class TubeFinSetShapes extends RocketComponentShape { * * @param component the TubeFinSet to get the shapes for * @param transformation the transformation to apply to the shapes - * @return an array of RocketComponentShapes that are used to draw the - * TubeFinSet from the side. + * @return an array of RocketComponentShapes that are used to draw the TubeFinSet from the side. */ public static RocketComponentShape[] getShapesSide( final RocketComponent component, final Transformation transformation) { - - TubeFinSet finSet = (TubeFinSet) component; - + final TubeFinSet finSet = (TubeFinSet) component; final double outerRadius = finSet.getOuterRadius(); final double length = finSet.getLength(); - Coordinate[] locations = transformLocations(finSet, transformation); + final Coordinate location = transformation.transform(new Coordinate(0, outerRadius, 0)); - Shape[] shapes = new Shape[] { - new Rectangle2D.Double(locations[0].x, (locations[0].y-outerRadius), length, 2*outerRadius) + final Shape[] shapes = new Shape[] { + new Rectangle2D.Double(location.x, (location.y-outerRadius), length, 2*outerRadius) }; return RocketComponentShape.toArray(shapes, component); @@ -54,51 +51,14 @@ public class TubeFinSetShapes extends RocketComponentShape { * TubeFinSet from the back */ public static RocketComponentShape[] getShapesBack( final RocketComponent component, final Transformation transformation) { - - TubeFinSet finSet = (TubeFinSet) component; - + final TubeFinSet finSet = (TubeFinSet) component; final double outerRadius = finSet.getOuterRadius(); - Coordinate[] locations = transformLocations(finSet, transformation); + final Coordinate location = transformation.transform(new Coordinate(0, outerRadius, 0)); - Shape[] shapes = new Shape[] { - new Ellipse2D.Double((locations[0].z - outerRadius), (locations[0].y - outerRadius), (2 * outerRadius), (2 * outerRadius)) + final Shape[] shapes = new Shape[] { + new Ellipse2D.Double((location.z - outerRadius), (location.y - outerRadius), (2 * outerRadius), (2 * outerRadius)) }; return RocketComponentShape.toArray(shapes, component); } - - /** - * Translates and rotates the coordinates as follows: - * - * 1. Ensure the coordinate accounts for the body and outer radius. This - * adjusts the Y value of the coordinate to place it in the correct - * position relative to the body tube. - * - * 2. Perform a linear transformation of the coordinate using the supplied - * transform. Using the linear transform ensures the coordinate is - * rotated per the view, but avoids applying an offset translation - * since that is already applied in the locations retrieved from the - * TubeFinSet. - * - * 3. Apply the base rotational transform described by the TubeFinSet - * component itself. - * - * @param finSet the TubeFinSet to apply the transformation to - * @param transformation the Transformation to apply to the TubeFinSet - */ - private static Coordinate[] transformLocations(final TubeFinSet finSet, final Transformation transformation) { - final double outerRadius = finSet.getOuterRadius(); - final double bodyRadius = finSet.getBodyRadius(); - Coordinate[] locations = finSet.getInstanceLocations(); - - for (int i=0; i < locations.length; i++) { - Coordinate c = locations[i].setX(0.); - c = c.sub(0, (bodyRadius - outerRadius), 0); - c = transformation.transform(c); - locations[i] = c; - } - - return locations; - } - }