Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

PolygonGeometry.Validate

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public PolygonGeometry Validate();

Returns

PolygonGeometry The rebuilt polygon, or an empty geometry when it cannot be rebuilt. See PolygonGeometry.isValid.

Description

Rebuild the polygon from its vertices.

The normals and the centroid are calculated from the vertices, replacing whatever they were set to, and the radius is kept as it is. They must still be finite to begin with, along with the radius and every vertex, because a non-finite value stops the rebuild rather than being replaced. The vertices are replaced by the convex hull of themselves, so a vertex that is concave, duplicated or too close to its neighbor is welded away or dropped. The result can therefore have fewer vertices than the geometry it was rebuilt from.