Jump to content

Orbital elements: Difference between revisions

m
m (→‎{{header|J}}: put that comma where it was originally supposed to be)
Line 752:
NB. Om: Longitude of the ascending node
NB. w: argument of Periapsis (the other "omega")
NB. f: true anomaly (varies with time)
L=. a*2:`]@.*1-*:e
'c s'=. 2{.,F=. 2 R f
Line 762:
position,:speed
}}</lang>
 
The true anomaly, argument of Periapsis, Longitude of the ascending node and inclination are all angles. And we use the dot product of their rotation matrices (in that order) to find the orientation of the orbit and the object's position in that orbit. Here, <code>R</code> finds the rotation matrix for a given angle around a given axis. Here's an example of what R gives us for a sixty degree angle:
 
<lang J> 0 1 2 R&.> 60r180p1 NB. rotate around first, second or third axis
┌────────────────────┬────────────────────┬────────────────────┐
│1 0 0│ 0.5 0 _0.866025│ 0.5 0.866025 0│
│0 0.5 0.866025│ 0 1 0│_0.866025 0.5 0│
│0 _0.866025 0.5│0.866025 0 0.5│ 0 0 1│
└────────────────────┴────────────────────┴────────────────────┘</lang>
 
Task example:<lang J> orbitalStateVectors 1 0.1 0 355r678 0 0
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.