Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

crossing_fraction_q12_i32

Function crossing_fraction_q12_i32 

Source
pub fn crossing_fraction_q12_i32(
    first_distance: i32,
    second_distance: i32,
) -> i32
Expand description

Q12 fraction for a crossing whose signed endpoint distances straddle zero.

Callers canonicalise the geometric endpoint order before calling this helper. That makes two faces which visit a shared edge in opposite directions produce the same fixed-point fraction and therefore the same clipped vertex. The division deliberately truncates: it is the cheapest R3000 policy and matches HL-PSX’s crack-free reference implementation.