public TSVector(FP x, FP y, FP z) { this.x = x; this.y = y; this.z = z; }
public static void Multiply(ref TSVector2 value1, FP scaleFactor, out TSVector2 result) { result.x = value1.x * scaleFactor; result.y = value1.y * scaleFactor; }
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)); }
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))); }
public void Scale(TSVector2 other) { this.x = x * other.x; this.y = y * other.y; }
public static void Dot(ref TSVector2 value1, ref TSVector2 value2, out FP result) { result = value1.x * value2.x + value1.y * value2.y; }
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); }
/// <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; }
/// <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; }
public static TSVector Lerp(TSVector from, TSVector to, FP percent) { return(from + (to - from) * percent); }
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))); }
/// <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; }
/// <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; }
/// <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; }
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); }
/// <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; }
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); }
/// <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; }
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); }
/// <summary> /// Constructor for "square" vector. /// </summary> /// <param name="value"> /// A <see cref="System.Single"/> /// </param> public TSVector2(FP value) { x = value; y = value; }
public static TSVector2 ClampMagnitude(TSVector2 vector, FP maxLength) { return(Normalize(vector) * maxLength); }
public void Set(FP x, FP y) { this.x = x; this.y = y; }
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)); }
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))); }
public static TSVector2 Multiply(TSVector2 value1, FP scaleFactor) { value1.x *= scaleFactor; value1.y *= scaleFactor; return(value1); }
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)); }
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))); }
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))); }
public static FP Angle(TSVector2 a, TSVector2 b) { return(FP.Acos(a.normalized * b.normalized) * FP.Rad2Deg); }
/// <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; }