world coordinate patch
This commit is contained in:
parent
d93e265e90
commit
9e6e7418c2
@ -1,6 +1,7 @@
|
|||||||
2011-08-28 Richard Graham
|
2011-08-28 Richard Graham
|
||||||
|
|
||||||
* Patch for geodetic computations + coriolis effect
|
* Patch for geodetic computations + coriolis effect
|
||||||
|
* Patch for enhanced gravity model
|
||||||
|
|
||||||
2011-08-25 Sampo Niskanen
|
2011-08-25 Sampo Niskanen
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ RocketCompCfg.border.Foreshoulder = Fore shoulder
|
|||||||
!RocketCompCfg.lbl.Length = Length:
|
!RocketCompCfg.lbl.Length = Length:
|
||||||
|
|
||||||
! BulkheadConfig
|
! BulkheadConfig
|
||||||
BulkheadCfg.tab.Radius = Radius:
|
BulkheadCfg.tab.Diameter = Diameter:
|
||||||
BulkheadCfg.tab.Thickness = Thickness:
|
BulkheadCfg.tab.Thickness = Thickness:
|
||||||
BulkheadCfg.tab.General = General
|
BulkheadCfg.tab.General = General
|
||||||
BulkheadCfg.tab.Generalproperties = General properties
|
BulkheadCfg.tab.Generalproperties = General properties
|
||||||
@ -802,7 +802,7 @@ ParachuteCfg.but.Reset = Reset
|
|||||||
ParachuteCfg.lbl.plusdelay = plus
|
ParachuteCfg.lbl.plusdelay = plus
|
||||||
|
|
||||||
! ShockCordConfig
|
! ShockCordConfig
|
||||||
ShockCordCfg.lbl.Shockcordlength = Shock cord length
|
ShockCordCfg.lbl.Shockcordlength = Shock cord length:
|
||||||
ShockCordCfg.lbl.Shockcordmaterial = Shock cord material:
|
ShockCordCfg.lbl.Shockcordmaterial = Shock cord material:
|
||||||
ShockCordCfg.lbl.Posrelativeto = Position relative to:
|
ShockCordCfg.lbl.Posrelativeto = Position relative to:
|
||||||
ShockCordCfg.lbl.plus = plus
|
ShockCordCfg.lbl.plus = plus
|
||||||
|
@ -11,17 +11,16 @@ import net.sf.openrocket.startup.Application;
|
|||||||
|
|
||||||
public class BulkheadConfig extends RingComponentConfig {
|
public class BulkheadConfig extends RingComponentConfig {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
public BulkheadConfig(RocketComponent c) {
|
public BulkheadConfig(RocketComponent c) {
|
||||||
super(c);
|
super(c);
|
||||||
|
|
||||||
JPanel tab;
|
JPanel tab;
|
||||||
|
|
||||||
//// Radius: and "Thickness:
|
tab = generalTab(trans.get("BulkheadCfg.tab.Diameter"), null, null,
|
||||||
tab = generalTab(trans.get("BulkheadCfg.tab.Radius"), null, null,
|
|
||||||
trans.get("BulkheadCfg.tab.Thickness"));
|
trans.get("BulkheadCfg.tab.Thickness"));
|
||||||
//// General and General properties
|
//// General and General properties
|
||||||
tabbedPane.insertTab(trans.get("BulkheadCfg.tab.General"), null, tab,
|
tabbedPane.insertTab(trans.get("BulkheadCfg.tab.General"), null, tab,
|
||||||
trans.get("BulkheadCfg.tab.Generalproperties"), 0);
|
trans.get("BulkheadCfg.tab.Generalproperties"), 0);
|
||||||
tabbedPane.setSelectedIndex(0);
|
tabbedPane.setSelectedIndex(0);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@ import javax.swing.JMenuBar;
|
|||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JSpinner;
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
@ -49,6 +51,7 @@ import javax.swing.KeyStroke;
|
|||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.BevelBorder;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.TreeSelectionEvent;
|
import javax.swing.event.TreeSelectionEvent;
|
||||||
import javax.swing.event.TreeSelectionListener;
|
import javax.swing.event.TreeSelectionListener;
|
||||||
@ -961,6 +964,28 @@ public class BasicFrame extends JFrame {
|
|||||||
menu.add(item);
|
menu.add(item);
|
||||||
|
|
||||||
|
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
|
|
||||||
|
item = new JMenuItem("Test popup");
|
||||||
|
item.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
log.user("Test popup selected");
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
panel.add(new JTextField(40));
|
||||||
|
panel.add(new JSpinner());
|
||||||
|
JPopupMenu popup = new JPopupMenu();
|
||||||
|
popup.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
|
||||||
|
popup.add(panel);
|
||||||
|
popup.show(BasicFrame.this, -50, 100);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ public class SimulationEditDialog extends JDialog {
|
|||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: NPE if FlightDataType has disappeared
|
||||||
|
|
||||||
public SimulationEditDialog(Window parent, Simulation s) {
|
public SimulationEditDialog(Window parent, Simulation s) {
|
||||||
this(parent, s, 0);
|
this(parent, s, 0);
|
||||||
}
|
}
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
package net.sf.openrocket.models.gravity;
|
|
||||||
|
|
||||||
import net.sf.openrocket.util.WorldCoordinate;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A gravity model based on the International Gravity Formula of 1967. The gravity
|
|
||||||
* value is computed when the object is constructed and later returned as a static
|
|
||||||
* value.
|
|
||||||
*
|
|
||||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class BasicGravityModel implements GravityModel {
|
|
||||||
|
|
||||||
private final double g;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct the static gravity model at the specific latitude (in degrees).
|
|
||||||
* @param latitude the latitude in degrees (-90 ... 90)
|
|
||||||
*/
|
|
||||||
public BasicGravityModel(double latitude) {
|
|
||||||
// TODO: HIGH: This model is wrong!! Increases monotonically from -90 to 90
|
|
||||||
double sin = Math.sin(latitude * Math.PI / 180);
|
|
||||||
double sin2 = Math.sin(2 * latitude * Math.PI / 180);
|
|
||||||
g = 9.780327 * (1 + 0.0053024 * sin - 0.0000058 * sin2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Override
|
|
||||||
public double getGravity(double altitude) {
|
|
||||||
return g;
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Override
|
|
||||||
public int getModID() {
|
|
||||||
// Return constant mod ID
|
|
||||||
return (int) (g * 1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getGravity(WorldCoordinate wc) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
package net.sf.openrocket.models.gravity;
|
package net.sf.openrocket.models.gravity;
|
||||||
|
|
||||||
//import net.sf.openrocket.util.Monitorable;
|
//import net.sf.openrocket.util.Monitorable;
|
||||||
|
import net.sf.openrocket.util.Monitorable;
|
||||||
import net.sf.openrocket.util.WorldCoordinate;
|
import net.sf.openrocket.util.WorldCoordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8,21 +9,12 @@ import net.sf.openrocket.util.WorldCoordinate;
|
|||||||
*
|
*
|
||||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||||
*/
|
*/
|
||||||
public interface GravityModel { //extends Monitorable {
|
public interface GravityModel extends Monitorable {
|
||||||
|
|
||||||
/**
|
|
||||||
* Compute the gravity at a specific altitude above equator.
|
|
||||||
*
|
|
||||||
* @param altitude the altitude at which to compute the gravity
|
|
||||||
* @return the gravitational acceleration
|
|
||||||
*/
|
|
||||||
//public double getGravity(double altitude);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the gravity at a given world coordinate
|
* Compute the gravity at a given world coordinate
|
||||||
* @param wc
|
* @param wc the world coordinate location
|
||||||
* @return gravitational acceleration in m/s/s
|
* @return gravitational acceleration in m/s/s
|
||||||
*/
|
*/
|
||||||
public double getGravity(WorldCoordinate wc);
|
public double getGravity(WorldCoordinate wc);
|
||||||
|
|
||||||
|
@ -8,12 +8,16 @@ import net.sf.openrocket.util.WorldCoordinate;
|
|||||||
*
|
*
|
||||||
* @author Richard Graham <richard@rdg.cc>
|
* @author Richard Graham <richard@rdg.cc>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class WGSGravityModel implements GravityModel {
|
public class WGSGravityModel implements GravityModel {
|
||||||
|
|
||||||
private WorldCoordinate lastWorldCoordinate;
|
private WorldCoordinate lastWorldCoordinate;
|
||||||
private double lastg;
|
private double lastg;
|
||||||
|
|
||||||
|
|
||||||
|
private static int hit = 0;
|
||||||
|
private static int miss = 0;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getGravity(WorldCoordinate wc) {
|
public double getGravity(WorldCoordinate wc) {
|
||||||
|
|
||||||
@ -21,12 +25,25 @@ public class WGSGravityModel implements GravityModel {
|
|||||||
if (wc != this.lastWorldCoordinate) {
|
if (wc != this.lastWorldCoordinate) {
|
||||||
this.lastg = calcGravity(wc);
|
this.lastg = calcGravity(wc);
|
||||||
this.lastWorldCoordinate = wc;
|
this.lastWorldCoordinate = wc;
|
||||||
|
|
||||||
|
miss++;
|
||||||
|
} else {
|
||||||
|
hit++;
|
||||||
}
|
}
|
||||||
|
System.out.println("GRAVITY MODEL: hit=" + hit + " miss=" + miss);
|
||||||
|
|
||||||
return this.lastg;
|
return this.lastg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getModID() {
|
||||||
|
// The model is immutable, so it can return a constant mod ID
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private double calcGravity(WorldCoordinate wc) {
|
private double calcGravity(WorldCoordinate wc) {
|
||||||
|
|
||||||
double sin2lat = MathUtil.pow2(Math.sin(wc.getLatitudeRad()));
|
double sin2lat = MathUtil.pow2(Math.sin(wc.getLatitudeRad()));
|
||||||
|
@ -6,7 +6,7 @@ import net.sf.openrocket.startup.Application;
|
|||||||
|
|
||||||
public class Bulkhead extends RadiusRingComponent {
|
public class Bulkhead extends RadiusRingComponent {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
public Bulkhead() {
|
public Bulkhead() {
|
||||||
setOuterRadiusAutomatic(true);
|
setOuterRadiusAutomatic(true);
|
||||||
setLength(0.002);
|
setLength(0.002);
|
||||||
|
@ -32,7 +32,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
|
|
||||||
private static final LogHelper log = Application.getLogger();
|
private static final LogHelper log = Application.getLogger();
|
||||||
|
|
||||||
// TODO: HIGH: Allow selecting steppers
|
// TODO: MEDIUM: Allow selecting steppers
|
||||||
private SimulationStepper flightStepper = new RK4SimulationStepper();
|
private SimulationStepper flightStepper = new RK4SimulationStepper();
|
||||||
private SimulationStepper landingStepper = new BasicLandingStepper();
|
private SimulationStepper landingStepper = new BasicLandingStepper();
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ public class BasicLandingStepper extends AbstractSimulationStepper {
|
|||||||
|
|
||||||
private static final double RECOVERY_TIME_STEP = 0.5;
|
private static final double RECOVERY_TIME_STEP = 0.5;
|
||||||
|
|
||||||
|
// FIXME: Add lat/lon code here as well
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SimulationStatus initialize(SimulationStatus status) throws SimulationException {
|
public SimulationStatus initialize(SimulationStatus status) throws SimulationException {
|
||||||
|
@ -516,7 +516,6 @@ public class SimulationOptions implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
conditions.setAtmosphericModel(getAtmosphericModel());
|
conditions.setAtmosphericModel(getAtmosphericModel());
|
||||||
|
|
||||||
//BasicGravityModel gravityModel = new BasicGravityModel(getLaunchLatitude());
|
|
||||||
GravityModel gravityModel = new WGSGravityModel();
|
GravityModel gravityModel = new WGSGravityModel();
|
||||||
|
|
||||||
conditions.setGravityModel(gravityModel);
|
conditions.setGravityModel(gravityModel);
|
||||||
|
@ -149,7 +149,7 @@ public class UnitGroup {
|
|||||||
UNITS_ANGLE = new UnitGroup();
|
UNITS_ANGLE = new UnitGroup();
|
||||||
UNITS_ANGLE.addUnit(new DegreeUnit());
|
UNITS_ANGLE.addUnit(new DegreeUnit());
|
||||||
UNITS_ANGLE.addUnit(new FixedPrecisionUnit("rad", 0.01));
|
UNITS_ANGLE.addUnit(new FixedPrecisionUnit("rad", 0.01));
|
||||||
UNITS_ANGLE.addUnit(new GeneralUnit(1.0/3437.74677078, "arcmin"));
|
UNITS_ANGLE.addUnit(new GeneralUnit(1.0 / 3437.74677078, "arcmin"));
|
||||||
|
|
||||||
UNITS_DENSITY_BULK = new UnitGroup();
|
UNITS_DENSITY_BULK = new UnitGroup();
|
||||||
UNITS_DENSITY_BULK.addUnit(new GeneralUnit(1000, "g/cm" + CUBED));
|
UNITS_DENSITY_BULK.addUnit(new GeneralUnit(1000, "g/cm" + CUBED));
|
||||||
@ -427,7 +427,7 @@ public class UnitGroup {
|
|||||||
return units.indexOf(u);
|
return units.indexOf(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addUnit(Unit u) {
|
public void addUnit(Unit u) {
|
||||||
units.add(u);
|
units.add(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class WorldCoordinate {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return ((int) (1000 * lat * lon * alt));
|
return ((int) (1000 * (lat + lon + alt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -384,6 +384,8 @@ div.downloadbox {
|
|||||||
rgb(55,156,14) 8%,
|
rgb(55,156,14) 8%,
|
||||||
rgb(102,221,17) 90%
|
rgb(102,221,17) 90%
|
||||||
);
|
);
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.downloadbox a.main {
|
div.downloadbox a.main {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><strong>OpenRocket</strong> is an free, fully featured model
|
<p><strong>OpenRocket</strong> is a free, fully featured model
|
||||||
rocket simulator that allows you to design and simulate your
|
rocket simulator that allows you to design and simulate your
|
||||||
rockets before actually building and flying them.</p>
|
rockets before actually building and flying them.</p>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user