Dynamic Water Physics 2
Search Results for

    Show / Hide Table of Contents

    Class GeometryUtils

    Utility class for geometric calculations used in buoyancy simulation. Provides methods for calculating centroids, areas, and surface-weighted centers of triangles and quadrilaterals.

    Inheritance
    object
    GeometryUtils
    Namespace: NWH.DWP2
    Assembly: NWH.DWP2.dll
    Syntax
    public static class GeometryUtils

    Methods

    | Edit this page View Source

    CalculateCentroid(Vector3, Vector3, Vector3, Vector3)

    Calculates the centroid of a quadrilateral defined by four points.

    Declaration
    public static Vector3 CalculateCentroid(Vector3 pointA, Vector3 pointB, Vector3 pointC, Vector3 pointD)
    Parameters
    Type Name Description
    Vector3 pointA

    First corner point.

    Vector3 pointB

    Second corner point.

    Vector3 pointC

    Third corner point.

    Vector3 pointD

    Fourth corner point.

    Returns
    Type Description
    Vector3

    The centroid position of the quadrilateral.

    | Edit this page View Source

    CalculateQuadrilateralArea(Vector3, Vector3, Vector3, Vector3)

    Calculates the surface area of a quadrilateral by dividing it into two triangles.

    Declaration
    public static float CalculateQuadrilateralArea(Vector3 pointA, Vector3 pointB, Vector3 pointC, Vector3 pointD)
    Parameters
    Type Name Description
    Vector3 pointA

    First corner point.

    Vector3 pointB

    Second corner point.

    Vector3 pointC

    Third corner point.

    Vector3 pointD

    Fourth corner point.

    Returns
    Type Description
    float

    Total surface area of the quadrilateral.

    | Edit this page View Source

    CalculateSurfaceWeightedCenter(Vector3, Vector3, Vector3, Vector3)

    Calculates the surface-weighted center of a quadrilateral. The center is weighted by the area of the two triangles that make up the quadrilateral.

    Declaration
    public static Vector3 CalculateSurfaceWeightedCenter(Vector3 pointA, Vector3 pointB, Vector3 pointC, Vector3 pointD)
    Parameters
    Type Name Description
    Vector3 pointA

    First corner point.

    Vector3 pointB

    Second corner point.

    Vector3 pointC

    Third corner point.

    Vector3 pointD

    Fourth corner point.

    Returns
    Type Description
    Vector3

    The surface-weighted center position.

    | Edit this page View Source

    CalculateTriangleArea(Vector3, Vector3, Vector3)

    Calculates the surface area of a triangle using the cross product method.

    Declaration
    public static float CalculateTriangleArea(Vector3 pointA, Vector3 pointB, Vector3 pointC)
    Parameters
    Type Name Description
    Vector3 pointA

    First vertex of the triangle.

    Vector3 pointB

    Second vertex of the triangle.

    Vector3 pointC

    Third vertex of the triangle.

    Returns
    Type Description
    float

    Surface area of the triangle.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics