コード例 #1
0
ファイル: Tool.cs プロジェクト: azykise/olawork
        public void fromOrth(Vector3F p)
        {
            radius = p.GetLength();

            float ga = (float)Math.Atan(p.Y / p.X);
            degreeY = Tool.Rad2Deg(ga);

            float th = (float)Math.Acos(p.Z / radius);
            degreeZ = Tool.Rad2Deg(th);
        }
コード例 #2
0
ファイル: Tool.cs プロジェクト: azykise/olawork
        public Vector3F orthPosition()
        {
            float th = Tool.Deg2Rad(degreeZ);
            float ga = Tool.Deg2Rad(degreeY);

            Vector3F p = new Vector3F();

            p.Y = MathFunctions.Sin(th) * radius;
            p.Y *= MathFunctions.Cos(ga);

            p.X = MathFunctions.Sin(th) * radius;
            p.X *= MathFunctions.Sin(ga);

            p.Z = MathFunctions.Cos(th) * radius;

            return p;
        }
コード例 #3
0
ファイル: Segment.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Initializes a new instance of the <see cref="Segment"/> class using an existing <see cref="Segment"/> instance.
		/// </summary>
		/// <param name="segment">A <see cref="Segment"/> instance.</param>
		public Segment(Segment segment)
		{
			_p0 = segment.P0;
			_p1 = segment.P1;
		}
コード例 #4
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> containing the result.</returns>
 public static Vector3F operator *(float s, Vector3F v)
 {
     return(Vector3F.Multiply(v, s));
 }
コード例 #5
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Adds a vector and a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the sum.</returns>
 public static Vector3F operator +(float s, Vector3F v)
 {
     return(Vector3F.Add(v, s));
 }
コード例 #6
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Tests whether two vectors are approximately equal using default tolerance value.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <returns>True if the two vectors are approximately equal; otherwise, False.</returns>
 public static bool ApproxEqual(Vector3F v, Vector3F u)
 {
     return(ApproxEqual(v, u, MathFunctions.EpsilonF));
 }
コード例 #7
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Multiplies a vector by a scalar and put the result in another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance to hold the result.</param>
 public static void Multiply(Vector3F u, float s, Vector3F v)
 {
     v.X = u.X * s;
     v.Y = u.Y * s;
     v.Z = u.Z * s;
 }
コード例 #8
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a vector by another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="w">A <see cref="Vector3F"/> instance to hold the result.</param>
 /// <remarks>
 /// w[i] = u[i] / v[i]
 /// </remarks>
 public static void Divide(Vector3F u, Vector3F v, Vector3F w)
 {
     w.X = u.X / v.X;
     w.Y = u.Y / v.Y;
     w.Z = u.Z / v.Z;
 }
コード例 #9
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a scalar and put the result into another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = vector[i] - scalar
		/// </remarks>
		public static void Subtract(Vector3F vector, float scalar, ref Vector3F result)
		{
			result.X = vector.X - scalar;
			result.Y = vector.Y - scalar;
			result.Z = vector.Z - scalar;
		}
コード例 #10
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a second vector and puts the result into a third vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		/// <remarks>
		///	result[i] = left[i] - right[i].
		/// </remarks>
		public static void Subtract(Vector3F left, Vector3F right, ref Vector3F result)
		{
			result.X = left.X - right.X;
			result.Y = left.Y - right.Y;
			result.Z = left.Z - right.Z;
		}
コード例 #11
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
		/// <remarks>
		/// result[i] = scalar - vector[i]
		/// </remarks>
		public static Vector3F Subtract(float scalar, Vector3F vector)
		{
			return new Vector3F(scalar - vector.X, scalar - vector.Y, scalar - vector.Z);
		}
コード例 #12
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a scalar from a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
		/// <remarks>
		/// result[i] = vector[i] - scalar
		/// </remarks>
		public static Vector3F Subtract(Vector3F vector, float scalar)
		{
			return new Vector3F(vector.X - scalar, vector.Y - scalar, vector.Z - scalar);
		}
