#ifndef HLALocation_hxx
#define HLALocation_hxx
+#include <simgear/math/SGMath.hxx>
#include "HLABasicDataElement.hxx"
#include "HLATypes.hxx"
public:
virtual ~HLAAbstractLocation() {}
+ virtual SGLocationd getLocation() const = 0;
+ virtual void setLocation(const SGLocationd&) = 0;
+
virtual SGVec3d getCartPosition() const = 0;
virtual void setCartPosition(const SGVec3d&) = 0;
virtual void setCartOrientation(const SGQuatd&) = 0;
virtual SGVec3d getAngularBodyVelocity() const = 0;
- virtual void setAngularBodyVelocity(const SGVec3d& angular) = 0;
+ virtual void setAngularBodyVelocity(const SGVec3d&) = 0;
virtual SGVec3d getLinearBodyVelocity() const = 0;
- virtual void setLinearBodyVelocity(const SGVec3d& linear) = 0;
+ virtual void setLinearBodyVelocity(const SGVec3d&) = 0;
+
+ virtual double getTimeDifference(const SGTimeStamp&) const
+ { return 0; }
+
+ // Get the position and orientation extrapolated to the given time stamp.
+ SGLocationd getLocation(const SGTimeStamp& timeStamp) const
+ {
+ SGLocationd location = getLocation();
+ location.eulerStepBodyVelocities(getTimeDifference(timeStamp), getLinearBodyVelocity(), getAngularBodyVelocity());
+ return location;
+ }
};
class HLACartesianLocation : public HLAAbstractLocation {
_linearVelocity(SGVec3d::zeros())
{ }
+ virtual SGLocationd getLocation() const
+ { return SGLocationd(_position, SGQuatd::fromPositiveRealImag(_imag)); }
+ virtual void setLocation(const SGLocationd& location)
+ {
+ _position = location.getPosition();
+ _imag = location.getOrientation().getPositiveRealImag();
+ }
+
virtual SGVec3d getCartPosition() const
{ return _position; }
virtual void setCartPosition(const SGVec3d& position)
updateCartesianFromGeodetic();
}
+ virtual SGLocationd getLocation() const
+ {
+ updateCartesianFromGeodetic();
+ return SGLocationd(_cartPosition, _cartOrientation);
+ }
+ virtual void setLocation(const SGLocationd& location)
+ {
+ _cartPosition = location.getPosition();
+ _cartOrientation = location.getOrientation();
+ _dirty = true;
+ }
+
virtual SGVec3d getCartPosition() const
{ updateCartesianFromGeodetic(); return _cartPosition; }
virtual void setCartPosition(const SGVec3d& position)