Skip to content

Function: clipSegmentToLine() ​

clipSegmentToLine(vOut, vIn, normal, offset, vertexIndexA): number

Clips the segment vIn against the half-plane normal.v <= offset, into vOut, and returns the point count.

Contact ids follow one convention, written as if the reference face were on shape A (the collider swaps them afterwards when it is on B): a point that is an incident vertex k lying on the reference face f carries (f, e_face, k, e_vertex), and a point produced here, the incident edge cut by the side plane at reference vertex j, carries (j, e_vertex, edge, e_face). The two kinds differ in their feature types and two points of one kind differ in their index, so the points of a manifold never share an id; Contact.update relies on that to carry warm-start impulses to the right point.

Parameters ​

vOut ​

ClipVertex[]

vIn ​

ClipVertex[]

normal ​

Vec2Value

offset ​

number

vertexIndexA ​

number

the reference vertex whose side plane this is

Returns ​

number