public FromEuler ( double heading, double attitude, double bank ) : void | ||
heading | double | rotation about z axis |
attitude | double | rotation about y axis |
bank | double | rotation about x axis |
Результат | void |
public void FromEuler(double heading, double attitude, double bank)
{
double c1 = Math.Cos(heading / 2);
double s1 = Math.Sin(heading / 2);
double c2 = Math.Cos(attitude / 2);
double s2 = Math.Sin(attitude / 2);
double c3 = Math.Cos(bank / 2);
double s3 = Math.Sin(bank / 2);
double c1c2 = c1 * c2;
double s1s2 = s1 * s2;
Angle = (double)(c1c2 * c3 + s1s2 * s3);
X = (double)(c1c2 * s3 - s1s2 * c3);
Y = (double)(c1 * s2 * c3 + s1 * c2 * s3);
Z = (double)(s1 * c2 * c3 - c1 * s2 * s3);
toAxisAngle();
}
void RotateZ(double angle) { Fractrace.Geometry.VecRotation rotation = new VecRotation(); rotation.FromEuler(Math.PI * ParameterDict.Current.GetDouble("Transformation.Camera.AngleX") / 180.0, Math.PI * ParameterDict.Current.GetDouble("Transformation.Camera.AngleY") / 180.0, Math.PI * ParameterDict.Current.GetDouble("Transformation.Camera.AngleZ") / 180.0); rotation.Normalize(); rotation.combine(0, 0, angle); double ax = 0, ay = 0, az = 0; rotation.toEuler(ref ax, ref ay, ref az); ax = 180 * ax / Math.PI; ay = 180 * ay / Math.PI; az = 180 * az / Math.PI; ParameterDict.Current.SetDouble("Transformation.Camera.AngleX", ax); ParameterDict.Current.SetDouble("Transformation.Camera.AngleY", ay); ParameterDict.Current.SetDouble("Transformation.Camera.AngleZ", az); }