Skip to main content

Polyhedron

Client Server

A polyhedron is built from half-spaces. Each half-space is defined by a plane (a point + a normal) and represents “everything on one side of that plane.”

function self:examplePolyhedron(pos)
local dirs = {
Vec3( 1, 0, 0),
Vec3(-1, 0, 0),
Vec3( 0, 1, 0),
Vec3( 0, 0, 1)
}

local sides = {}
for _, n in ipairs(dirs) do
local pl = Vec4()
pl:MakePlane(pos + n, n)
table.insert(sides, pl)
end

local sh = Polyhedron()
sh.sides = sides
return sh
end

Constructors

Polyhedron Polyhedron()

Methods

Vec4 side GetSide(integer index)

nil SetSide(integer index, Vec4 side)

nil BuildWheelTrack(number width, number height, number border, number bevel, Vec3 fromPos, Vec3 toPos, Vec3 fromUp, Vec3 toUp, boolean addDirBevels)

boolean valid, string error IsValid()

Properties

Vec3 pos

Vec4[] sides

the half spaces that make up the polyhedron. Use Vec4:MakePlane(pos, normal) to create a plane.

integer sidesCount