USE_Z: add automatic interpolation of z coordinate

git-svn-id: https://triangle.svn.codeplex.com/svn@79822 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
This commit is contained in:
SND\wo80_cp
2017-05-15 16:13:21 +00:00
parent ab3693fb04
commit 5ab20816e5
3 changed files with 15 additions and 5 deletions
+6 -5
View File
@@ -7,10 +7,16 @@
namespace TriangleNet.Geometry
{
using System;
using System.Diagnostics;
/// <summary>
/// Represents a 2D point.
/// </summary>
#if USE_Z
[DebuggerDisplay("ID {ID} [{X}, {Y}, {Z}]")]
#else
[DebuggerDisplay("ID {ID} [{X}, {Y}]")]
#endif
public class Point : IComparable<Point>, IEquatable<Point>
{
internal int id;
@@ -170,10 +176,5 @@ namespace TriangleNet.Geometry
return hash;
}
public override string ToString()
{
return String.Format("[{0},{1}]", x, y);
}
}
}
@@ -719,6 +719,9 @@ namespace TriangleNet.Meshing
newvertex.attributes[i] = torg.attributes[i] + split * (tdest.attributes[i] - torg.attributes[i]);
}
#endif
#if USE_Z
newvertex.z = torg.z + split * (tdest.z - torg.z);
#endif
mesh.vertices.Add(newvertex.hash, newvertex);
@@ -624,6 +624,9 @@ namespace TriangleNet.Meshing
newvertex.attributes[i] = eorg.attributes[i]
+ split * (edest.attributes[i] - eorg.attributes[i]);
}
#endif
#if USE_Z
newvertex.z = eorg.z + split * (edest.z - eorg.z);
#endif
if (!Behavior.NoExact)
{
@@ -790,6 +793,9 @@ namespace TriangleNet.Meshing
{
Interpolation.InterpolateAttributes(newvertex, newvertex.tri.tri, mesh.nextras);
}
#endif
#if USE_Z
Interpolation.InterpolateZ(newvertex, newvertex.tri.tri);
#endif
mesh.vertices.Add(newvertex.hash, newvertex);