Nasal library/geo: Difference between revisions

Jump to navigation Jump to search
Save
No edit summary
(Save)
Line 8: Line 8:
|mode = class
|mode = class
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = The main class, used widely for storing and managing positional data.
|text = The main class, used widely for storing and managing positional data. Coordinates may be stored in either {{wikipedia|ECEF|Earth-centered, Earth-fixed}} coordinates (x, y and z) or {{wikipedia|geodetic coordinates}} (latitude, longitude, and altitude). In addition, it will convert coordinates as necessary. However, note that for the conversion to work, set_latlon() and set_xyz() must be used.
}}
}}
==== new() ====
==== new() ====
Line 18: Line 18:
|param1text = An optional <code>geo.Coord</code> instance. If given, the returned instance will contain the values from this argument.
|param1text = An optional <code>geo.Coord</code> instance. If given, the returned instance will contain the values from this argument.
|example1 = var coord = geo.Coord.new();
|example1 = var coord = geo.Coord.new();
coord.dump();
|example2 = var ac_pos = geo.aircraft_position();
|example2 = var ac_pos = geo.aircraft_position();
var coord = geo.Coord.new(ac_pos);
var coord = geo.Coord.new(ac_pos);
Line 41: Line 40:
|text = Sets the {{wikipedia|latitude}} coordinate. Returns the <code>geo.Coord</code> instance.
|text = Sets the {{wikipedia|latitude}} coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = lat
|param1 = lat
|param1text = The latitude coordinate.
|param1text = The latitude coordinate, in degrees.
|example1 = var coord = geo.Coord.new();
|example1 = var coord = geo.Coord.new();
coord.set_latlon(0,0,0);
coord.set_lat(45);
coord.set_lat(45);
coord.dump();
coord.dump();
Line 52: Line 52:
|text = Sets the {{wikipedia|longitude}} coordinate. Returns the <code>geo.Coord</code> instance.
|text = Sets the {{wikipedia|longitude}} coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = lon
|param1 = lon
|param1text = The longitude coordinate.
|param1text = The longitude coordinate, in degrees.
|example1 = var coord = geo.Coord.new();
|example1 = var coord = geo.Coord.new();
coord.set_latlon(0,0,0);
coord.set_lon(90);
coord.set_lon(90);
coord.dump();
coord.dump();
Line 63: Line 64:
|text = Sets the {{wikipedia|altitude}} coordinate. Returns the <code>geo.Coord</code> instance.
|text = Sets the {{wikipedia|altitude}} coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = alt
|param1 = alt
|param1text = The altitude coordinate. Note that this can be in either feet or metres, so make sure you convert correctly.
|param1text = The altitude coordinate. Note that this can be in either feet or metres, so make sure you convert correctly. Also note that in conversion, this coordinate will be assumed to be metres above equatorial radius of earth used is that defined by the {{wikipedia|WGS 84}} (6,378,137 metres).
|example1 = var coord = geo.Coord.new();
|example1 = var coord = geo.Coord.new();
coord.set_latlon(0,0,0);
coord.set_alt(1000);
coord.set_alt(1000);
coord.dump();
coord.dump();
Line 74: Line 76:
|text = Sets the latitude and longitude coordinates, and optionally the altitude coordinate. Returns the <code>geo.Coord</code> instance.
|text = Sets the latitude and longitude coordinates, and optionally the altitude coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = lat
|param1 = lat
|param1text = The latitude coordinate.
|param1text = The latitude coordinate, in degrees.
|param2 = lon
|param2 = lon
|param2text = The longitude coordinate.
|param2text = The longitude coordinate, in degrees.
|param3 = alt
|param3 = alt
|param3text = The altitude coordinate. Note that this can be in either feet or metres, so make sure you convert correctly. Defaults to 0.
|param3text = The altitude coordinate. Note that this can be in either feet or metres, so make sure you convert correctly. Also note that in conversion, this coordinate will be assumed to be metres above equatorial radius of earth used is that defined by the {{wikipedia|WGS 84}} (6,378,137 metres). Defaults to 0.
|example1 = var coord = geo.Coord.new();
|example1 = var coord = geo.Coord.new();
coord.set_latlon(45, 90);
coord.dump();
|example2 = var coord = geo.Coord.new();
coord.set_latlon(45, 90, 1000);
coord.set_latlon(45, 90, 1000);
coord.dump();
}}
==== set_x() ====
{{Nasal doc
|syntax = geo.Coord.set_x(x);
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Sets the x-axis coordinate coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = x
|param1text = The mandatory x-axis coordinate, in metres.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(0,0,0);
coord.set_x(10);
coord.dump();
}}
==== set_y() ====
{{Nasal doc
|syntax = geo.Coord.set_y(y);
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Sets the y-axis coordinate coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = y
|param1text = The mandatory y-axis coordinate, in metres.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(0,0,0);
coord.set_y(10);
coord.dump();
}}
==== set_z() ====
{{Nasal doc
|syntax = geo.Coord.set_z(z);
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Sets the y-axis coordinate coordinate. Returns the <code>geo.Coord</code> instance.
|param1 = z
|param1text = The mandatory z-axis coordinate, in metres.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(0,0,0);
coord.set_y(10);
coord.dump();
}}
==== set_xyz() ====
{{Nasal doc
|syntax = geo.Coord.set_xyz(x, y, z);
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Sets all three Cartesian coordinates. Returns the <code>geo.Coord</code> instance. All arguments are mandatory.
|param1 = x
|param1text = The x-axis coordinate, in metres.
|param2 = y
|param2text = The y-axis coordinate, in metres.
|param3 = z
|param3text = The z-axis coordinate, in metres.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(10, 10, 10);
coord.dump();
coord.dump();
}}
}}

Navigation menu