From 638524b8a20d76af629e77c52eca416a7aaca602 Mon Sep 17 00:00:00 2001 From: Bill Kuker Date: Thu, 15 Sep 2011 16:27:54 +0000 Subject: [PATCH] Format --- .../rocketry/motorsim/grain/MultiPort.java | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/com/billkuker/rocketry/motorsim/grain/MultiPort.java b/src/com/billkuker/rocketry/motorsim/grain/MultiPort.java index 98fe11f..b79ecdf 100644 --- a/src/com/billkuker/rocketry/motorsim/grain/MultiPort.java +++ b/src/com/billkuker/rocketry/motorsim/grain/MultiPort.java @@ -20,29 +20,28 @@ import com.billkuker.rocketry.motorsim.visual.Editor; import com.billkuker.rocketry.motorsim.visual.GrainPanel; public class MultiPort extends ExtrudedShapeGrain implements Validating { - + private Amount oD = Amount.valueOf(30, SI.MILLIMETER); - - + private Amount coreD = Amount.valueOf(3, SI.MILLIMETER); - + private Amount r1D = Amount.valueOf(2, SI.MILLIMETER); private Amount r1Offset = Amount.valueOf(5, SI.MILLIMETER); private int r1Count = 4; - + private Amount r2D = Amount.valueOf(1, SI.MILLIMETER); private Amount r2Offset = Amount.valueOf(10, SI.MILLIMETER); private int r2Count = 8; private Amount ringTwoRot = Amount.valueOf(22.5, NonSI.DEGREE_ANGLE); - + @Override public void validate() throws ValidationException { // TODO Auto-generated method stub - + } - - public MultiPort(){ + + public MultiPort() { try { setLength(Amount.valueOf(70, SI.MILLIMETER)); } catch (PropertyVetoException e) { @@ -50,38 +49,45 @@ public class MultiPort extends ExtrudedShapeGrain implements Validating { } generateGeometry(); } - - private void generateGeometry(){ + + private void generateGeometry() { double odmm = oD.doubleValue(SI.MILLIMETER); double cdmm = coreD.doubleValue(SI.MILLIMETER); double r1dmm = r1D.doubleValue(SI.MILLIMETER); double r1off = r1Offset.doubleValue(SI.MILLIMETER); - + double r2dmm = r2D.doubleValue(SI.MILLIMETER); double r2off = r2Offset.doubleValue(SI.MILLIMETER); - + double r2rot = ringTwoRot.doubleValue(SI.RADIAN); - + xsection = new BurningShape(); - Shape outside = new Ellipse2D.Double(-odmm/2, -odmm/2, odmm, odmm); + Shape outside = new Ellipse2D.Double(-odmm / 2, -odmm / 2, odmm, odmm); xsection.add(outside); xsection.inhibit(outside); - xsection.subtract(new Ellipse2D.Double(-cdmm/2, -cdmm/2, cdmm, cdmm)); + xsection.subtract(new Ellipse2D.Double(-cdmm / 2, -cdmm / 2, cdmm, cdmm)); webThickness = null; - - for ( int i = 0; i < r1Count; i++ ){ - Shape port = new Ellipse2D.Double(r1off-r1dmm/2,-r1dmm/2,r1dmm,r1dmm); - xsection.subtract(port, AffineTransform.getRotateInstance(i*(2.0*Math.PI/r1Count))); + + for (int i = 0; i < r1Count; i++) { + Shape port = new Ellipse2D.Double(r1off - r1dmm / 2, -r1dmm / 2, + r1dmm, r1dmm); + xsection.subtract( + port, + AffineTransform.getRotateInstance(i + * (2.0 * Math.PI / r1Count))); } - - for ( int i = 0; i < r2Count; i++ ){ - Shape port = new Ellipse2D.Double(r2off-r2dmm/2,-r2dmm/2,r2dmm,r2dmm); - xsection.subtract(port, AffineTransform.getRotateInstance(r2rot + i*(2.0*Math.PI/r2Count))); + + for (int i = 0; i < r2Count; i++) { + Shape port = new Ellipse2D.Double(r2off - r2dmm / 2, -r2dmm / 2, + r2dmm, r2dmm); + xsection.subtract( + port, + AffineTransform.getRotateInstance(r2rot + i + * (2.0 * Math.PI / r2Count))); } } - - public static void main(String args[]){ + public static void main(String args[]) { Grain g; new GrainPanel(g = new MultiPort()).showAsWindow(); new Editor(g).showAsWindow(); -- 2.30.2