Skip to content

IntegerEdge

Overview

A line-segment edge with integer coordinates, as part of the rendering

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

Class IntegerEdge

import { IntegerEdge } from 'scenerystack/alpenglow';

Constructor

new IntegerEdge( renderPath : RenderPath, x0 : number, y0 : number, x1 : number, y1 : number )

Instance Methods

hasBoundsIntersectionWith( other : IntegerEdge ) : boolean

Instance Properties

bounds : Bounds2

(readonly)

intersections : RationalIntersection[]

(readonly)

Static Methods

hasBoundsIntersection( boundsA : Bounds2, boundsB : Bounds2, someXEqual : boolean, someYEqual : boolean ) : boolean

If one of the segments is (e.g.) vertical, we'll need to allow checks for overlap ONLY on the x value, otherwise we can have a strict inequality check. This also applies to horizontal segments and the y value. The reason this is OK is because if the segments are both (e.g.) non-vertical, then if the bounds only meet at a single x value (and not a continuos area of overlap), THEN the only intersection would be at the endpoints (which we would filter out and not want anyway).

createTransformed( path : RenderPath, toIntegerMatrix : Matrix3, p0 : Vector2, p1 : Vector2 ) : IntegerEdge | null

clipScaleToIntegerEdges( boundedSubpaths : BoundedSubpath[], bounds : Bounds2, toIntegerMatrix : Matrix3 ) : IntegerEdge[]

Returns a list of integer edges (tagged with their respective RenderPaths) that are clipped to within the given bounds.

Since we also need to apply the to-integer-coordinate-frame conversion at the same time, this step is included.

scaleToIntegerEdges( paths : RenderPath[], toIntegerMatrix : Matrix3 ) : IntegerEdge[]

Returns a list of integer edges (tagged with their respective RenderPaths) that are transformed to within the integer coordinates.

Source Code

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