Class WingedEdge
Represents a boundary edge where three faces meet. It holds references to:
- The Face connected to this edge
- An EdgeLookup for finding coincident vertices on this edge
- The previous and next winged edges in its triangle
- The common (coincident) winged edge, called the 'opposite' edge
Implements
Inherited Members
Namespace: UnityEngine.ProBuilder
Assembly: Unity.ProBuilder.dll
Syntax
public sealed class WingedEdge : IEquatable<WingedEdge>
Examples
. / (face) /
. prev / / next
. / edge /
. /_ _ _ _ _ _ _/
. |- - - - - - -|
. | opposite |
. | |
. | |
. | |
Properties
edge
Gets the local and shared edge that this edge belongs to.
Declaration
public EdgeLookup edge { get; }
Property Value
Type | Description |
---|---|
EdgeLookup |
face
Gets the connected face that this wing belongs to.
Declaration
public Face face { get; }
Property Value
Type | Description |
---|---|
Face |
next
Gets the WingedEdge that is connected to the edge.y
vertex.
Declaration
public WingedEdge next { get; }
Property Value
Type | Description |
---|---|
WingedEdge |
opposite
Gets the WingedEdge that is on the "opposite" side of this edge.
Declaration
public WingedEdge opposite { get; }
Property Value
Type | Description |
---|---|
WingedEdge |
previous
Gets the WingedEdge that is connected to the edge.x
vertex.
Declaration
public WingedEdge previous { get; }
Property Value
Type | Description |
---|---|
WingedEdge |
Methods
Count()
Returns the number of edges connected in this sequence.
Declaration
public int Count()
Returns
Type | Description |
---|---|
int | The number of WingedEdges found with the WingedEdge.next property. |
Equals(object)
Tests to see whether the specified object is equal to the local edge, disregarding other values.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The WingedEdge to compare against. |
Returns
Type | Description |
---|---|
bool | True if the local edges are equal, false if not. |
Overrides
Equals(WingedEdge)
Tests to see whether the specified Edge is equal to the local edge, disregarding other values.
Declaration
public bool Equals(WingedEdge other)
Parameters
Type | Name | Description |
---|---|---|
WingedEdge | other | The WingedEdge to compare against. |
Returns
Type | Description |
---|---|
bool | True if the local edges are equal, false if not. |
GetAdjacentEdgeWithCommonIndex(int)
Returns WingedEdge.previous or WingedEdge.next if it contains the specified common (shared) index.
Declaration
public WingedEdge GetAdjacentEdgeWithCommonIndex(int common)
Parameters
Type | Name | Description |
---|---|---|
int | common | The common index to search next and previous for. |
Returns
Type | Description |
---|---|
WingedEdge | The next or previous WingedEdge that contains common; or null if not found. |
GetHashCode()
Returns the hash code for this edge.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | WingedEdge comparison only considers the local edge. As such, this returns the local edge hashcode. |
Overrides
GetSpokes(List<WingedEdge>)
Returns a dictionary of common indices and all WingedEdge values that touch each common index.
Declaration
public static Dictionary<int, List<WingedEdge>> GetSpokes(List<WingedEdge> wings)
Parameters
Type | Name | Description |
---|---|---|
List<WingedEdge> | wings | The list of WingedEdges to search. |
Returns
Type | Description |
---|---|
Dictionary<int, List<WingedEdge>> | A dictionary where each key is a common index mapped to a list of each winged edge that touches it. |
GetWingedEdges(ProBuilderMesh, bool)
Creates a new list of WingedEdge values from all faces on the specified ProBuilder mesh.
Declaration
public static List<WingedEdge> GetWingedEdges(ProBuilderMesh mesh, bool oneWingPerFace = false)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the faces to analyze. |
bool | oneWingPerFace | Set this parameter to true to restrict the list to include only one WingedEdge per face. The default value is false. |
Returns
Type | Description |
---|---|
List<WingedEdge> | A new list of WingedEdge values gathered from the ProBuilderMesh.faces. |
GetWingedEdges(ProBuilderMesh, IEnumerable<Face>, bool)
Creates a new list of WingedEdge values from a specific set of faces on the specified ProBuilder mesh.
Declaration
public static List<WingedEdge> GetWingedEdges(ProBuilderMesh mesh, IEnumerable<Face> faces, bool oneWingPerFace = false)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the faces to analyze. |
IEnumerable<Face> | faces | The collection of faces to include in the WingedEdge list. |
bool | oneWingPerFace | Set this parameter to true to restrict the list to include only one WingedEdge per face. The default value is false. |
Returns
Type | Description |
---|---|
List<WingedEdge> | A new list of WingedEdge values gathered from the specified faces. |
SortEdgesByAdjacency(List<Edge>)
Sorts the specified list of edges by adjacency, such that each edge's common Y value matches the next edge's common X value.
Declaration
public static void SortEdgesByAdjacency(List<Edge> edges)
Parameters
Type | Name | Description |
---|---|---|
List<Edge> | edges | The edges to sort in-place. |
SortEdgesByAdjacency(Face)
Orders a face's edges in sequence, starting from the first edge.
Declaration
public static List<Edge> SortEdgesByAdjacency(Face face)
Parameters
Type | Name | Description |
---|---|---|
Face | face | The source face. |
Returns
Type | Description |
---|---|
List<Edge> | A new set of edges where each edge's Y value matches the next edge's X value. |
ToString()
Returns a string representation of the winged edge.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String formatted as follows:
|