Minor improvements to mesh topology accessibility.

This commit is contained in:
wo80
2022-08-21 23:38:40 +02:00
parent e5c692e7c5
commit 3deb79800e
3 changed files with 25 additions and 24 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ namespace TriangleNet.Topology
{
return "O-TID [null]";
}
return String.Format("O-SID {0}", seg.hash);
return string.Format("O-SID {0}", seg.hash);
}
#region Osub primitives
+10 -8
View File
@@ -23,6 +23,8 @@ namespace TriangleNet.Topology
internal Triangle tri;
internal int orient; // Ranges from 0 to 2.
public int Orient => orient;
/// <summary>
/// Gets or sets the triangle.
/// </summary>
@@ -354,6 +356,14 @@ namespace TriangleNet.Topology
ot.orient = orient;
}
/// <summary>
/// Finds a subsegment abutting a triangle.
/// </summary>
public void Pivot(ref Osub os)
{
os = tri.subsegs[orient];
}
/// <summary>
/// Test for equality of oriented triangles.
/// </summary>
@@ -439,14 +449,6 @@ namespace TriangleNet.Topology
return tri.infected;
}
/// <summary>
/// Finds a subsegment abutting a triangle.
/// </summary>
internal void Pivot(ref Osub os)
{
os = tri.subsegs[orient];
}
/// <summary>
/// Bond a triangle to a subsegment.
/// </summary>
+14 -15
View File
@@ -47,26 +47,17 @@ namespace TriangleNet.Topology
/// <summary>
/// Gets the first endpoints vertex id.
/// </summary>
public int P0
{
get { return this.vertices[0].id; }
}
public int P0 => vertices[0].id;
/// <summary>
/// Gets the seconds endpoints vertex id.
/// </summary>
public int P1
{
get { return this.vertices[1].id; }
}
public int P1 => vertices[1].id;
/// <summary>
/// Gets the segment boundary mark.
/// </summary>
public int Label
{
get { return this.boundary; }
}
public int Label => boundary;
#endregion
@@ -75,7 +66,7 @@ namespace TriangleNet.Topology
/// </summary>
public Vertex GetVertex(int index)
{
return this.vertices[index]; // TODO: Check range?
return vertices[index]; // TODO: Check range?
}
/// <summary>
@@ -86,16 +77,24 @@ namespace TriangleNet.Topology
return triangles[index].tri.hash == Mesh.DUMMY ? null : triangles[index].tri;
}
/// <summary>
/// Gets an adjoining triangle.
/// </summary>
public void GetTriangle(int index, ref Otri otri)
{
otri = triangles[index];
}
/// <inheritdoc />
public override int GetHashCode()
{
return this.hash;
return hash;
}
/// <inheritdoc />
public override string ToString()
{
return String.Format("SID {0}", hash);
return string.Format("SID {0}", hash);
}
}
}