Eegeo::v3 ComputeHeadingVector(Eegeo::dv3 interestPosition, float heading) { Eegeo::v3 m_heading(0,1,0); Eegeo::dv3 interestEcefUp = interestPosition.Norm(); Eegeo::v3 m_interestUp = Eegeo::v3(interestEcefUp.GetX(), interestEcefUp.GetY(), interestEcefUp.GetZ()); Eegeo::v3 m_interestRight = Eegeo::v3::Cross(m_interestUp, m_heading); m_interestRight = m_interestRight.Norm(); m_heading = Eegeo::v3::Cross(m_interestRight, m_interestUp); m_heading = m_heading.Norm(); Eegeo::Quaternion headingRot; headingRot.Set(m_interestUp, heading); m_heading = headingRot.RotatePoint(m_heading); return m_heading; }
Eegeo::v3 ComputeHeadingVector(Eegeo::dv3 interestPosition, float heading) { Eegeo::v3 interestForward(0,1,0); Eegeo::dv3 interestEcefUp = interestPosition.Norm(); Eegeo::v3 interestUp = interestEcefUp.ToSingle(); Eegeo::v3 interestRight = Eegeo::v3::Cross(interestUp, interestForward); interestRight = interestRight.Norm(); interestForward = Eegeo::v3::Cross(interestRight, interestUp); interestForward = interestForward.Norm(); Eegeo::Quaternion rotation; rotation.Set(interestUp, heading); interestForward = rotation.RotatePoint(interestForward); return interestForward; }