diff --git a/core/src/net/sf/openrocket/rocketcomponent/ParallelStage.java b/core/src/net/sf/openrocket/rocketcomponent/ParallelStage.java index 48c5184dd..853abef31 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/ParallelStage.java +++ b/core/src/net/sf/openrocket/rocketcomponent/ParallelStage.java @@ -133,24 +133,24 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo public Coordinate[] getInstanceOffsets(){ checkState(); - final double radius = this.radialPosition_m; - final double startAngle = this.angularPosition_rad; - final double angleIncr = this.angularSeparation; Coordinate center = Coordinate.ZERO; - - double curAngle = startAngle; Coordinate[] toReturn = new Coordinate[this.instanceCount]; for (int instanceNumber = 0; instanceNumber < this.instanceCount; instanceNumber++) { - final double curY = radius * Math.cos(curAngle); - final double curZ = radius * Math.sin(curAngle); + final double curAngle = getInstanceAngle( instanceNumber); + final double curY = this.radialPosition_m * Math.cos(curAngle); + final double curZ = this.radialPosition_m * Math.sin(curAngle); toReturn[instanceNumber] = center.add(0, curY, curZ ); - - curAngle += angleIncr; } return toReturn; } + + @Override + public double getInstanceAngle( final int instanceNumber){ + return this.angularPosition_rad + ( instanceNumber * this.angularSeparation); + } + @Override public Coordinate[] getLocations() { if (null == this.parent) { diff --git a/core/src/net/sf/openrocket/rocketcomponent/PodSet.java b/core/src/net/sf/openrocket/rocketcomponent/PodSet.java index 9bb1b9d53..81f96fe60 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/PodSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/PodSet.java @@ -81,24 +81,22 @@ public class PodSet extends ComponentAssembly implements RingInstanceable { public Coordinate[] getInstanceOffsets(){ checkState(); - final double radius = this.radialPosition_m; - final double startAngle = this.angularPosition_rad; - final double angleIncr = this.angularSeparation; Coordinate center = Coordinate.ZERO; - - double curAngle = startAngle; Coordinate[] toReturn = new Coordinate[this.instanceCount]; for (int instanceNumber = 0; instanceNumber < this.instanceCount; instanceNumber++) { - final double curY = radius * Math.cos(curAngle); - final double curZ = radius * Math.sin(curAngle); + final double curAngle = getInstanceAngle( instanceNumber); + final double curY = this.radialPosition_m * Math.cos(curAngle); + final double curZ = this.radialPosition_m * Math.sin(curAngle); toReturn[instanceNumber] = center.add(0, curY, curZ ); - - curAngle += angleIncr; } return toReturn; } + @Override + public double getInstanceAngle( final int instanceNumber){ + return this.angularPosition_rad + ( instanceNumber * this.angularSeparation); + } @Override public Coordinate[] getLocations() { diff --git a/core/src/net/sf/openrocket/rocketcomponent/RingInstanceable.java b/core/src/net/sf/openrocket/rocketcomponent/RingInstanceable.java index df7841ccf..7690fa1c1 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/RingInstanceable.java +++ b/core/src/net/sf/openrocket/rocketcomponent/RingInstanceable.java @@ -4,6 +4,8 @@ public interface RingInstanceable extends Instanceable { public double getAngularOffset(); + public double getInstanceAngle( final int instanceNumber); + public double getRadialOffset(); public boolean getAutoRadialOffset();