MCPcopy Create free account
hub / github.com/carbonengine/trinity / BuildOrbitPlaneBasisPython

Function BuildOrbitPlaneBasisPython

trinity/Eve/UI/EveEllipseSet.cpp:27–48  ·  view source on GitHub ↗

Same construction as frontier.hud.system_view.scene_new.util._get_orbit_rotation_from_axes: basis_u = normalize(n x ref), basis_v = normalize(basis_u x n). Rotation degrees are atan2(maj·v, maj·u) in that frame.

Source from the content-addressed store, hash-verified

25// Same construction as frontier.hud.system_view.scene_new.util._get_orbit_rotation_from_axes:
26// basis_u = normalize(n x ref), basis_v = normalize(basis_u x n). Rotation degrees are atan2(maj·v, maj·u) in that frame.
27void BuildOrbitPlaneBasisPython( const Vector3& planeNormal, Vector3& basisU, Vector3& basisV, Vector3& n )
28{
29 n = Normalize( planeNormal );
30 Vector3 ref( 0.f, 1.f, 0.f );
31 basisU = Cross( n, ref );
32 float lenSq = Dot( basisU, basisU );
33 if( lenSq < 1e-3f )
34 {
35 const Vector3 ax0( 1.f, 0.f, 0.f );
36 const Vector3 ax1( 0.f, 0.f, 1.f );
37 const float d0 = std::fabs( Dot( n, ax0 ) );
38 const float d1 = std::fabs( Dot( n, ax1 ) );
39 ref = ( d0 < d1 ) ? ax0 : ax1;
40 basisU = Cross( n, ref );
41 lenSq = Dot( basisU, basisU );
42 }
43 CCP_ASSERT( lenSq > 0.f );
44 basisU = basisU / std::sqrt( lenSq );
45 basisV = Cross( basisU, n );
46 const float lv = Length( basisV );
47 basisV = basisV / lv;
48}
49
50// Major along U, minor along V; rotationDegrees matches Python atan2(maj·basis_v, maj·basis_u).
51void BuildOrbitEllipseAxes( const EveEllipseDefinition& spec, Vector3& outU, Vector3& outV )

Callers 1

BuildOrbitEllipseAxesFunction · 0.85

Calls 3

CrossFunction · 0.85
LengthFunction · 0.85
DotFunction · 0.50

Tested by

no test coverage detected