Skip to main content

ConvexHull2DUtils

Functions

convexHull

ConvexHull2DUtils.convexHull(points{Vector2}) → {Vector2}

Computes a convex hull using the gift wrapping algorithm.

https://en.wikipedia.org/wiki/Gift_wrapping_algorithm

isClockWiseTurn

ConvexHull2DUtils.isClockWiseTurn(
p1Vector2,
p2Vector2,
) → boolean

Retrns whether these 3 points are in a clockwise turn

lineIntersect

ConvexHull2DUtils.lineIntersect() → Vector2 | nil

Computes line intersection between vectors

raycast

ConvexHull2DUtils.raycast(
fromVector2,
toVector2,
hull{Vector2}
) → (
Vector2 | nil,
Vector2 | nil,
Vector2 | nil
)

Raycasts from from to to against the convex hull.

Show raw api
{
    "functions": [
        {
            "name": "convexHull",
            "desc": "Computes a convex hull using the gift wrapping algorithm.\n\nhttps://en.wikipedia.org/wiki/Gift_wrapping_algorithm",
            "params": [
                {
                    "name": "points",
                    "desc": "",
                    "lua_type": "{ Vector2 }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Vector2 }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 12,
                "path": "src/convexhull/src/Shared/ConvexHull2DUtils.lua"
            }
        },
        {
            "name": "isClockWiseTurn",
            "desc": "Retrns whether these 3 points are in a clockwise turn",
            "params": [
                {
                    "name": "p1",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "p2",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "p3",
                    "desc": "",
                    "lua_type": "Vector2"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 42,
                "path": "src/convexhull/src/Shared/ConvexHull2DUtils.lua"
            }
        },
        {
            "name": "lineIntersect",
            "desc": "Computes line intersection between vectors",
            "params": [
                {
                    "name": "a",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "b",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "c",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "d",
                    "desc": "",
                    "lua_type": "Vector2"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Vector2 | nil\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 49,
                "path": "src/convexhull/src/Shared/ConvexHull2DUtils.lua"
            }
        },
        {
            "name": "raycast",
            "desc": "Raycasts from `from` to `to` against the convex hull.",
            "params": [
                {
                    "name": "from",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "to",
                    "desc": "",
                    "lua_type": "Vector2"
                },
                {
                    "name": "hull",
                    "desc": "",
                    "lua_type": "{ Vector2 }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Vector2 | nil"
                },
                {
                    "desc": "",
                    "lua_type": "Vector2 | nil"
                },
                {
                    "desc": "",
                    "lua_type": "Vector2 | nil"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 61,
                "path": "src/convexhull/src/Shared/ConvexHull2DUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ConvexHull2DUtils",
    "desc": "",
    "source": {
        "line": 4,
        "path": "src/convexhull/src/Shared/ConvexHull2DUtils.lua"
    }
}