コード例 #13
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
		/// <remarks>
		///	result[i] = left[i] - right[i].
		/// </remarks>
		public static Vector3F Subtract(Vector3F left, Vector3F right)
		{
			return new Vector3F(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
		}
コード例 #14
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Adds a vector and a scalar and put the result into another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		public static void Add(Vector3F vector, float scalar, ref Vector3F result)
		{
			result.X = vector.X + scalar;
			result.Y = vector.Y + scalar;
			result.Z = vector.Z + scalar;
		}
コード例 #15
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Adds two vectors and put the result in the third vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		public static void Add(Vector3F left, Vector3F right, ref Vector3F result)
		{
			result.X = left.X + right.X;
			result.Y = left.Y + right.Y;
			result.Z = left.Z + right.Z;
		}
コード例 #16
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a scalar from a vector and put the result into another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = s - u[i]
 /// </remarks>
 public static void Subtract(float s, Vector3F u, Vector3F v)
 {
     v.X = s - u.X;
     v.Y = s - u.Y;
     v.Z = s - u.Z;
 }
コード例 #17
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = v[i] / s;
 /// </remarks>
 public static Vector3F Divide(Vector3F v, float s)
 {
     return(new Vector3F(v.X / s, v.Y / s, v.Z / s));
 }
コード例 #18
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a scalar from a vector and put the result into another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = scalar - vector[i]
		/// </remarks>
		public static void Subtract(float scalar, Vector3F vector, ref Vector3F result)
		{
			result.X = scalar - vector.X;
			result.Y = scalar - vector.Y;
			result.Z = scalar - vector.Z;
		}
コード例 #19
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <param name="v">A <see cref="Vector3F"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = s / u[i]
 /// </remarks>
 public static void Divide(float s, Vector3F u, Vector3F v)
 {
     v.X = s / u.X;
     v.Y = s / u.Y;
     v.Z = s / u.Z;
 }
コード例 #20
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by another vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
		/// <remarks>
		///	result[i] = left[i] / right[i].
		/// </remarks>
		public static Vector3F Divide(Vector3F left, Vector3F right)
		{
			return new Vector3F(left.X / right.X, left.Y / right.Y, left.Z / right.Z);
		}
コード例 #21
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Calculates the cross product of two vectors.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="w">A <see cref="Vector3F"/> instance to hold the cross product result.</param>
 public static void CrossProduct(Vector3F u, Vector3F v, Vector3F w)
 {
     w.X = u.Y * v.Z - u.Z * v.Y;
     w.Y = u.Z * v.X - u.X * v.Z;
     w.Z = u.X * v.Y - u.Y * v.X;
 }
コード例 #22
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
		/// <remarks>
		/// result[i] = vector[i] / scalar;
		/// </remarks>
		public static Vector3F Divide(Vector3F vector, float scalar)
		{
			return new Vector3F(vector.X / scalar, vector.Y / scalar, vector.Z / scalar);
		}
コード例 #23
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Initializes a new instance of the <see cref="Vector3F"/> class using coordinates from a given <see cref="Vector3F"/> instance.
 /// </summary>
 /// <param name="vector">A <see cref="Vector3F"/> to get the coordinates from.</param>
 public Vector3F(Vector3F vector)
 {
     _x = vector.X;
     _y = vector.Y;
     _z = vector.Z;
 }
コード例 #24
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a scalar by a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
		/// <remarks>
		/// result[i] = scalar / vector[i]
		/// </remarks>
		public static Vector3F Divide(float scalar, Vector3F vector)
		{
			return new Vector3F(scalar / vector.X, scalar / vector.Y, scalar / vector.Z);
		}
コード例 #25
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = v[i] - s
 /// </remarks>
 public static Vector3F operator -(Vector3F v, float s)
 {
     return(Vector3F.Subtract(v, s));
 }
コード例 #26
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by another vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = left[i] / right[i]
		/// </remarks>
		public static void Divide(Vector3F left, Vector3F right, ref Vector3F result)
		{
			result.X = left.X / right.X;
			result.Y = left.Y / right.Y;
			result.Z = left.Z / right.Z;
		}
コード例 #27
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = s / v[i]
 /// </remarks>
 public static Vector3F operator /(float s, Vector3F v)
 {
     return(Vector3F.Divide(s, v));
 }
コード例 #28
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = vector[i] / scalar
		/// </remarks>
		public static void Divide(Vector3F vector, float scalar, ref Vector3F result)
		{
			result.X = vector.X / scalar;
			result.Y = vector.Y / scalar;
			result.Z = vector.Z / scalar;
		}
コード例 #29
0
ファイル: Matrix3F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Transforms a given vector by a matrix and put the result in a vector.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix3F"/> instance.</param>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		public static void Transform(Matrix3F matrix, Vector3F vector, ref Vector3F result)
		{
			result.X = (matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z);
			result.Y = (matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z);
			result.Z = (matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z);
		}
コード例 #30
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a scalar by a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = scalar / vector[i]
		/// </remarks>
		public static void Divide(float scalar, Vector3F vector, ref Vector3F result)
		{
			result.X = scalar / vector.X;
			result.Y = scalar / vector.Y;
			result.Z = scalar / vector.Z;
		}
コード例 #31
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a vector from a scalar and put the result into another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = u[i] - s
 /// </remarks>
 public static void Subtract(Vector3F u, float s, Vector3F v)
 {
     v.X = u.X - s;
     v.Y = u.Y - s;
     v.Z = u.Z - s;
 }
コード例 #32
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Multiplies a vector by a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector3F"/> containing the result.</returns>
		public static Vector3F Multiply(Vector3F vector, float scalar)
		{
			return new Vector3F(vector.X * scalar, vector.Y * scalar, vector.Z * scalar);
		}
コード例 #33
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a vector by another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
 /// <remarks>
 ///	result[i] = u[i] / v[i].
 /// </remarks>
 public static Vector3F Divide(Vector3F u, Vector3F v)
 {
     return(new Vector3F(u.X / v.X, u.Y / v.Y, u.Z / v.Z));
 }
コード例 #34
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Multiplies a vector by a scalar and put the result in another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
		public static void Multiply(Vector3F vector, float scalar, ref Vector3F result)
		{
			result.X = vector.X * scalar;
			result.Y = vector.Y * scalar;
			result.Z = vector.Z * scalar;
		}
コード例 #35
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = s / v[i]
 /// </remarks>
 public static Vector3F Divide(float s, Vector3F v)
 {
     return(new Vector3F(s / v.X, s / v.Y, s / v.Z));
 }
コード例 #36
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Calculates the dot product of two vectors.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <returns>The dot product value.</returns>
		public static float DotProduct(Vector3F left, Vector3F right)
		{
			return (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z);
		}
コード例 #37
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <param name="v">A <see cref="Vector3F"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = u[i] / s
 /// </remarks>
 public static void Divide(Vector3F u, float s, Vector3F v)
 {
     v.X = u.X / s;
     v.Y = u.Y / s;
     v.Z = u.Z / s;
 }
コード例 #38
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Calculates the cross product of two vectors.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <returns>A new <see cref="Vector3F"/> containing the cross product result.</returns>
		public static Vector3F CrossProduct(Vector3F left, Vector3F right)
		{
			return new Vector3F(
				left.Y * right.Z - left.Z * right.Y,
				left.Z * right.X - left.X * right.Z,
				left.X * right.Y - left.Y * right.X);
		}
コード例 #39
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> containing the result.</returns>
 public static Vector3F Multiply(Vector3F u, float s)
 {
     return(new Vector3F(u.X * s, u.Y * s, u.Z * s));
 }
コード例 #40
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Calculates the cross product of two vectors.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <param name="result">A <see cref="Vector3F"/> instance to hold the cross product result.</param>
		public static void CrossProduct(Vector3F left, Vector3F right, ref Vector3F result)
		{
			result.X = left.Y * right.Z - left.Z * right.Y;
			result.Y = left.Z * right.X - left.X * right.Z;
			result.Z = left.X * right.Y - left.Y * right.X;
		}
コード例 #41
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <returns>The dot product value.</returns>
 public static float DotProduct(Vector3F u, Vector3F v)
 {
     return((u.X * v.X) + (u.Y * v.Y) + (u.Z * v.Z));
 }
コード例 #42
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Negates a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <returns>A new <see cref="Vector3F"/> instance containing the negated values.</returns>
		public static Vector3F Negate(Vector3F vector)
		{
			return new Vector3F(-vector.X, -vector.Y, -vector.Z);
		}
コード例 #43
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Negates a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the negated values.</returns>
 public static Vector3F Negate(Vector3F v)
 {
     return(new Vector3F(-v.X, -v.Y, -v.Z));
 }
コード例 #44
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Tests whether two vectors are approximately equal using default tolerance value.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
		public static bool ApproxEqual(Vector3F left, Vector3F right)
		{
			return ApproxEqual(left, right, MathFunctions.EpsilonF);
		}
コード例 #45
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Negates the values of the vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the negated values.</returns>
 public static Vector3F operator -(Vector3F v)
 {
     return(Vector3F.Negate(v));
 }
コード例 #46
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Tests whether two vectors are approximately equal given a tolerance value.
		/// </summary>
		/// <param name="left">A <see cref="Vector3F"/> instance.</param>
		/// <param name="right">A <see cref="Vector3F"/> instance.</param>
		/// <param name="tolerance">The tolerance value used to test approximate equality.</param>
		/// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
		public static bool ApproxEqual(Vector3F left, Vector3F right, float tolerance)
		{
			return
				(
				(System.Math.Abs(left.X - right.X) <= tolerance) &&
				(System.Math.Abs(left.Y - right.Y) <= tolerance) &&
				(System.Math.Abs(left.Z - right.Z) <= tolerance)
				);
		}
コード例 #47
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Adds two vectors.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the sum.</returns>
 public static Vector3F operator +(Vector3F u, Vector3F v)
 {
     return(Vector3F.Add(u, v));
 }
コード例 #48
0
ファイル: Vector3F.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Initializes a new instance of the <see cref="Vector3F"/> class using coordinates from a given <see cref="Vector3F"/> instance.
		/// </summary>
		/// <param name="vector">A <see cref="Vector3F"/> to get the coordinates from.</param>
		public Vector3F(Vector3F vector)
		{
			_x = vector.X;
			_y = vector.Y;
			_z = vector.Z;
		}
コード例 #49
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = v[i] - w[i].
 /// </remarks>
 public static Vector3F operator -(Vector3F u, Vector3F v)
 {
     return(Vector3F.Subtract(u, v));
 }
コード例 #50
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Adds two vectors and put the result in the third vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance</param>
 /// <param name="w">A <see cref="Vector3F"/> instance to hold the result.</param>
 public static void Add(Vector3F u, Vector3F v, Vector3F w)
 {
     w.X = u.X + v.X;
     w.Y = u.Y + v.Y;
     w.Z = u.Z + v.Z;
 }
コード例 #51
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = s - v[i]
 /// </remarks>
 public static Vector3F operator -(float s, Vector3F v)
 {
     return(Vector3F.Subtract(s, v));
 }
コード例 #52
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Adds a vector and a scalar and put the result into another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance to hold the result.</param>
 public static void Add(Vector3F u, float s, Vector3F v)
 {
     v.X = u.X + s;
     v.Y = u.Y + s;
     v.Z = u.Z + s;
 }
コード例 #53
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector3F"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = v[i] / s;
 /// </remarks>
 public static Vector3F operator /(Vector3F v, float s)
 {
     return(Vector3F.Divide(v, s));
 }
コード例 #54
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="w">A <see cref="Vector3F"/> instance.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = v[i] - w[i].
 /// </remarks>
 public static Vector3F Subtract(Vector3F v, Vector3F w)
 {
     return(new Vector3F(v.X - w.X, v.Y - w.Y, v.Z - w.Z));
 }
コード例 #55
0
ファイル: Segment.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Initializes a new instance of the <see cref="Segment"/> class.
		/// </summary>
		/// <param name="p0">A <see cref="Vector3F"/> instance marking the segment's starting point.</param>
		/// <param name="p1">A <see cref="Vector3F"/> instance marking the segment's ending point.</param>
		public Segment(Vector3F p0, Vector3F p1)
		{
			_p0 = p0;
			_p1 = p1;
		}
コード例 #56
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = v[i] - s
 /// </remarks>
 public static Vector3F Subtract(Vector3F v, float s)
 {
     return(new Vector3F(v.X - s, v.Y - s, v.Z - s));
 }
コード例 #57
0
ファイル: Matrix3F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Transforms a given vector by a matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix3F"/> instance.</param>
		/// <param name="vector">A <see cref="Vector3F"/> instance.</param>
		/// <returns>A new <see cref="Vector3F"/> instance containing the result.</returns>
		public static Vector3F Transform(Matrix3F matrix, Vector3F vector)
		{
			return new Vector3F(
				(matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z),
				(matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z),
				(matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z));
		}
コード例 #58
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector3F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector3F"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = s - v[i]
 /// </remarks>
 public static Vector3F Subtract(float s, Vector3F v)
 {
     return(new Vector3F(s - v.X, s - v.Y, s - v.Z));
 }
コード例 #59
0
ファイル: Matrix3F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Initializes a new instance of the <see cref="Matrix3F"/> structure with the specified values.
		/// </summary>
		/// <param name="column1">A <see cref="Vector3F"/> instance holding values for the first column.</param>
		/// <param name="column2">A <see cref="Vector3F"/> instance holding values for the second column.</param>
		/// <param name="column3">A <see cref="Vector3F"/> instance holding values for the third column.</param>
		public Matrix3F(Vector3F column1, Vector3F column2, Vector3F column3)
		{
			_m11 = column1.X; _m12 = column2.X; _m13 = column3.X; 
			_m21 = column1.Y; _m22 = column2.Y; _m23 = column3.Y; 
			_m31 = column1.Z; _m32 = column2.Z; _m33 = column3.Z;
		}
コード例 #60
0
ファイル: Vector3F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a vector from a second vector and puts the result into a third vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector3F"/> instance.</param>
 /// <param name="v">A <see cref="Vector3F"/> instance</param>
 /// <param name="w">A <see cref="Vector3F"/> instance to hold the result.</param>
 /// <remarks>
 ///	w[i] = v[i] - w[i].
 /// </remarks>
 public static void Subtract(Vector3F u, Vector3F v, Vector3F w)
 {
     w.X = u.X - v.X;
     w.Y = u.Y - v.Y;
     w.Z = u.Z - v.Z;
 }