Exemplo n.º 1
0
        public override void SetPosition(double lat, double lon, double heading, double _altitude, double tilt, double bank)
        {
            if (double.IsNaN(lat))
            {
                lat = this._latitude.Degrees;
            }
            if (double.IsNaN(lon))
            {
                lon = this._longitude.Degrees;
            }
            if (double.IsNaN(heading))
            {
                heading = this._heading.Degrees;
            }
            if (double.IsNaN(bank))
            {
                bank = this._targetBank.Degrees;
            }

            this._targetOrientation = Quaternion4d.EulerToQuaternion(
                MathEngine.DegreesToRadians(lon),
                MathEngine.DegreesToRadians(lat),
                MathEngine.DegreesToRadians(heading));

            Point3d v = Quaternion4d.QuaternionToEuler(this._targetOrientation);


            this._targetLatitude.Radians  = v.Y;
            this._targetLongitude.Radians = v.X;
            this._targetHeading.Radians   = v.Z;

            if (!double.IsNaN(tilt))
            {
                this.Tilt = Angle.FromDegrees(tilt);
            }
            if (!double.IsNaN(_altitude))
            {
                this.Altitude = _altitude;
            }
            this.Bank = Angle.FromDegrees(bank);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Pan the camera using delta values
        /// </summary>
        /// <param name="lat">Latitude offset</param>
        /// <param name="lon">Longitude offset</param>
        public virtual void Pan(Angle lat, Angle lon)
        {
            if (Angle.IsNaN(lat))
            {
                lat = this._latitude;                              // should be zero (PM 2007-05)
            }
            if (Angle.IsNaN(lon))
            {
                lon = this._longitude;
            }
            lat += this._latitude;
            lon += this._longitude;

            //	this._orientation = MathEngine.EulerToQuaternion(
            //		lon.Radians,
            //		lat.Radians,
            //		_heading.Radians);

            this.m_Orientation = Quaternion4d.EulerToQuaternion(
                lon.Radians, lat.Radians, this._heading.Radians);

            Point3d p = Quaternion4d.QuaternionToEuler(this.m_Orientation);

            //	Vector3 v = MathEngine.QuaternionToEuler(this._orientation);
            //	if(!double.IsNaN(v.Y))
            //	{
            //		this._latitude.Radians = v.Y;
            //		this._longitude.Radians = v.X;
            //	}

            if (!double.IsNaN(p.Y))
            {
                this._latitude.Radians  = p.Y;
                this._longitude.Radians = p.X;
            }
        }
Exemplo n.º 3
0
        public override void RotationYawPitchRoll(Angle yaw, Angle pitch, Angle roll)
        {
            if (World.Settings.cameraHasMomentum)
            {
                this._latitudeMomentum  += pitch / 100;
                this._longitudeMomentum += yaw / 100;
                this._headingMomentum   += roll / 100;
            }

            this._targetOrientation = Quaternion4d.EulerToQuaternion(yaw.Radians, pitch.Radians, roll.Radians) * this._targetOrientation;
            Point3d v = Quaternion4d.QuaternionToEuler(this._targetOrientation);

            if (!double.IsNaN(v.Y))
            {
                this._targetLatitude.Radians  = v.Y;
                this._targetLongitude.Radians = v.X;
                if (!World.Settings.cameraTwistLock)
                {
                    this._targetHeading.Radians = v.Z;
                }
            }

            base.RotationYawPitchRoll(yaw, pitch, roll);
        }