class MAGES::MeshDeformations::UtilitiesHelper

Overview

A helper class that provides various utility functions for mesh manipulation and mathematical computations. More…

class UtilitiesHelper: public MonoBehaviour
{
public:
    // structs

    struct Elem;
    struct LineSegment;

    // classes

    class Duo;
    class Hexahedron;
    class Quadruplets;
    class SVNode;
    class Triplets;
    class Vector3ApproximateEqualityComparer;

    // properties

    UtilitiesHelper Get;

    // methods

    static float Vector2Cross(Vector2 a, Vector2 b);

    static bool IsPointInTriangle(
        in Vector2 p,
        in Vector2 a,
        in Vector2 b,
        in Vector2 c
    );

    static Vector4 Three_Points_To_Plane(Vector3 p1, Vector3 p2, Vector3 p3);

    static bool ThreePlaneIntersection(
        in Plane p0,
        in Plane p1,
        in Plane p2,
        out Vector3 intersectionPoint
    );

    static Vector4 Plane_Perpendicular_To_Plane(
        Vector4 tear_plane,
        Vector3 v1,
        Vector3 v2
    );

    static void DrawBounds(
        Bounds bounds,
        Matrix4x4 transform,
        Color color,
        float duration,
        bool zTest = true
    );

    static Vector3 Random_Point_On_Plane(Vector4 plane);

    static Vector3 Point_Point_Plane_Intersection(
        Vector3 p1,
        Vector3 p2,
        Vector4 plane
    );

    static float Point_Vs_Plane(Vector3 point, Vector4 plane);
    static Vector4 Plane_Euc_From_Coordinates(Vector3 n, float D);
    static Vector3 Projection_Point_To_Plane(Vector3 n, Vector3 A, Vector3 p);
    static int Orient_3D(Vector3 a, Vector3 b, Vector3 c, Vector3 d);
    static void Apply_Skinning_To_Triangles(SkinnedMeshRenderer skin, Mesh mesh);
    static void Apply_Skinning_To_Triangles_1(SkinnedMeshRenderer skin, Mesh mesh);

    static Vector3[] Revert_Skinning_To_Triangles(
        SkinnedMeshRenderer skin,
        Mesh mesh
    );

    static Vector3[] Revert_Skinning_To_Triangles_1(
        SkinnedMeshRenderer skin,
        Mesh mesh
    );

    static Vector3 Rotate_Point_Around_Pivot(
        Vector3 point,
        Vector3 pivot,
        Vector3 angles
    );

    static Vector3 Rotate_Point_Around_Pivot(
        Vector3 point,
        Vector3 pivot,
        Quaternion rotation
    );

    static Vector3[] Restore_Mesh_Rotation(SkinnedMeshRenderer skin, Mesh mesh);

    static void Retrieve_Mesh_Position(
        MonoBehaviour mb,
        ref List newVertices
    );

    static void Restore_Mesh_Position(
        Transform transform,
        ref List newVertices
    );

    static void Retrieve_Scale_Mesh_Vertices(
        MonoBehaviour mb,
        ref Vector3[] newVertices
    );

    static void Restore_Scale_Mesh_Vertices(
        Transform transform,
        ref Vector3[] newVertices
    );

    static void Transform_Points_To_World_Position(
        Transform transform,
        ref Vector3[] vertices
    );

    static void Transform_Points_To_Local_Position(
        Transform transform,
        ref Vector3[] vertices
    );

    static Mesh Copy_Mesh(Mesh mesh);
    static ? Bounds GetGameObjectBounds(GameObject gameObject);
    static bool IsPointWithinCollider(Collider collider, Vector3 point);
    static bool IsPointWithinGameObject(GameObject gameObject, Vector3 point);
    static Vector4 PointNormalToCartesian(Vector3 point, Vector3 normal);

    static Vector4 BoundedPlaneToWorldSpaceCartesian(
        BoundedPlane plane,
        Transform transform
    );

    static float Distance_Between_Points(Vector3 a, Vector3 b);
    static Vector3 Find_Middle_Point(Vector3 a, Vector3 b);
    static Vector2 Sort2(Vector2 a);
    static bool Nearly_Equal(float a, float b, float epsilon);
    static float[] Find_Roots(float K, float M, float N);
    static float Horner(float[] coefficients, float x);
    static bool Same_Side(Vector3 p1, Vector3 p2, Vector3 a, Vector3 b);
    static bool Point_In_Triangle(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
};

Detailed Documentation

A helper class that provides various utility functions for mesh manipulation and mathematical computations.

Properties

UtilitiesHelper Get

Gets the singleton instance of UtilitiesHelper.

Methods

static ? Bounds GetGameObjectBounds(GameObject gameObject)

Returns the amalgamation of all the colliders present in the gameobject’s children, and itself.

Parameters:

gameObject

The gameobject.

Returns:

The holistic bounds of the gameobject.

static Vector4 PointNormalToCartesian(Vector3 point, Vector3 normal)

Convert Point-Normal form to plane equation (cartesian form)

static Vector4 BoundedPlaneToWorldSpaceCartesian(
    BoundedPlane plane,
    Transform transform
)

Convert BoundedPlane to plane equation (in world space)