Skip to main content

Module geom

Module geom 

Source
Expand description

Geometry helpers over Build-style sector/wall data.

Conventions: x grows east, y grows south, z grows down. Angles use 2048 units per full turn, 0 = east, 512 = south. One xy unit equals 16 z units.

Structs§

PlaneEq
Linear plane equation z = a + bx * x + by * y for a (possibly sloped) sector plane.

Constants§

ANGLE_UNITS
STAT_SLOPED
Sloped-plane flag in ceiling/floor stat.

Functions§

ang_to_rad
ceil_eq
floor_eq
inside_sector
Even-odd point-in-sector test (handles inner loops).
plane_eq
ray_segment
Ray/segment intersection. Returns (t, s) where the hit point is o + d*t and s in [0,1] is the position along the segment a -> b.
update_sector
Finds the sector containing (x, y), searching neighbours of hint first.
update_sector_z
Like update_sector but also requires z to lie between ceiling and floor.
zs_of_slope
Ceiling and floor z of sector s at point (x, y).