|
|
@@ -630,3 +630,15 @@ func (v *Vector4) Clone() *Vector4 {
|
|
|
|
|
|
return NewVector4(v.X, v.Y, v.Z, v.W)
|
|
|
}
|
|
|
+
|
|
|
+// AlmostEquals returns whether the vector is almost equal to another vector within the specified tolerance.
|
|
|
+func (v *Vector4) AlmostEquals(other *Vector4, tolerance float32) bool {
|
|
|
+
|
|
|
+ if (Abs(v.X - other.X) < tolerance) &&
|
|
|
+ (Abs(v.Y - other.Y) < tolerance) &&
|
|
|
+ (Abs(v.Z - other.Z) < tolerance) &&
|
|
|
+ (Abs(v.W - other.W) < tolerance) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|