Search Results for

    Show / Hide Table of Contents

    Class Tri

    A memory-efficient representation of a triangle in a triangulation. Contains three vertices, and links to adjacent Tris for each edge. Tris are constructed independently, and if needed linked into a triangulation using TriangulationBuilder.

    An edge of a Tri in a triangulation is called a boundary edge if it has no adjacent triangle.
    The set of Tris containing boundary edges are called the triangulation border.
    Inheritance
    object
    Tri
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: NetTopologySuite.Triangulate.Tri
    Assembly: NetTopologySuite.dll
    Syntax
    public class Tri

    Constructors

    | Edit this page View Source

    Tri(Coordinate, Coordinate, Coordinate)

    Creates a triangle with the given vertices. The vertices should be oriented clockwise.

    Declaration
    public Tri(Coordinate p0, Coordinate p1, Coordinate p2)
    Parameters
    Type Name Description
    Coordinate p0

    The first triangle vertex

    Coordinate p1

    The second triangle vertex

    Coordinate p2

    The third triangle vertex

    Properties

    | Edit this page View Source

    Area

    Gets the area of the triangle.

    Declaration
    public double Area { get; }
    Property Value
    Type Description
    double

    The area of the triangle

    | Edit this page View Source

    Length

    Gets the perimeter length of the perimeter of the triangle.

    Declaration
    public double Length { get; }
    Property Value
    Type Description
    double
    | Edit this page View Source

    NumAdjacent

    Computes the number of triangle adjacent to this triangle. This is a number in the range [0,2].

    Declaration
    public int NumAdjacent { get; }
    Property Value
    Type Description
    int

    The number of adjacent triangles

    | Edit this page View Source

    P0

    Gets a value indicating the 1st point of this Tri.

    Declaration
    protected Coordinate P0 { get; }
    Property Value
    Type Description
    Coordinate
    | Edit this page View Source

    P1

    Gets a value indicating the 2nd point of this Tri.

    Declaration
    protected Coordinate P1 { get; }
    Property Value
    Type Description
    Coordinate
    | Edit this page View Source

    P2

    Gets a value indicating the 3rd point of this Tri.

    Declaration
    protected Coordinate P2 { get; }
    Property Value
    Type Description
    Coordinate
    | Edit this page View Source

    Tri0

    Gets a value indicating the adjacent Tri across the edge P0 clockwise towards the next point.

    Declaration
    protected Tri Tri0 { get; }
    Property Value
    Type Description
    Tri
    | Edit this page View Source

    Tri1

    Gets a value indicating the adjacent Tri across the edge P1 clockwise towards the next point.

    Declaration
    protected Tri Tri1 { get; }
    Property Value
    Type Description
    Tri
    | Edit this page View Source

    Tri2

    Gets a value indicating the adjacent Tri across the edge P2 clockwise towards the next point.

    Declaration
    protected Tri Tri2 { get; }
    Property Value
    Type Description
    Tri

    Methods

    | Edit this page View Source

    AreaOf(IEnumerable<Tri>)

    Computes the area of a set of Tris.

    Declaration
    public static double AreaOf(IEnumerable<Tri> triList)
    Parameters
    Type Name Description
    IEnumerable<Tri> triList

    A set of tris

    Returns
    Type Description
    double

    The total area of the triangles

    | Edit this page View Source

    Create(Coordinate, Coordinate, Coordinate)

    Creates a triangle with the given vertices. The vertices should be oriented clockwise.

    Declaration
    public static Tri Create(Coordinate p0, Coordinate p1, Coordinate p2)
    Parameters
    Type Name Description
    Coordinate p0

    The first triangle vertex

    Coordinate p1

    The second triangle vertex

    Coordinate p2

    The third triangle vertex

    Returns
    Type Description
    Tri

    The created trianlge

    | Edit this page View Source

    Create(Coordinate[])

    Creates a triangle from an array with three vertex coordinates. The vertices should be oriented clockwise.

    Declaration
    public static Tri Create(Coordinate[] pts)
    Parameters
    Type Name Description
    Coordinate[] pts

    The array of vertex coordinates

    Returns
    Type Description
    Tri

    The created triangle

    | Edit this page View Source

    Degree(int, IList<Tri>)

    Computes the degree of a Tri vertex, which is the number of tris containing it. This must be done by searching the entire triangulation, since the containing tris may not be adjacent or edge-connected.

    Declaration
    public int Degree(int index, IList<Tri> triList)
    Parameters
    Type Name Description
    int index

    The vertex index

    IList<Tri> triList

    The triangulation

    Returns
    Type Description
    int

    The degree of the vertex

    | Edit this page View Source

    Flip(int)

    Interchanges the vertices of this triangle and a neighbor so that their common edge becomes the the other diagonal of the quadrilateral they form. Neighbour triangle links are modified accordingly.

    Declaration
    public void Flip(int index)
    Parameters
    Type Name Description
    int index

    The index of the adjacent tri to flip with

    | Edit this page View Source

    GetAdjacent(int)

    Gets the triangle adjacent to an edge.

    Declaration
    public Tri GetAdjacent(int index)
    Parameters
    Type Name Description
    int index

    The edge index

    Returns
    Type Description
    Tri

    The adjacent triangle (may be null)

    | Edit this page View Source

    GetCoordinate(int)

    Gets the coordinate for a vertex. This is the start vertex of the edge.

    Declaration
    public Coordinate GetCoordinate(int index)
    Parameters
    Type Name Description
    int index

    The vertex (edge) index

    Returns
    Type Description
    Coordinate

    The vertex coordinate

    | Edit this page View Source

    GetIndex(Coordinate)

    Gets the index of the triangle vertex which has a given coordinate (if any). This is also the index of the edge which originates at the vertex.

    Declaration
    public int GetIndex(Coordinate p)
    Parameters
    Type Name Description
    Coordinate p

    The coordinate to find

    Returns
    Type Description
    int

    The vertex index, or -1 if it is not in the triangle

    | Edit this page View Source

    GetIndex(Tri)

    Gets the edge index which a triangle is adjacent to (if any), based on the adjacent triangle link.

    Declaration
    public int GetIndex(Tri tri)
    Parameters
    Type Name Description
    Tri tri

    The Tri to find

    Returns
    Type Description
    int

    The index of the edge adjacent to the triangle, or -1 if not found

    | Edit this page View Source

    GetLength(int)

    Gets the length of an edge of the triangle.

    Declaration
    public double GetLength(int edgeIndex)
    Parameters
    Type Name Description
    int edgeIndex

    The edge index

    Returns
    Type Description
    double

    The edge length

    | Edit this page View Source

    HasAdjacent()

    Tests if this tri has any adjacent tris.

    Declaration
    public bool HasAdjacent()
    Returns
    Type Description
    bool

    true if there is at least one adjacent tri

    | Edit this page View Source

    HasAdjacent(int)

    Tests if there is an adjacent triangle to an edge.

    Declaration
    public bool HasAdjacent(int index)
    Parameters
    Type Name Description
    int index

    The edge index

    Returns
    Type Description
    bool

    true if there is a triangle adjacent to edge

    | Edit this page View Source

    IsAdjacent(Tri)

    Tests if a triangle is adjacent to some edge of this triangle.

    Declaration
    public bool IsAdjacent(Tri tri)
    Parameters
    Type Name Description
    Tri tri

    The triangle to test

    Returns
    Type Description
    bool

    true if the triangle is adjacent

    | Edit this page View Source

    IsBorder()

    Tests if a tri contains a boundary edge, and thus on the border of the triangulation containing it.

    Declaration
    public bool IsBorder()
    Returns
    Type Description
    bool

    true if the tri is on the border of the triangulation

    | Edit this page View Source

    IsBoundary(int)

    Tests if an edge is on the boundary of a triangulation.

    Declaration
    public bool IsBoundary(int index)
    Parameters
    Type Name Description
    int index

    The index of an edge

    Returns
    Type Description
    bool

    true if the edge is on the boundary

    | Edit this page View Source

    IsInteriorVertex(int)

    Tests if a tri vertex is interior. A vertex of a triangle is interior if it is fully surrounded by other triangles.

    Declaration
    public bool IsInteriorVertex(int index)
    Parameters
    Type Name Description
    int index

    The vertex index

    Returns
    Type Description
    bool

    true if the vertex is interior

    | Edit this page View Source

    MidPoint(int)

    Computes a coordinate for the midpoint of a triangle edge.

    Declaration
    public Coordinate MidPoint(int edgeIndex)
    Parameters
    Type Name Description
    int edgeIndex

    The edge index

    Returns
    Type Description
    Coordinate

    the midpoint of the triangle edge

    | Edit this page View Source

    Next(int)

    Computes the vertex or edge index which is the next one (counter-clockwise) around the triangle.

    Declaration
    public static int Next(int index)
    Parameters
    Type Name Description
    int index

    The index

    Returns
    Type Description
    int

    The next index value

    | Edit this page View Source

    OppEdge(int)

    Gets the index of the edge opposite a vertex.

    Declaration
    public static int OppEdge(int vertexIndex)
    Parameters
    Type Name Description
    int vertexIndex

    The index of the vertex

    Returns
    Type Description
    int

    The index of the opposite edge

    | Edit this page View Source

    OppVertex(int)

    Gets the index of the vertex opposite an edge.

    Declaration
    public static int OppVertex(int edgeIndex)
    Parameters
    Type Name Description
    int edgeIndex

    The edge index

    Returns
    Type Description
    int

    The index of the opposite vertex

    | Edit this page View Source

    Prev(int)

    Computes the vertex or edge index which is the previous one (counter-clockwise) around the triangle.

    Declaration
    public static int Prev(int index)
    Parameters
    Type Name Description
    int index

    The index

    Returns
    Type Description
    int

    The previous index value

    | Edit this page View Source

    Remove()

    Removes this triangle from a triangulation. All adjacent references and the references to this Tri in the adjacent Tris are set to null.

    Declaration
    public void Remove()
    | Edit this page View Source

    Remove(IList<Tri>)

    Removes this tri from the triangulation containing it. All links between the tri and adjacent ones are nulled.

    Declaration
    public void Remove(IList<Tri> triList)
    Parameters
    Type Name Description
    IList<Tri> triList

    The triangulation

    | Edit this page View Source

    SetAdjacent(Coordinate, Tri)

    Sets the triangle adjacent to the edge originating at a given vertex.
    The vertices of the adjacent triangles are assumed to match the appropriate vertices in this triangle.

    Declaration
    public void SetAdjacent(Coordinate pt, Tri tri)
    Parameters
    Type Name Description
    Coordinate pt

    The edge start point

    Tri tri

    The adjacent triangle

    | Edit this page View Source

    SetAdjacent(Tri, Tri, Tri)

    Sets the adjacent triangles.
    The vertices of the adjacent triangles are assumed to match the appropriate vertices in this triangle.

    Declaration
    public void SetAdjacent(Tri tri0, Tri tri1, Tri tri2)
    Parameters
    Type Name Description
    Tri tri0

    The triangle adjacent to edge 0

    Tri tri1

    The triangle adjacent to edge 1

    Tri tri2

    The triangle adjacent to edge 2

    | Edit this page View Source

    SetTri(int, Tri)

    Sets the triangle adjacent to an edge.
    The vertices of the adjacent triangle are assumed to match the appropriate vertices in this triangle.

    Declaration
    public void SetTri(int edgeIndex, Tri tri)
    Parameters
    Type Name Description
    int edgeIndex

    The edge triangle is adjacent to

    Tri tri

    The adjacent triangle

    | Edit this page View Source

    Split(Coordinate)

    Splits a triangle by a point located inside the triangle. Creates the three new resulting triangles with adjacent links set correctly. Returns the new triangle whose 0'th vertex is the splitting point.

    Declaration
    public Tri Split(Coordinate p)
    Parameters
    Type Name Description
    Coordinate p

    The point to insert

    Returns
    Type Description
    Tri

    The new triangle whose 0'th vertex is p

    | Edit this page View Source

    ToGeometry(ICollection<Tri>, GeometryFactory)

    Creates a GeometryCollection of NetTopologySuite.Triangulate.Polygons representing the triangles in a list.

    Declaration
    public static Geometry ToGeometry(ICollection<Tri> tris, GeometryFactory geomFact)
    Parameters
    Type Name Description
    ICollection<Tri> tris

    A collection of Tris

    GeometryFactory geomFact

    The GeometryFactory to use

    Returns
    Type Description
    Geometry

    The Polygons for the triangles

    | Edit this page View Source

    ToPolygon(GeometryFactory)

    Creates a NetTopologySuite.Triangulate.Polygon representing this triangle.

    Declaration
    public Polygon ToPolygon(GeometryFactory geomFact)
    Parameters
    Type Name Description
    GeometryFactory geomFact

    The geometry factory

    Returns
    Type Description
    Polygon

    A polygon

    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    | Edit this page View Source

    Validate()

    Validates that a Tri is correct. Currently just checks that orientation is CW.

    Declaration
    public void Validate()
    Exceptions
    Type Condition
    ArgumentException

    Thrown if Tri is not valid

    | Edit this page View Source

    Validate(IEnumerable<Tri>)

    Validates a list of Tris.

    Declaration
    public static void Validate(IEnumerable<Tri> triList)
    Parameters
    Type Name Description
    IEnumerable<Tri> triList

    The list of Tris to validate

    | Edit this page View Source

    ValidateAdjacent(int)

    Validates that the vertices of an adjacent linked triangle are correct.

    Declaration
    public void ValidateAdjacent(int index)
    Parameters
    Type Name Description
    int index

    The index of the adjacent triangle

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX