[refactor] added getInstanceAngle(int) function to the RingInstanceable class (and implementations)
This commit is contained in:
parent
8e8ba9324f
commit
f469ee9586
@ -133,24 +133,24 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo
|
|||||||
public Coordinate[] getInstanceOffsets(){
|
public Coordinate[] getInstanceOffsets(){
|
||||||
checkState();
|
checkState();
|
||||||
|
|
||||||
final double radius = this.radialPosition_m;
|
|
||||||
final double startAngle = this.angularPosition_rad;
|
|
||||||
final double angleIncr = this.angularSeparation;
|
|
||||||
Coordinate center = Coordinate.ZERO;
|
Coordinate center = Coordinate.ZERO;
|
||||||
|
|
||||||
double curAngle = startAngle;
|
|
||||||
Coordinate[] toReturn = new Coordinate[this.instanceCount];
|
Coordinate[] toReturn = new Coordinate[this.instanceCount];
|
||||||
for (int instanceNumber = 0; instanceNumber < this.instanceCount; instanceNumber++) {
|
for (int instanceNumber = 0; instanceNumber < this.instanceCount; instanceNumber++) {
|
||||||
final double curY = radius * Math.cos(curAngle);
|
final double curAngle = getInstanceAngle( instanceNumber);
|
||||||
final double curZ = radius * Math.sin(curAngle);
|
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 );
|
toReturn[instanceNumber] = center.add(0, curY, curZ );
|
||||||
|
|
||||||
curAngle += angleIncr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getInstanceAngle( final int instanceNumber){
|
||||||
|
return this.angularPosition_rad + ( instanceNumber * this.angularSeparation);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Coordinate[] getLocations() {
|
public Coordinate[] getLocations() {
|
||||||
if (null == this.parent) {
|
if (null == this.parent) {
|
||||||
|
@ -81,24 +81,22 @@ public class PodSet extends ComponentAssembly implements RingInstanceable {
|
|||||||
public Coordinate[] getInstanceOffsets(){
|
public Coordinate[] getInstanceOffsets(){
|
||||||
checkState();
|
checkState();
|
||||||
|
|
||||||
final double radius = this.radialPosition_m;
|
|
||||||
final double startAngle = this.angularPosition_rad;
|
|
||||||
final double angleIncr = this.angularSeparation;
|
|
||||||
Coordinate center = Coordinate.ZERO;
|
Coordinate center = Coordinate.ZERO;
|
||||||
|
|
||||||
double curAngle = startAngle;
|
|
||||||
Coordinate[] toReturn = new Coordinate[this.instanceCount];
|
Coordinate[] toReturn = new Coordinate[this.instanceCount];
|
||||||
for (int instanceNumber = 0; instanceNumber < this.instanceCount; instanceNumber++) {
|
for (int instanceNumber = 0; instanceNumber < this.instanceCount; instanceNumber++) {
|
||||||
final double curY = radius * Math.cos(curAngle);
|
final double curAngle = getInstanceAngle( instanceNumber);
|
||||||
final double curZ = radius * Math.sin(curAngle);
|
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 );
|
toReturn[instanceNumber] = center.add(0, curY, curZ );
|
||||||
|
|
||||||
curAngle += angleIncr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getInstanceAngle( final int instanceNumber){
|
||||||
|
return this.angularPosition_rad + ( instanceNumber * this.angularSeparation);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Coordinate[] getLocations() {
|
public Coordinate[] getLocations() {
|
||||||
|
@ -4,6 +4,8 @@ public interface RingInstanceable extends Instanceable {
|
|||||||
|
|
||||||
public double getAngularOffset();
|
public double getAngularOffset();
|
||||||
|
|
||||||
|
public double getInstanceAngle( final int instanceNumber);
|
||||||
|
|
||||||
public double getRadialOffset();
|
public double getRadialOffset();
|
||||||
|
|
||||||
public boolean getAutoRadialOffset();
|
public boolean getAutoRadialOffset();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user