ソースを参照

fixed Vector3.AlmostEquals()

Daniel Salvadori 7 年 前
コミット
4d1094e9cc
1 ファイル変更3 行追加3 行削除
  1. 3 3
      math32/vector3.go

+ 3 - 3
math32/vector3.go

@@ -671,9 +671,9 @@ func (v *Vector3) RandomTangents() (*Vector3, *Vector3) {
 // AlmostEquals returns whether the vector is almost equal to another vector within the specified tolerance.
 func (v *Vector3) AlmostEquals(other *Vector3, tolerance float32) bool {
 
-	if (v.X - other.X < tolerance) &&
-		(v.Y - other.Y < tolerance) &&
-		(v.Z - other.Z < tolerance) {
+	if (Abs(v.X - other.X) < tolerance) &&
+		(Abs(v.Y - other.Y) < tolerance) &&
+		(Abs(v.Z - other.Z) < tolerance) {
 			return true
 	}
 	return false