Skip to content

BinaryClipping

Overview

Clipping arbitrary (degenerate, non-convex, self-intersecting, etc.) polygons based on binary criteria (e.g. left/right, inside/outside).

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

Class BinaryClipping

import { BinaryClipping } from 'scenerystack/alpenglow';

Static Methods

binaryXClipEdge( startPoint : Vector2, endPoint : Vector2, x : number, fakeCornerY : number, minLinearEdges : LinearEdge[], maxLinearEdges : LinearEdge[] )

binaryYClipEdge( startPoint : Vector2, endPoint : Vector2, y : number, fakeCornerX : number, minLinearEdges : LinearEdge[], maxLinearEdges : LinearEdge[] )

binaryLineClipEdge( startPoint : Vector2, endPoint : Vector2, normal : Vector2, value : number, fakeCornerPerpendicular : number, minLinearEdges : LinearEdge[], maxLinearEdges : LinearEdge[] )

line where dot( normal, point ) - value = 0. "min" side is dot-products < value, "max" side is dot-products > value

binaryXClipPolygon( polygon : Vector2[], x : number, minPolygon : Vector2[], maxPolygon : Vector2[] )

binaryYClipPolygon( polygon : Vector2[], y : number, minPolygon : Vector2[], maxPolygon : Vector2[] )

binaryLineClipPolygon( polygon : Vector2[], normal : Vector2, value : number, minPolygon : Vector2[], maxPolygon : Vector2[] )

line where dot( normal, point ) - value = 0. "min" side is dot-products < value, "max" side is dot-products > value

binaryXClipEdgedClipped( face : EdgedClippedFace, x : number ) : { minFace: EdgedClippedFace; maxFace: EdgedClippedFace }

binaryYClipEdgedClipped( face : EdgedClippedFace, y : number ) : { minFace: EdgedClippedFace; maxFace: EdgedClippedFace }

Type BinaryClipCallback

import type { BinaryClipCallback } from 'scenerystack/alpenglow';

( isMinFace: boolean, startX: number, startY: number, endX: number, endY: number, startPoint: Vector2 | null, endPoint: Vector2 | null ) => void

Type BinaryPolygonCompleteCallback

import type { BinaryPolygonCompleteCallback } from 'scenerystack/alpenglow';

( isMinFace: boolean ) => void

Type PolygonCompleteCallback

import type { PolygonCompleteCallback } from 'scenerystack/alpenglow';

() => void

Source Code

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