Skip to content

Commit 9003ccd

Browse files
committed
Fix a couple of float/double issues.
1 parent 658a06c commit 9003ccd

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

LibTessDotNet/Sources/MeshUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static void Normalize(ref Vec3 v)
9090
{
9191
var len = v.X * v.X + v.Y * v.Y + v.Z * v.Z;
9292
Debug.Assert(len >= 0.0f);
93-
len = 1.0f / (float)Math.Sqrt(len);
93+
len = 1.0f / (Real)Math.Sqrt(len);
9494
v.X *= len;
9595
v.Y *= len;
9696
v.Z *= len;

LibTessDotNet/Sources/Tess.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ public partial class Tess
104104

105105
public Real SUnitX = 1;
106106
public Real SUnitY = 0;
107+
#if DOUBLE
108+
public Real SentinelCoord = 4e150;
109+
#else
107110
public Real SentinelCoord = 4e30f;
111+
#endif
108112

109113
/// <summary>
110114
/// If true, will remove empty (zero area) polygons.
@@ -471,7 +475,7 @@ private void OutputPolymesh(ElementType elementType, int polySize)
471475
if (NoEmptyPolygons)
472476
{
473477
var area = MeshUtils.FaceArea(f);
474-
if (Math.Abs(area) < float.Epsilon)
478+
if (Math.Abs(area) < Real.Epsilon)
475479
{
476480
continue;
477481
}
@@ -525,7 +529,7 @@ private void OutputPolymesh(ElementType elementType, int polySize)
525529
if (NoEmptyPolygons)
526530
{
527531
var area = MeshUtils.FaceArea(f);
528-
if (Math.Abs(area) < float.Epsilon)
532+
if (Math.Abs(area) < Real.Epsilon)
529533
{
530534
continue;
531535
}

0 commit comments

Comments
 (0)