예제 #1
0
        public void TestFunctionAcos()
        {
            mockSparkContextProxy.Setup(m => m.CreateFunction(It.IsAny <string>(), It.IsAny <IColumnProxy>()));
            Column column = GeneratorColum();

            Functions.Acos(column);
            mockSparkContextProxy.Verify(m => m.CreateFunction("acos", column.ColumnProxy), Times.Once);
        }
예제 #2
0
        /// <summary>
        /// Return the axis angle representation of a unit quaternion.
        /// </summary>
        /// <param name="value">A unit quaternion.</param>
        /// <returns>The axis angle of a quaternion.</returns>
        public static Tuple <Vector3f, float> AxisAngle(Quaternionf value)
        {
            var s = Functions.Sqrt(1 - value.A - value.A);

            return(Tuple.Create(
                       new Vector3f(value.B / s, value.C / s, value.D / s),
                       2 * Functions.Acos(value.A)));
        }
예제 #3
0
파일: Point3f.cs 프로젝트: bonomali/Ibasa
        /// <summary>
        /// Transforms a point in cartesian coordinates to spherical coordinates.
        /// </summary>
        /// <param name="value">The point to transform.</param>
        /// <returns>The spherical coordinates of value.</returns>
        public static SphericalCoordinate CartesianToSpherical(Point3f value)
        {
            double r     = Functions.Sqrt(value.X * value.X + value.Y * value.Y + value.Z * value.Z);
            double theta = Functions.Atan2(value.Y, value.X);

            if (theta < 0)
            {
                theta += 2 * Constants.Pi;
            }
            return(new SphericalCoordinate(
                       r,
                       (double)Functions.Acos(value.Z / r),
                       theta));
        }
예제 #4
0
        /// <summary>
        /// Interpolates between two unit quaternions, using spherical linear interpolation.
        /// </summary>
        /// <param name="start">Start quaternion.</param>
        /// <param name="end">End quaternion.</param>
        /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
        /// <returns>The spherical linear interpolation of the two quaternions.</returns>
        ///  <remarks>
        /// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned.
        /// </remarks>
        public static Quaternionf Slerp(Quaternionf start, Quaternionf end, float amount)
        {
            var cosTheta = Dot(start, end);

            //Cannot use slerp, use lerp instead
            if (Functions.Abs(cosTheta) - 1 < float.Epsilon)
            {
                return(Lerp(start, end, amount));
            }
            var theta    = Functions.Acos(cosTheta);
            var sinTheta = Functions.Sin(theta);
            var t0       = Functions.Sin((1 - amount) * theta) / sinTheta;
            var t1       = Functions.Sin(amount * theta) / sinTheta;

            return(t0 * start + t1 * end);
        }