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
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.