- for (int i = 0; i < cg.length; i++) {\r
- cg[i] = new Coordinate();\r
- cg[i].setWeight(0.0); //TODO: Set weight!\r
+ cg[0] = new Coordinate();\r
+ \r
+ double lastWeight = b\r
+ .getMotor()\r
+ .getGrain()\r
+ .volume(Amount.valueOf(0, SI.METER))\r
+ .times(b.getMotor().getFuel().getIdealDensity()\r
+ .times(b.getMotor().getFuel().getDensityRatio()))\r
+ .to(Mass.UNIT).doubleValue(SI.KILOGRAM);\r
+ \r
+ int i = 0;\r
+ double len = ((ICylindricalChamber) burn.getMotor().getChamber())\r
+ .getLength().doubleValue(SI.METER);\r
+ \r
+ for (Interval d : burn.getData().values()) {\r
+ lastWeight = lastWeight - d.fuelBurnt.doubleValue(SI.KILOGRAM);\r
+ cg[i] = new Coordinate(len/2.0,0,0,lastWeight);\r
+ System.err.println(lastWeight);\r
+ i++;\r