Struct Edge
An edge connecting two vertices. May point to an index in the vertices or the sharedIndexes array (local / common in ProBuilder terminology).
Syntax
[Serializable]
public struct Edge : IEquatable<Edge>
Constructors
Edge(Int32, Int32)
Create a new edge from two vertex indexes.
Declaration
public Edge(int a, int b)
Parameters
Type |
Name |
Description |
Int32 |
a |
An index corresponding to a mesh vertex array.
|
Int32 |
b |
An index corresponding to a mesh vertex array.
|
Fields
a
Declaration
Field Value
Type |
Description |
Int32 |
An index corresponding to a mesh vertex array.
|
b
Declaration
Field Value
Type |
Description |
Int32 |
An index corresponding to a mesh vertex array.
|
Empty
Declaration
public static readonly Edge Empty
Field Value
Type |
Description |
Edge |
An empty edge is defined as -1, -1.
|
Methods
Add(Edge, Edge)
Add two edges index values.
Declaration
public static Edge Add(Edge a, Edge b)
Parameters
Type |
Name |
Description |
Edge |
a |
Left edge parameter.
|
Edge |
b |
Right edge parameter.
|
Returns
Type |
Description |
Edge |
The sum of a + b.
|
Examples
{0, 1} + {4, 5} = {5, 6}
Contains(Int32)
Does this edge contain an index?
Declaration
public bool Contains(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
The index to compare against x and y.
|
Returns
Type |
Description |
Boolean |
True if x or y is equal to a. False if not.
|
Contains(Edge)
Does this edge have any matching index to edge b?
Declaration
public bool Contains(Edge other)
Parameters
Type |
Name |
Description |
Edge |
other |
The edge to compare against.
|
Returns
Type |
Description |
Boolean |
True if x or y matches either b.x or b.y.
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Overrides
Equals(Edge)
Declaration
public bool Equals(Edge other)
Parameters
Type |
Name |
Description |
Edge |
other |
|
Returns
Equals(Edge, Dictionary<Int32, Int32>)
Compares edges and takes shared triangles into account.
Declaration
public bool Equals(Edge other, Dictionary<int, int> lookup)
Parameters
Type |
Name |
Description |
Edge |
other |
The edge to compare against.
|
Dictionary<Int32, Int32> |
lookup |
A common vertex indexes lookup dictionary. See pb_IntArray for more information.
|
Returns
Type |
Description |
Boolean |
True if edges are perceptually equal (that is, they point to the same common indexes).
|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
IsValid()
Test if this edge points to valid vertex indexes.
Declaration
Returns
Type |
Description |
Boolean |
True if x and y are both greater than -1.
|
Subtract(Edge, Edge)
Declaration
public static Edge Subtract(Edge a, Edge b)
Parameters
Type |
Name |
Description |
Edge |
a |
The edge to subtract from.
|
Edge |
b |
The value to subtract.
|
Returns
Type |
Description |
Edge |
The sum of a - b.
|
Examples
Subtract( {7, 10}, {4, 5} ) = {3, 5}
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
Addition(Edge, Int32)
Declaration
public static Edge operator +(Edge a, int b)
Parameters
Returns
Addition(Edge, Edge)
Declaration
public static Edge operator +(Edge a, Edge b)
Parameters
Returns
Equality(Edge, Edge)
Declaration
public static bool operator ==(Edge a, Edge b)
Parameters
Returns
Inequality(Edge, Edge)
Declaration
public static bool operator !=(Edge a, Edge b)
Parameters
Returns
Subtraction(Edge, Int32)
Declaration
public static Edge operator -(Edge a, int b)
Parameters
Returns
Subtraction(Edge, Edge)
Declaration
public static Edge operator -(Edge a, Edge b)
Parameters
Returns