コード例 #1
0
 public TSVector(FP x, FP y, FP z)
 {
     this.x = x;
     this.y = y;
     this.z = z;
 }
コード例 #2
0
 public static void Multiply(ref TSVector2 value1, FP scaleFactor, out TSVector2 result)
 {
     result.x = value1.x * scaleFactor;
     result.y = value1.y * scaleFactor;
 }
コード例 #3
0
 public static void SmoothStep(ref TSVector2 value1, ref TSVector2 value2, FP amount, out TSVector2 result)
 {
     result = new TSVector2(
         TSMath.SmoothStep(value1.x, value2.x, amount),
         TSMath.SmoothStep(value1.y, value2.y, amount));
 }
コード例 #4
0
 public static TSVector2 LerpUnclamped(TSVector2 value1, TSVector2 value2, FP amount)
 {
     return(new TSVector2(
                TSMath.Lerp(value1.x, value2.x, amount),
                TSMath.Lerp(value1.y, value2.y, amount)));
 }
コード例 #5
0
 public void Scale(TSVector2 other)
 {
     this.x = x * other.x;
     this.y = y * other.y;
 }
コード例 #6
0
 public static void Dot(ref TSVector2 value1, ref TSVector2 value2, out FP result)
 {
     result = value1.x * value2.x + value1.y * value2.y;
 }
コード例 #7
0
 public static void Hermite(ref TSVector2 value1, ref TSVector2 tangent1, ref TSVector2 value2, ref TSVector2 tangent2,
                            FP amount, out TSVector2 result)
 {
     result.x = TSMath.Hermite(value1.x, tangent1.x, value2.x, tangent2.x, amount);
     result.y = TSMath.Hermite(value1.y, tangent1.y, value2.y, tangent2.y, amount);
 }
コード例 #8
0
 /// <summary>
 /// Sets the length of the vector to zero.
 /// </summary>
 #region public void MakeZero()
 public void MakeZero()
 {
     x = FP.Zero;
     y = FP.Zero;
     z = FP.Zero;
 }
コード例 #9
0
 /// <summary>
 /// Divides a vector by a factor.
 /// </summary>
 /// <param name="value1">The vector to divide.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 /// <param name="result">Returns the scaled vector.</param>
 public static void Divide(ref TSVector value1, FP scaleFactor, out TSVector result)
 {
     result.x = value1.x / scaleFactor;
     result.y = value1.y / scaleFactor;
     result.z = value1.z / scaleFactor;
 }
コード例 #10
0
 public static TSVector Lerp(TSVector from, TSVector to, FP percent)
 {
     return(from + (to - from) * percent);
 }
コード例 #11
0
 public static FP Distance(TSVector v1, TSVector v2)
 {
     return(FP.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z)));
 }
コード例 #12
0
 /// <summary>
 /// Constructor initializing a new instance of the structure
 /// </summary>
 /// <param name="xyz">All components of the vector are set to xyz</param>
 public TSVector(FP xyz)
 {
     this.x = xyz;
     this.y = xyz;
     this.z = xyz;
 }
コード例 #13
0
 /// <summary>
 /// Sets all vector component to specific values.
 /// </summary>
 /// <param name="x">The X component of the vector.</param>
 /// <param name="y">The Y component of the vector.</param>
 /// <param name="z">The Z component of the vector.</param>
 public void Set(FP x, FP y, FP z)
 {
     this.x = x;
     this.y = y;
     this.z = z;
 }
コード例 #14
0
 /// <summary>
 /// Multiplies each component of the vector by the same components of the provided vector.
 /// </summary>
 public void Scale(TSVector other)
 {
     this.x = x * other.x;
     this.y = y * other.y;
     this.z = z * other.z;
 }
コード例 #15
0
 public static void Distance(ref TSVector2 value1, ref TSVector2 value2, out FP result)
 {
     DistanceSquared(ref value1, ref value2, out result);
     result = (FP)FP.Sqrt(result);
 }
コード例 #16
0
 /// <summary>
 /// Inverses the direction of the vector.
 /// </summary>
 #region public static JVector Negate(JVector value)
 public void Negate()
 {
     this.x = -this.x;
     this.y = -this.y;
     this.z = -this.z;
 }
