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); }
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; }
/// <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; }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
/// <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)); }
/// <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; }
/// <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; }
/// <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); }
/// <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; }
/// <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); }
/// <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; }
/// <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); }
/// <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)); }
/// <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; }
/// <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)); }
/// <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; }
/// <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); }
/// <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; }
/// <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; }
/// <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); }
/// <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)); }
/// <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; }
/// <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)); }
/// <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); }
/// <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; }
/// <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); }
/// <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)); }
/// <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; }
/// <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)); }
/// <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); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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) ); }
/// <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)); }
/// <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)); }
/// <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; }
/// <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)); }
/// <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; }
/// <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)); }
/// <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)); }
/// <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; }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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; }
/// <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; }