MCPcopy Create free account
hub / github.com/CelestiaProject/Celestia / direction

Method direction

src/celengine/frame.cpp:758–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

756
757
758Vec3d
759FrameVector::direction(double tjd) const
760{
761 Vec3d v;
762
763 switch (vecType)
764 {
765 case RelativePosition:
766 v = target.getPosition(tjd) - observer.getPosition(tjd);
767 break;
768
769 case RelativeVelocity:
770 {
771 Vec3d v0 = observer.getVelocity(tjd);
772 Vec3d v1 = target.getVelocity(tjd);
773 v = v1 - v0;
774 }
775 break;
776
777 case ConstantVector:
778 if (frame == NULL)
779 v = vec;
780 else
781 v = vec * frame->getOrientation(tjd).toMatrix3();
782 break;
783
784 default:
785 // unhandled vector type
786 v = Vec3d(0.0, 0.0, 0.0);
787 break;
788 }
789
790 return v;
791}
792
793
794unsigned int

Callers 1

computeOrientationMethod · 0.80

Calls 5

Vec3dClass · 0.85
toMatrix3Method · 0.80
getPositionMethod · 0.45
getVelocityMethod · 0.45
getOrientationMethod · 0.45

Tested by

no test coverage detected