Skip to content

Commit

Permalink
Fix a couple of float/double issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
speps committed Feb 19, 2016
1 parent 658a06c commit 9003ccd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LibTessDotNet/Sources/MeshUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions LibTessDotNet/Sources/Tess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// <summary>
/// If true, will remove empty (zero area) polygons.
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9003ccd

Please sign in to comment.