From 486a7f94e1a0cd081ccad3273ce89a1538ab298b Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Sun, 12 Apr 2020 20:29:14 -0700 Subject: [PATCH 1/6] Fix TubeFinSet 2D rendering The TubeFinSetShapes were applying the supplied transform too many times, resulting in the the shapes being offset off the viewing area. The offset transform is already applied to the component instance that is provided to the TubeFinSetShapes methods, so applying the transform resulted in the offset being moved to the right. This change removes the transform being applied to the component locations when retrieved and only applies a linear transformation to the component locations when applying the base rotational transform. Using the linear transform avoids applying the offset in addition to the rest of the transform. The problem existed in both the side view and the back view, however the back view was not as obvious due to the nature of the view. The common code between both functions applying the transform is refactored into a common location to reduce the amount of code. Additionally, documentation was added explaining the transform process that is being applied to the component locations for the final shapes. Fixes #605 Signed-off-by: Billy Olsen --- .../gui/rocketfigure/TubeFinSetShapes.java | 130 +++++++++++------- 1 file changed, 80 insertions(+), 50 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java index f3eb9e8d3..1b00fd5f4 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java @@ -10,72 +10,102 @@ import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Transformation; +/** + * The TubeFinSetShapes is used for retrieving shapes of the TubeFins on a + * Rocket from multiple view points. The returned shapes will be translated + * and transformed to the correct locations for rendering the rocket in the + * 2D view space. + */ public class TubeFinSetShapes extends RocketComponentShape { + /** + * Returns an array of RocketcomponentShapes that describe the shape of + * the TubeFinSet when viewed from the side of the rocket. TubeFins will + * appear as a Rectangle from the side view + * + * @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. + */ public static RocketComponentShape[] getShapesSide( final RocketComponent component, final Transformation transformation) { - TubeFinSet finset = (net.sf.openrocket.rocketcomponent.TubeFinSet)component; + TubeFinSet finSet = (TubeFinSet) component; - int fins = finset.getFinCount(); - double length = finset.getLength(); - double outerRadius = finset.getOuterRadius(); - double bodyRadius = finset.getBodyRadius(); - // old version - Oct, 19 2015 - //Coordinate[] instanceOffsets = new Coordinate[]{ transformation.transform( componentAbsoluteLocation )}; - //instanceOffsets = component.shiftCoordinates(instanceOffsets); - - // new version - Coordinate[] start = transformation.transform( component.getLocations()); + final double outerRadius = finSet.getOuterRadius(); + final double length = finSet.getLength(); + Coordinate[] locations = transformLocations(finSet, transformation); + Transformation finRotation = finSet.getFinRotationTransformation(); - Transformation baseRotation = finset.getBaseRotationTransformation(); - Transformation finRotation = finset.getFinRotationTransformation(); - - // Translate & rotate the coordinates - for (int i=0; i Date: Sun, 12 Apr 2020 20:48:45 -0700 Subject: [PATCH 2/6] Remove System.out.println in ComponentRenderer Removes an unnecessary System.out.println to avoid extra printouts on the console. Signed-off-by: Billy Olsen --- .../sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java index b725988b6..721c9cde0 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java @@ -317,7 +317,6 @@ public class ComponentRenderer { private void renderTubeFins(GL2 gl, TubeFinSet fs, Surface which) { gl.glPushMatrix(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); - System.out.println(fs.getBaseRotation()); gl.glRotated(fs.getBaseRotation() * (180.0 / Math.PI), 1, 0, 0); for( int i = 0; i< fs.getFinCount(); i++ ) { gl.glPushMatrix(); From 74ec0be340baf06d63cdc0e81cfd45e79bc2fa48 Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Sun, 19 Jul 2020 14:52:25 -0700 Subject: [PATCH 3/6] Make TubeFinSet RingInstanceable Make the TubeFinSet RingInstanceable. This change updates the rendering of both the 2D and 3D views to handle the RingInstanceable shapes. This also updates the DocumentConfig to parse the new XML formats properly. Signed-off-by: Billy Olsen --- .../openrocket/importt/DocumentConfig.java | 4 + .../rocketcomponent/TubeFinSet.java | 135 ++++++++++++++++-- .../figure3d/geometry/ComponentRenderer.java | 9 +- .../gui/rocketfigure/TubeFinSetShapes.java | 27 ++-- 4 files changed, 137 insertions(+), 38 deletions(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java index 3dd43b81b..d29068f6c 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/DocumentConfig.java @@ -294,6 +294,10 @@ class DocumentConfig { Reflection.findMethod(TubeFinSet.class, "setOuterRadius", double.class), "auto", Reflection.findMethod(TubeFinSet.class, "setOuterRadiusAutomatic", boolean.class))); + setters.put("TubeFinSet:instancecount", new IntSetter( + Reflection.findMethod(TubeFinSet.class, "setInstanceCount", int.class))); + setters.put("TubeFinSet:angleoffset", new AnglePositionSetter() ); + setters.put("TubeFinSet:radiusoffset", new RadiusPositionSetter() ); // InternalComponent - nothing diff --git a/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java b/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java index aa9ad73ab..089107197 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java @@ -7,14 +7,16 @@ import java.util.List; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.preset.ComponentPreset.Type; +import net.sf.openrocket.rocketcomponent.position.AngleMethod; import net.sf.openrocket.rocketcomponent.position.AxialMethod; import net.sf.openrocket.rocketcomponent.position.AxialPositionable; +import net.sf.openrocket.rocketcomponent.position.RadiusMethod; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Transformation; -public class TubeFinSet extends ExternalComponent implements AxialPositionable { +public class TubeFinSet extends ExternalComponent implements RingInstanceable, AxialPositionable { private static final Translator trans = Application.getTranslator(); private final static double DEFAULT_RADIUS = 0.025; @@ -22,18 +24,20 @@ public class TubeFinSet extends ExternalComponent implements AxialPositionable { private boolean autoRadius = true; // Radius chosen automatically based on parent component private double outerRadius = DEFAULT_RADIUS; protected double thickness = 0.002; - - protected int fins = 6; + private AngleMethod angleMethod = AngleMethod.FIXED; + protected RadiusMethod radiusMethod = RadiusMethod.RELATIVE; /** * Rotation angle of the first fin. Zero corresponds to the positive y-axis. */ - protected double rotation = 0; + private double firstFinOffsetRadians = 0; + + protected int fins = 6; /** * Rotation about the x-axis by angle this.rotation. */ - protected Transformation baseRotation = Transformation.rotate_x(rotation); + protected Transformation baseRotation = Transformation.IDENTITY; // initially, rotate by 0 radians. /** * Rotation about the x-axis by 2*PI/fins. @@ -167,7 +171,6 @@ public class TubeFinSet extends ExternalComponent implements AxialPositionable { public int getFinCount() { return fins; } - @Override public boolean isAfter(){ @@ -195,7 +198,7 @@ public class TubeFinSet extends ExternalComponent implements AxialPositionable { * @return The base rotation amount. */ public double getBaseRotation() { - return rotation; + return getAngleOffset(); } public double getFinRotation() { @@ -207,12 +210,7 @@ public class TubeFinSet extends ExternalComponent implements AxialPositionable { * @param r The base rotation amount. */ public void setBaseRotation(double r) { - r = MathUtil.reduce180(r); - if (MathUtil.equals(r, rotation)) - return; - rotation = r; - baseRotation = Transformation.rotate_x(rotation); - fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); + setAngleOffset(r); } public Transformation getBaseRotationTransformation() { @@ -327,9 +325,9 @@ public class TubeFinSet extends ExternalComponent implements AxialPositionable { RocketComponent s; s = this.getParent(); + double x = this.getPosition().x; while (s != null) { if (s instanceof SymmetricComponent) { - double x = this.getPosition().x; return ((SymmetricComponent) s).getRadius(x); } s = s.getParent(); @@ -337,4 +335,113 @@ public class TubeFinSet extends ExternalComponent implements AxialPositionable { return 0; } + @Override + public int getInstanceCount() { + return getFinCount(); + } + + @Override + public void setInstanceCount(int newCount) { + setFinCount(newCount); + } + + @Override + public String getPatternName() { + return (this.getInstanceCount() + "-tubefin-ring"); + } + + @Override + public double getBoundingRadius() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setRadius(RadiusMethod method, double radius) { + // TODO Auto-generated method stub + + } + + @Override + public void setAngleOffset(double angleRadians) { + final double reducedAngle = MathUtil.reducePI(angleRadians); + if (MathUtil.equals(reducedAngle, firstFinOffsetRadians)) + return; + firstFinOffsetRadians = reducedAngle; + + if (MathUtil.equals(this.firstFinOffsetRadians, 0)) { + baseRotation = Transformation.IDENTITY; + } else { + baseRotation = Transformation.rotate_x(firstFinOffsetRadians); + } + + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); + } + + @Override + public AngleMethod getAngleMethod() { + return this.angleMethod; + } + + @Override + public double getAngleOffset() { + return this.firstFinOffsetRadians; + } + + @Override + public void setAngleMethod(AngleMethod newAngleMethod) { + mutex.verify(); + this.angleMethod = newAngleMethod; + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); + } + + @Override + public double getInstanceAngleIncrement() { + return ( 2*Math.PI / getFinCount()); + } + + @Override + public double[] getInstanceAngles() { + final double angleIncrementRadians = getInstanceAngleIncrement(); + + double[] result = new double[getFinCount()]; + for (int finNumber=0; finNumber < getFinCount(); ++finNumber) { + double additionalOffset = angleIncrementRadians * finNumber; + result[finNumber] = MathUtil.reduce2PI(firstFinOffsetRadians + additionalOffset); + } + + return result; + } + + @Override + public Coordinate[] getInstanceOffsets() { + checkState(); + + final double bodyRadius = this.getBodyRadius(); + + // already includes the base rotation + final double[] angles = getInstanceAngles(); + + Coordinate[] toReturn = new Coordinate[this.fins]; + for (int instanceNumber = 0; instanceNumber < this.fins; instanceNumber++) { + final Coordinate raw = new Coordinate( 0, bodyRadius, 0); + final Coordinate rotated = Transformation.getAxialRotation(angles[instanceNumber]).transform(raw); + toReturn[instanceNumber] = rotated; + } + + return toReturn; + } + + @Override + public void setRadiusOffset(double radius) { + // TODO Auto-generated method stub + + } + + @Override + public void setRadiusMethod(RadiusMethod method) { + // TODO Auto-generated method stub + + } + } diff --git a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java index 721c9cde0..c13e156e4 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java @@ -318,13 +318,8 @@ public class ComponentRenderer { gl.glPushMatrix(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glRotated(fs.getBaseRotation() * (180.0 / Math.PI), 1, 0, 0); - for( int i = 0; i< fs.getFinCount(); i++ ) { - gl.glPushMatrix(); - gl.glTranslated(0, fs.getOuterRadius() + fs.getBodyRadius(), 0); - renderTube(gl, which, fs.getOuterRadius(), fs.getInnerRadius(), fs.getLength()); - gl.glPopMatrix(); - gl.glRotated(360.0 / fs.getFinCount(), 1, 0, 0); - } + gl.glTranslated(0, fs.getOuterRadius(), 0); + renderTube(gl, which, fs.getOuterRadius(), fs.getInnerRadius(), fs.getLength()); gl.glPopMatrix(); } diff --git a/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java b/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java index 1b00fd5f4..7b124b55a 100644 --- a/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java +++ b/swing/src/net/sf/openrocket/gui/rocketfigure/TubeFinSetShapes.java @@ -35,13 +35,10 @@ public class TubeFinSetShapes extends RocketComponentShape { final double outerRadius = finSet.getOuterRadius(); final double length = finSet.getLength(); Coordinate[] locations = transformLocations(finSet, transformation); - Transformation finRotation = finSet.getFinRotationTransformation(); - Shape[] shapes = new Shape[finSet.getFinCount()]; - for (int i=0; i < shapes.length; i++) { - shapes[i] = new Rectangle2D.Double(locations[0].x, (locations[0].y-outerRadius), length, 2*outerRadius); - locations = finRotation.transform(locations); - } + Shape[] shapes = new Shape[] { + new Rectangle2D.Double(locations[0].x, (locations[0].y-outerRadius), length, 2*outerRadius) + }; return RocketComponentShape.toArray(shapes, component); } @@ -62,13 +59,10 @@ public class TubeFinSetShapes extends RocketComponentShape { final double outerRadius = finSet.getOuterRadius(); Coordinate[] locations = transformLocations(finSet, transformation); - Transformation finRotation = finSet.getFinRotationTransformation(); - Shape[] shapes = new Shape[finSet.getFinCount()]; - for (int i=0; i < shapes.length; i++) { - shapes[i] = new Ellipse2D.Double((locations[0].z - outerRadius), (locations[0].y - outerRadius), (2 * outerRadius), (2 * outerRadius)); - locations = finRotation.transform(locations); - } + Shape[] shapes = new Shape[] { + new Ellipse2D.Double((locations[0].z - outerRadius), (locations[0].y - outerRadius), (2 * outerRadius), (2 * outerRadius)) + }; return RocketComponentShape.toArray(shapes, component); } @@ -95,13 +89,12 @@ public class TubeFinSetShapes extends RocketComponentShape { private static Coordinate[] transformLocations(final TubeFinSet finSet, final Transformation transformation) { final double outerRadius = finSet.getOuterRadius(); final double bodyRadius = finSet.getBodyRadius(); - Coordinate[] locations = finSet.getComponentLocations(); - Transformation baseRotation = finSet.getBaseRotationTransformation(); + Coordinate[] locations = finSet.getInstanceLocations(); for (int i=0; i < locations.length; i++) { - Coordinate c = locations[i].add(0, (bodyRadius + outerRadius), 0); - c = transformation.linearTransform(c); - c = baseRotation.transform(c); + Coordinate c = locations[i].setX(0.); + c = c.sub(0, (bodyRadius - outerRadius), 0); + c = transformation.transform(c); locations[i] = c; } From ac7d606423ec4d3235deb2b49a339700a1307000 Mon Sep 17 00:00:00 2001 From: Daniel_M_Williams Date: Sat, 25 Jul 2020 10:35:59 -0400 Subject: [PATCH 4/6] [fix] fixes rotation issues in TubeFinSet 2d rendering. --- .../rocketcomponent/TubeFinSet.java | 4 +- .../gui/rocketfigure/TubeFinSetShapes.java | 58 +++---------------- 2 files changed, 11 insertions(+), 51 deletions(-) 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; - } - } From ec40b20ae0b804d82e7fa1aef0a64261a2a54696 Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Sat, 25 Jul 2020 18:17:31 -0700 Subject: [PATCH 5/6] Fix 3D rendering of TubeFinSet. Changes to the TubeFinSet instanceable caused extra rotations of the TubeFinSet around body tubes and podsets. Remove the extra rotation from the 3D renderer. Signed-off-by: Billy Olsen --- .../sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java index c13e156e4..e239701b6 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/geometry/ComponentRenderer.java @@ -317,7 +317,6 @@ public class ComponentRenderer { private void renderTubeFins(GL2 gl, TubeFinSet fs, Surface which) { gl.glPushMatrix(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); - gl.glRotated(fs.getBaseRotation() * (180.0 / Math.PI), 1, 0, 0); gl.glTranslated(0, fs.getOuterRadius(), 0); renderTube(gl, which, fs.getOuterRadius(), fs.getInnerRadius(), fs.getLength()); gl.glPopMatrix(); From 908e6359ff255891e58e0710ddeca45c0d4f3839 Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Sat, 25 Jul 2020 18:18:46 -0700 Subject: [PATCH 6/6] Add BoxBounded interface to TubeFinSet TubeFinSets cause rocket size within the panel to be a bit off. Add the BoxBounded interface to provide a tight BoundingBox. Signed-off-by: Billy Olsen --- .../net/sf/openrocket/rocketcomponent/TubeFinSet.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java b/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java index 76b833584..936a6d584 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/TubeFinSet.java @@ -12,11 +12,12 @@ import net.sf.openrocket.rocketcomponent.position.AxialMethod; import net.sf.openrocket.rocketcomponent.position.AxialPositionable; import net.sf.openrocket.rocketcomponent.position.RadiusMethod; import net.sf.openrocket.startup.Application; +import net.sf.openrocket.util.BoundingBox; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Transformation; -public class TubeFinSet extends ExternalComponent implements RingInstanceable, AxialPositionable { +public class TubeFinSet extends ExternalComponent implements AxialPositionable, BoxBounded, RingInstanceable { private static final Translator trans = Application.getTranslator(); private final static double DEFAULT_RADIUS = 0.025; @@ -314,6 +315,14 @@ public class TubeFinSet extends ExternalComponent implements RingInstanceable, A return bounds; } + @Override + public BoundingBox getInstanceBoundingBox() { + BoundingBox box = new BoundingBox(); + box.update(new Coordinate(0, -outerRadius, -outerRadius)); + box.update(new Coordinate(length, outerRadius, outerRadius)); + return box; + } + /** * Return the radius of the BodyComponent the fin set is situated on. Currently * only supports SymmetricComponents and returns the radius at the starting point of the