diff --git a/LibTessDotNet/Sources/MeshUtils.cs b/LibTessDotNet/Sources/MeshUtils.cs index 4be217d..eec6600 100644 --- a/LibTessDotNet/Sources/MeshUtils.cs +++ b/LibTessDotNet/Sources/MeshUtils.cs @@ -90,7 +90,7 @@ public static void Normalize(ref Vec3 v) { var len = v.X * v.X + v.Y * v.Y + v.Z * v.Z; Debug.Assert(len >= 0.0f); - len = 1.0f / (float)Math.Sqrt(len); + len = 1.0f / (Real)Math.Sqrt(len); v.X *= len; v.Y *= len; v.Z *= len; diff --git a/LibTessDotNet/Sources/Tess.cs b/LibTessDotNet/Sources/Tess.cs index 6bc3198..7a3b434 100644 --- a/LibTessDotNet/Sources/Tess.cs +++ b/LibTessDotNet/Sources/Tess.cs @@ -104,7 +104,11 @@ public partial class Tess public Real SUnitX = 1; public Real SUnitY = 0; +#if DOUBLE + public Real SentinelCoord = 4e150; +#else public Real SentinelCoord = 4e30f; +#endif /// /// If true, will remove empty (zero area) polygons. @@ -471,7 +475,7 @@ private void OutputPolymesh(ElementType elementType, int polySize) if (NoEmptyPolygons) { var area = MeshUtils.FaceArea(f); - if (Math.Abs(area) < float.Epsilon) + if (Math.Abs(area) < Real.Epsilon) { continue; } @@ -525,7 +529,7 @@ private void OutputPolymesh(ElementType elementType, int polySize) if (NoEmptyPolygons) { var area = MeshUtils.FaceArea(f); - if (Math.Abs(area) < float.Epsilon) + if (Math.Abs(area) < Real.Epsilon) { continue; }