Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rotation"></param>
        /// <returns></returns>
        public void Set(AxisAngle3d rotation)
        {
            var    axis = rotation.Axis;
            var    cos  = rotation.CosAngle;
            var    sin  = rotation.SinAngle;
            double t    = 1.0 - cos;

            _x.X = cos + axis.X * axis.X * t;
            _y.Y = cos + axis.Y * axis.Y * t;
            _z.Z = cos + axis.Z * axis.Z * t;

            double p0 = axis.X * axis.Y * t;
            double p1 = axis.Z * sin;

            _x.Y = p0 + p1;
            _y.X = p0 - p1;

            p0 = axis.X * axis.Z * t;
            p1 = axis.Y * sin;

            _x.Z = p0 - p1;
            _z.X = p0 + p1;

            p0 = axis.Y * axis.Z * t;
            p1 = axis.X * sin;

            _y.Z = p0 + p1;
            _z.Y = p0 - p1;
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rotation"></param>
        /// <returns></returns>
        public bool Set(ref AxisAngle3d rotation)
        {
            if (!rotation.IsValid)
            {
                return(false);
            }

            var axis     = rotation.Axis;
            var cosAngle = rotation.CosAngle;
            var sinAngle = rotation.SinAngle;

            var t = 1.0 - cosAngle;

            _x.X = cosAngle + axis.X * axis.X * t;
            _y.Y = cosAngle + axis.Y * axis.Y * t;
            _z.Z = cosAngle + axis.Z * axis.Z * t;

            var c = axis.X * axis.Y * t;
            var s = axis.Z * sinAngle;

            _x.Y = c + s;
            _y.X = c - s;

            c = axis.X * axis.Z * t;
            s = axis.Y * sinAngle;

            _x.Z = c - s;
            _z.X = c + s;

            c = axis.Y * axis.Z * t;
            s = axis.X * sinAngle;

            _y.Z = c + s;
            _z.Y = c - s;

            return(true);
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="rotation"></param>
 public void Set(ref AxisAngle3d rotation)
 {
     SetImpl(rotation.Axis, rotation.Angle);
 }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="rotation"></param>
 public Quaterniond(AxisAngle3d rotation)
     : this()
 {
     Set(ref rotation);
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 public Rotation3d(AxisAngle3d rotation)
     : this()
 {
     Set(rotation);
 }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <param name="tolerance"></param>
 /// <returns></returns>
 public bool ApproxEquals(ref AxisAngle3d other, double tolerance = zMath.ZeroTolerance)
 {
     return
         (zMath.ApproxEquals(_angle, other._angle, tolerance) &&
          _axis.ApproxEquals(other._axis, tolerance));
 }
Пример #7
0
 /// <summary>
 /// Applies the given rotation to the axis of this rotation.
 /// </summary>
 /// <param name="rotation"></param>
 public void RotateAxis(ref AxisAngle3d rotation)
 {
     _axis = rotation.Apply(_axis);
 }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="rotation"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 public static Orient3d CreateRotationAboutPoint(AxisAngle3d rotation, Vec3d point)
 {
     throw new NotImplementedException();
 }
Пример #9
0
 /// <summary>
 /// Applies the given rotation to this object.
 /// </summary>
 /// <param name="rotation"></param>
 public void Rotate(ref AxisAngle3d rotation)
 {
     SetXY(rotation.Apply(_x), rotation.Apply(_y));
 }
Пример #10
0
 /// <summary>
 ///
 /// </summary>
 public OrthoBasis3d(AxisAngle3d rotation)
     : this()
 {
     Set(ref rotation);
 }