Within Celestia, there's already the "online" possibility, to obtain the observers longitude, latitude and distance with respect to a target object (except for the Sun), by the Navigation - Goto object ... dropdown menu.
But within CELX scripting there is no equivalent observer method yet, to obtain the actual longitude and latitude with respect to a specified target object.
It should be nice if this new CELX method could also be implemeted within future Celestia releases.
Other ideas for new CELX methods are equivalents for the following new v160 CEL commands, which are still missing within CELX scripting:
- EXIT (not my favorite )
- RENDERPATH (celestia:getrenderpath() and celestia:setrenderpath() respectively)
Marco
Script method request: observer:getlonglat() method
-
Topic authorMarco Klunder
- Posts: 181
- Joined: 20.02.2008
- Age: 62
- With us: 16 years 9 months
- Location: The Netherlands
Script method request: observer:getlonglat() method
Marco Klunder
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
-
Topic authorMarco Klunder
- Posts: 181
- Joined: 20.02.2008
- Age: 62
- With us: 16 years 9 months
- Location: The Netherlands
Re: Script method request: observer:getlonglat() method
I just received an update regarding this request from Vincent Giangiulio last weekend, and here's the CELX scripting code I was looking for to obtain the longitude and latitude coordinates for the observer on an object:
Vincent Thx
Code: Select all
-- Return longitude and latitude for the observer on the source object
get_long_lat = function (obs, source)
f = source:getinfo().oblateness
if f == nil then f = 0 end;
u_pos = obs:getposition()
e_frame = celestia:newframe("bodyfixed", source)
e_pos = e_frame:to(u_pos)
local lambda = -math.atan2(e_pos.z, e_pos.x);
local beta = math.pi / 2 - math.atan2(math.sqrt(e_pos.x * e_pos.x + e_pos.z * e_pos.z), e_pos.y)
local phi = math.atan2(math.tan(beta), (1 - f));
long = math.deg(lambda)
lat = math.deg(phi)
return long, lat
end
while true do
local obs = celestia:getobserver();
local refObj = obs:getframe():getrefobject();
if (refObj) then
if refObj:type() == "location" or refObj:type() == "spacecraft" then
refObj = refObj:getinfo().parent;
end
long, lat = get_long_lat(obs, refObj);
end
celestia:flash("Longitude: "..long.."\nLatitude: "..lat)
wait(0)
end
Vincent Thx
Marco Klunder
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621
Re: Script method request: observer:getlonglat() method
Over the hills and far away for those about to rock we salute you.
Never at rest.
Massimo
Massimo