Magnetoculus Visualisation de champs en VR avec Oculus

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
Polygon Class Reference
Inheritance diagram for Polygon:

## Public Member Functions
void | Init (GameObject representation)
List< Vector3 > | GetVertices ()
List< int > | GetBaseTriangles ()
List< Vector2 > | GetUV ()
GameObject | GetRepresentation ()
Vector3 | GetCentroid ()
void | Reset ()
void | AddVertex (Vector3 vertex)
void | AddUV (Vector2 uv)
virtual void | CleanUp ()
bool | PointInside (Vector3 p)
bool | PointInside (Vector2 p2)
void | Triangulate (int verticesOffset=0)
void | AddToMeshInfo (MeshInformation meshInfo)
bool | IsValid ()

## Static Public Member Functions
static Polygon | CreateInstance (GameObject representation)

## Public Attributes
List< Vector2 > | m_Vertices2D

## Protected Attributes
GameObject | m_Representation
List< Vector3 > | m_Vertices
List< Vector2 > | m_UV
List< int > | m_Triangles
List< int > | m_BaseTriangles
Vector3 | m_UX
Vector3 | m_UY

## Detailed Description

The abstraction used in all the generation processes.

## Member Function Documentation

## ◆ AddToMeshInfo()

void Polygon.AddToMeshInfo | ( | MeshInformation | meshInfo | ) |

## ◆ AddUV()

void Polygon.AddUV | ( | Vector2 | uv | ) |

## ◆ AddVertex()

void Polygon.AddVertex | ( | Vector3 | vertex | ) |

## ◆ CleanUp()

virtual void Polygon.CleanUp | ( |  | ) |
| virtual

Cleans up the polygon by removing any possible duplicate vertex and corresponding attributes.

## ◆ CreateInstance()

static Polygon Polygon.CreateInstance | ( | GameObject | representation | ) |
| static

## ◆ GetBaseTriangles()

List<int> Polygon.GetBaseTriangles | ( |  | ) |

## ◆ GetCentroid()

Vector3 Polygon.GetCentroid | ( |  | ) |

## ◆ GetRepresentation()

GameObject Polygon.GetRepresentation | ( |  | ) |

## ◆ GetUV()

List<Vector2> Polygon.GetUV | ( |  | ) |

## ◆ GetVertices()

List<Vector3> Polygon.GetVertices | ( |  | ) |

## ◆ Init()

void Polygon.Init | ( | GameObject | representation | ) |

Init the lists and sets the representation to which the polygon belongs to.

## ◆ IsValid()

bool Polygon.IsValid | ( |  | ) |

## ◆ PointInside() [1/2]

bool Polygon.PointInside | ( | Vector2 | p2 | ) |

Tells whether a point is inside the polygon or not. This assumes the origin to be at the first vertex.

## ◆ PointInside() [2/2]

bool Polygon.PointInside | ( | Vector3 | p | ) |

Tells whether a point is inside the polygon or not. This projects the point onto the polygon first.

## ◆ Reset()

void Polygon.Reset | ( |  | ) |

## ◆ Triangulate()

void Polygon.Triangulate | ( | int | verticesOffset = `0` | ) |

Triangulates the polygon, possibly applying an offset to the triangle indices. Also fills the 2D representation of the polygon. The triangulation is only calculated once then stored in `m_BaseTriangles`. Calling this method several times will only change the offset and store the result in `m_Triangles`.

## Member Data Documentation

## ◆ m_BaseTriangles

List<int> Polygon.m_BaseTriangles
| protected

List of untranslated triangulation indices.

## ◆ m_Representation

GameObject Polygon.m_Representation
| protected

The Representation to which this polygon belongs. This allow to delete the polygon when the representation is deleted.

## ◆ m_Triangles

List<int> Polygon.m_Triangles
| protected

The triangulation of the polygon is necessary to have any kind of display. The GPU needs a list of triangles in addition of the list of vertices.

## ◆ m_UV

List<Vector2> Polygon.m_UV
| protected

The UV of the polygon is a Vector2 per vertex. It will be used by a mesh to map a texture onto the verices.

## ◆ m_UX

Vector3 Polygon.m_UX
| protected

X axis of the 2D base of the polygon.

## ◆ m_UY

Vector3 Polygon.m_UY
| protected

Y axis of the 2D base of the polygon.

## ◆ m_Vertices

List<Vector3> Polygon.m_Vertices
| protected

The vertices of the polygon, stored as Vector3.

## ◆ m_Vertices2D

List<Vector2> Polygon.m_Vertices2D

2D expression of the vertices of the polygon.

The documentation for this class was generated from the following file:

- Assets/Scripts/Representation/Polygon.cs