コード例 #17
0
 public static void DistanceSquared(ref TSVector2 value1, ref TSVector2 value2, out FP result)
 {
     result = (value1.x - value2.x) * (value1.x - value2.x) + (value1.y - value2.y) * (value1.y - value2.y);
 }
コード例 #18
0
 /// <summary>
 /// Constructor foe standard 2D vector.
 /// </summary>
 /// <param name="x">
 /// A <see cref="System.Single"/>
 /// </param>
 /// <param name="y">
 /// A <see cref="System.Single"/>
 /// </param>
 public TSVector2(FP x, FP y)
 {
     this.x = x;
     this.y = y;
 }
コード例 #19
0
        public static TSVector2 Hermite(TSVector2 value1, TSVector2 tangent1, TSVector2 value2, TSVector2 tangent2, FP amount)
        {
            TSVector2 result = new TSVector2();

            Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
            return(result);
        }
コード例 #20
0
 /// <summary>
 /// Constructor for "square" vector.
 /// </summary>
 /// <param name="value">
 /// A <see cref="System.Single"/>
 /// </param>
 public TSVector2(FP value)
 {
     x = value;
     y = value;
 }
コード例 #21
0
 public static TSVector2 ClampMagnitude(TSVector2 vector, FP maxLength)
 {
     return(Normalize(vector) * maxLength);
 }
コード例 #22
0
 public void Set(FP x, FP y)
 {
     this.x = x;
     this.y = y;
 }
コード例 #23
0
 public static void LerpUnclamped(ref TSVector2 value1, ref TSVector2 value2, FP amount, out TSVector2 result)
 {
     result = new TSVector2(
         TSMath.Lerp(value1.x, value2.x, amount),
         TSMath.Lerp(value1.y, value2.y, amount));
 }
コード例 #24
0
 public static TSVector2 Barycentric(TSVector2 value1, TSVector2 value2, TSVector2 value3, FP amount1, FP amount2)
 {
     return(new TSVector2(
                TSMath.Barycentric(value1.x, value2.x, value3.x, amount1, amount2),
                TSMath.Barycentric(value1.y, value2.y, value3.y, amount1, amount2)));
 }
コード例 #25
0
 public static TSVector2 Multiply(TSVector2 value1, FP scaleFactor)
 {
     value1.x *= scaleFactor;
     value1.y *= scaleFactor;
     return(value1);
 }
コード例 #26
0
 public static void Barycentric(ref TSVector2 value1, ref TSVector2 value2, ref TSVector2 value3, FP amount1,
                                FP amount2, out TSVector2 result)
 {
     result = new TSVector2(
         TSMath.Barycentric(value1.x, value2.x, value3.x, amount1, amount2),
         TSMath.Barycentric(value1.y, value2.y, value3.y, amount1, amount2));
 }
コード例 #27
0
 public static TSVector2 SmoothStep(TSVector2 value1, TSVector2 value2, FP amount)
 {
     return(new TSVector2(
                TSMath.SmoothStep(value1.x, value2.x, amount),
                TSMath.SmoothStep(value1.y, value2.y, amount)));
 }
コード例 #28
0
 public static TSVector2 CatmullRom(TSVector2 value1, TSVector2 value2, TSVector2 value3, TSVector2 value4, FP amount)
 {
     return(new TSVector2(
                TSMath.CatmullRom(value1.x, value2.x, value3.x, value4.x, amount),
                TSMath.CatmullRom(value1.y, value2.y, value3.y, value4.y, amount)));
 }
コード例 #29
0
 public static FP Angle(TSVector2 a, TSVector2 b)
 {
     return(FP.Acos(a.normalized * b.normalized) * FP.Rad2Deg);
 }
コード例 #30
0
        /// <summary>
        /// Constructor initializing a new instance of the structure
        /// </summary>
        /// <param name="x">The X component of the vector.</param>
        /// <param name="y">The Y component of the vector.</param>
        /// <param name="z">The Z component of the vector.</param>

        public TSVector(int x, int y, int z)
        {
            this.x = (FP)x;
            this.y = (FP)y;
            this.z = (FP)z;
        }