Added ISegment interface,
Added access to segments adjoining triangles git-svn-id: https://triangle.svn.codeplex.com/svn@71933 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
This commit is contained in:
@@ -21,7 +21,7 @@ namespace TriangleNet.Data
|
||||
/// four pointers to vertices, plus two pointers to adjoining triangles,
|
||||
/// plus one boundary marker.
|
||||
/// </remarks>
|
||||
public class Segment
|
||||
public class Segment : ISegment
|
||||
{
|
||||
// Hash for dictionary. Will be set by mesh instance.
|
||||
internal int hash;
|
||||
@@ -77,6 +77,8 @@ namespace TriangleNet.Data
|
||||
get { return this.boundary; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets the segments endpoint.
|
||||
/// </summary>
|
||||
@@ -85,7 +87,13 @@ namespace TriangleNet.Data
|
||||
return this.vertices[index]; // TODO: Check range?
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Gets an adjoining triangle.
|
||||
/// </summary>
|
||||
public ITriangle GetTriangle(int index)
|
||||
{
|
||||
return triangles[index].triangle;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
namespace TriangleNet.Data
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TriangleNet.Geometry;
|
||||
|
||||
/// <summary>
|
||||
@@ -151,7 +148,7 @@ namespace TriangleNet.Data
|
||||
/// </summary>
|
||||
/// <param name="index">The vertex index (0, 1 or 2).</param>
|
||||
/// <returns>The segment opposite of vertex with given index.</returns>
|
||||
public Segment GetSegment(int index)
|
||||
public ISegment GetSegment(int index)
|
||||
{
|
||||
return subsegs[index].seg == Mesh.dummysub ? null : subsegs[index].seg;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// <copyright file="Segment.cs" company="">
|
||||
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace TriangleNet.Geometry
|
||||
{
|
||||
using TriangleNet.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for segment geometry.
|
||||
/// </summary>
|
||||
public interface ISegment
|
||||
{
|
||||
#region Public properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first endpoints vertex id.
|
||||
/// </summary>
|
||||
int P0 { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the seconds endpoints vertex id.
|
||||
/// </summary>
|
||||
int P1 { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the segment boundary mark.
|
||||
/// </summary>
|
||||
int Boundary { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the segments endpoint.
|
||||
/// </summary>
|
||||
/// <param name="index">The vertex index (0 or 1).</param>
|
||||
Vertex GetVertex(int index);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an adjoining triangle.
|
||||
/// </summary>
|
||||
/// <param name="index">The triangle index (0 or 1).</param>
|
||||
ITriangle GetTriangle(int index);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,6 @@
|
||||
|
||||
namespace TriangleNet.Geometry
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TriangleNet.Data;
|
||||
|
||||
/// <summary>
|
||||
@@ -72,7 +68,7 @@ namespace TriangleNet.Geometry
|
||||
/// </summary>
|
||||
/// <param name="index">The vertex index (0, 1 or 2).</param>
|
||||
/// <returns>The segment opposite of vertex with given index.</returns>
|
||||
Segment GetSegment(int index);
|
||||
ISegment GetSegment(int index);
|
||||
|
||||
/// <summary>
|
||||
/// Triangle area constraint.
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// <copyright file="Triangle.cs" company="">
|
||||
// Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html
|
||||
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace TriangleNet.IO
|
||||
{
|
||||
using System;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// Simple triangle class for input.
|
||||
@@ -92,7 +90,7 @@ namespace TriangleNet.IO
|
||||
return null;
|
||||
}
|
||||
|
||||
public Segment GetSegment(int index)
|
||||
public ISegment GetSegment(int index)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -123,19 +123,10 @@ namespace TriangleNet
|
||||
}
|
||||
}
|
||||
|
||||
if (horrors == 0 && Behavior.Verbose)
|
||||
if (horrors == 0) // && Behavior.Verbose
|
||||
{
|
||||
logger.Info("Mesh topology appears to be consistent.");
|
||||
//logger.Info("In my studied opinion, the mesh appears to be consistent.");
|
||||
}
|
||||
//else if (horrors == 1)
|
||||
//{
|
||||
// logger.Info("Precisely one festering wound discovered.");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// logger.Info(horrors + " abominations witnessed.");
|
||||
//}
|
||||
|
||||
// Restore the status of exact arithmetic.
|
||||
Behavior.NoExact = saveexact;
|
||||
@@ -212,19 +203,10 @@ namespace TriangleNet
|
||||
|
||||
}
|
||||
|
||||
if (horrors == 0 && Behavior.Verbose)
|
||||
if (horrors == 0) // && Behavior.Verbose
|
||||
{
|
||||
logger.Info("Mesh is Delaunay.");
|
||||
//logger.Info("By virtue of my perceptive intelligence, I declare the mesh Delaunay.");
|
||||
}
|
||||
//else if (horrors == 1)
|
||||
//{
|
||||
// logger.Info("Precisely one terrifying transgression identified.");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// logger.Info(horrors + " obscenities viewed with horror.");
|
||||
//}
|
||||
|
||||
// Restore the status of exact arithmetic.
|
||||
Behavior.NoExact = saveexact;
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<Compile Include="Geometry\ITriangle.cs" />
|
||||
<Compile Include="Geometry\Point.cs" />
|
||||
<Compile Include="Geometry\RegionPointer.cs" />
|
||||
<Compile Include="Geometry\ISegment.cs" />
|
||||
<Compile Include="IO\DataReader.cs" />
|
||||
<Compile Include="IO\DebugWriter.cs" />
|
||||
<Compile Include="IO\FileWriter.cs" />
|
||||
|
||||
Reference in New Issue
Block a user