updates for 0.9.3
[debian/openrocket] / src / net / sf / openrocket / rocketcomponent / RingComponent.java
index 7c8523b0063688a27a820f77edc03664f8b95bf1..3d67940b6728650c99580d78af786ee142c47343 100644 (file)
@@ -132,6 +132,27 @@ public abstract class RingComponent extends StructuralComponent {
                fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
        }
 
+       
+       public double getRadialShiftY() {
+               return shiftY;
+       }
+       
+       public double getRadialShiftZ() {
+               return shiftZ;
+       }
+       
+       public void setRadialShift(double y, double z) {
+               radialPosition = Math.hypot(y, z);
+               radialDirection = Math.atan2(z, y);
+               
+               // Re-calculate to ensure consistency 
+               shiftY = radialPosition * Math.cos(radialDirection);
+               shiftZ = radialPosition * Math.sin(radialDirection);
+               assert(MathUtil.equals(y, shiftY));
+               assert(MathUtil.equals(z, shiftZ));
+               
+               fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
+       }
 
 
        /**