C4 Engine
C4 Engine API Documentation

Calc::ClipSegment

Defined in:  C4Computation.h
Clips a line segment against a plane.
Prototype

bool ClipSegment(Point3D *p1, Point3D *p2, const Plane3D& clippingPlane);

Parameters
p1 A pointer to the first endpoint of the line segment.
p2 A pointer to the second endpoint of the line segment.
clippingPlane The plane against which the line segment is clipped.
Description
The ClipSegment function clips the line segment specified by the p1 and p2 parameters against the plane specified by the clippingPlane parameter. Any portion of the line segment that falls on the negative side of the clipping plane is removed, and the endpoints of the clipped segment are returned by replacing the values pointed to by the p1 and p2 parameters. If both endpoints lie on the negative side of the clipping plane, then this function returns false, and the endpoints are not modified. If either one of the endpoints lies on the positive side of the plane (or on the plane itself), then this function returns true.