Skip to content

LineClipping

Overview

General purpose line-clipping algorithms

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class LineClipping

import { LineClipping } from 'scenerystack/alpenglow';

Static Methods

matthesDrakopoulosClip( p0 : Vector2, p1 : Vector2, minX : number, minY : number, maxX : number, maxY : number ) : boolean

From "Another Simple but Faster Method for 2D Line Clipping" (2019) by Dimitrios Matthes and Vasileios Drakopoulos

This will: - mutate the given points, so that they are clipped to the given axis-aligned bounding box, and - return whether the line segment intersects the bounds

Source Code

See the source for LineClipping.ts in the alpenglow repository.