Class MeshValidation | ProBuilder | 4.3.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class MeshValidation

    Methods for validating and fixing mesh topology.

    Inheritance
    Object
    MeshValidation
    Namespace: UnityEngine.ProBuilder.MeshOperations
    Syntax
    public static class MeshValidation

    Methods

    ContainsDegenerateTriangles(ProBuilderMesh)

    Check if any face on a mesh contains degenerate triangles. A degenerate triangle does not have any area.

    Declaration
    public static bool ContainsDegenerateTriangles(this ProBuilderMesh mesh)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The mesh to test for degenerate triangles.

    Returns
    Type Description
    Boolean

    True if any face contains a degenerate triangle, false if no degenerate triangles are found.

    See Also
    RemoveDegenerateTriangles(ProBuilderMesh, List<Int32>)

    ContainsDegenerateTriangles(ProBuilderMesh, IList<Face>)

    Check if any face contains degenerate triangles. A degenerate triangle does not have any area.

    Declaration
    public static bool ContainsDegenerateTriangles(this ProBuilderMesh mesh, IList<Face> faces)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The mesh to test for degenerate triangles.

    IList<Face> faces

    The faces to test for degenerate triangles.

    Returns
    Type Description
    Boolean

    True if any face contains a degenerate triangle, false if no degenerate triangles are found.

    See Also
    RemoveDegenerateTriangles(ProBuilderMesh, List<Int32>)

    ContainsDegenerateTriangles(ProBuilderMesh, Face)

    Check if any face contains degenerate triangles. A degenerate triangle does not have any area.

    Declaration
    public static bool ContainsDegenerateTriangles(this ProBuilderMesh mesh, Face face)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The mesh to test for degenerate triangles.

    Face face

    The face to test for degenerate triangles.

    Returns
    Type Description
    Boolean

    True if any triangle within the face contains a degenerate triangle, false if no degenerate triangles are found.

    See Also
    RemoveDegenerateTriangles(ProBuilderMesh, List<Int32>)

    ContainsNonContiguousTriangles(ProBuilderMesh, Face)

    Tests that all triangles in a face are connected.

    Declaration
    public static bool ContainsNonContiguousTriangles(this ProBuilderMesh mesh, Face face)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The mesh that owns the face to be tested.

    Face face

    The face to test.

    Returns
    Type Description
    Boolean

    True if the face contains split triangles, false if the face is contiguous.

    EnsureFacesAreComposedOfContiguousTriangles(ProBuilderMesh, IEnumerable<Face>)

    Ensure that each face in faces is composed of contiguous triangle sets. If a face contains non-contiguous triangles, it will be split into as many faces as necessary to ensure that each group of adjacent triangles compose a single face.

    Declaration
    public static List<Face> EnsureFacesAreComposedOfContiguousTriangles(this ProBuilderMesh mesh, IEnumerable<Face> faces)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The mesh that contains the faces to test.

    IEnumerable<Face> faces

    The faces to test for non-contiguous triangles.

    Returns
    Type Description
    List<Face>

    A list of any newly created faces as a result of splitting non-contiguous triangles. Returns an empty list if no faces required fixing.

    RemoveDegenerateTriangles(ProBuilderMesh, List<Int32>)

    Iterates through all faces in a mesh and removes triangles with an area less than float.Epsilon, or with indexes that point to the same vertex. This function also enforces the rule that a face must contain no coincident vertices.

    Declaration
    public static bool RemoveDegenerateTriangles(ProBuilderMesh mesh, List<int> removed = null)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The source mesh.

    List<Int32> removed

    An optional list to be populated with the removed indices. If no degenerate triangles are found, this list will contain no elements.

    Returns
    Type Description
    Boolean

    True if degenerate triangles were found and removed, false if no degenerate triangles were found.

    RemoveUnusedVertices(ProBuilderMesh, List<Int32>)

    Removes vertices that no face references.

    Declaration
    public static bool RemoveUnusedVertices(ProBuilderMesh mesh, List<int> removed = null)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    The source mesh.

    List<Int32> removed

    An optional list to be populated with the removed indices. If no vertices are removed, this list will contain no elements.

    Returns
    Type Description
    Boolean

    A list of deleted vertex indexes.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023