fixed conical nosecane display issue while instanced (i.e. off-axis)

This commit is contained in:
Daniel_M_Williams 2015-06-25 18:41:28 -04:00
parent ee21c7ea0c
commit df5b213d44
3 changed files with 14 additions and 14 deletions

View File

@ -142,7 +142,7 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
@Override
public void setRadialPosition(final double radius) {
this.radialPosition_m = radius;
log.error(" set radial position for: " + this.getName() + " to: " + this.radialPosition_m + " ... in meters?");
// log.error(" set radial position for: " + this.getName() + " to: " + this.radialPosition_m + " ... in meters?");
if (this.outside) {
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -207,11 +207,9 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
double angle0 = this.angularPosition_rad;
double angleIncr = this.angularSeparation;
System.err.println("Producing offsets list: ");
double thisAngle = angle0;
for (int instanceNumber = 0; instanceNumber < this.count; instanceNumber++) {
toReturn[instanceNumber] = new Coordinate(0, radius * Math.cos(thisAngle), radius * Math.sin(thisAngle));
System.err.println(" instance#: " + instanceNumber + " = " + toReturn[instanceNumber]);
thisAngle += angleIncr;
}

View File

@ -1,5 +1,6 @@
package net.sf.openrocket.gui.rocketfigure;
import net.sf.openrocket.gui.scalefigure.RocketFigure;
import net.sf.openrocket.rocketcomponent.Transition;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.Transformation;
@ -7,6 +8,7 @@ import net.sf.openrocket.util.Transformation;
import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
@ -18,14 +20,14 @@ public class TransitionShapes extends RocketComponentShape {
net.sf.openrocket.rocketcomponent.RocketComponent component,
Transformation transformation,
Coordinate instanceOffset) {
return getShapesSide(component, transformation, instanceOffset, S);
return getShapesSide(component, transformation, instanceOffset, S);
}
public static RocketComponentShape[] getShapesSide(
net.sf.openrocket.rocketcomponent.RocketComponent component,
Transformation transformation,
Coordinate instanceOffset,
final double scaleFactor) {
net.sf.openrocket.rocketcomponent.RocketComponent component,
Transformation transformation,
Coordinate instanceOffset,
final double scaleFactor) {
net.sf.openrocket.rocketcomponent.Transition transition = (net.sf.openrocket.rocketcomponent.Transition)component;
RocketComponentShape[] mainShapes;
@ -39,10 +41,10 @@ public class TransitionShapes extends RocketComponentShape {
toAbsolute(instanceOffset)[0]);
Path2D.Float path = new Path2D.Float();
path.moveTo(start.x* scaleFactor, r1* scaleFactor);
path.lineTo((start.x+length)* scaleFactor, r2* scaleFactor);
path.lineTo((start.x+length)* scaleFactor, -r2* scaleFactor);
path.lineTo(start.x* scaleFactor, -r1* scaleFactor);
path.moveTo( start.x* scaleFactor, (start.y+ r1)* scaleFactor);
path.lineTo( (start.x+length)* scaleFactor, (start.y+r2)* scaleFactor);
path.lineTo( (start.x+length)* scaleFactor, (start.y-r2)* scaleFactor);
path.lineTo( start.x* scaleFactor, (start.y-r1)* scaleFactor);
path.closePath();
mainShapes = new RocketComponentShape[] { new RocketComponentShape( path, component) };