Skip to content

RationalHalfEdge

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/alpenglow/blob/main/js/cag/RationalHalfEdge.ts for the most up-to-date information.

Overview

Represents a half-edge (directed line segment) with rational coordinates.

TODO: add a flag to note "removed half edge"?

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

Class RationalHalfEdge

Instead of storing vertices, we can get away with storing half-edges, with a linked list of next/previous and the opposite half edge. This is like a half-edge winged data structure.

import { RationalHalfEdge } from 'scenerystack/alpenglow';

Constructor

new RationalHalfEdge( edgeId : number, p0 : BigRationalVector2, p1 : BigRationalVector2 )

Instance Methods

windingContribution( x : BigRational, y : BigRational ) : number

See LinearEdge.windingContribution

addWindingFrom( other : RationalHalfEdge )

compare( other : RationalHalfEdge ) : number

addTransformedToAccumulator( accumulator : ClippableFaceAccumulator, fromIntegerMatrix : Matrix3 )

TODO: use in more places

Instance Properties

face : RationalFace | null

nextEdge : RationalHalfEdge | null

previousEdge : RationalHalfEdge | null

boundary : RationalBoundary | null

reversed : RationalHalfEdge

windingMap : WindingMap

discriminator : number

0 for straight +x, 1 for +y, 2 for straight -x, 3 for -y

slope : BigRational

p0float : Vector2

p1float : Vector2

processed

Static Methods

compareBigInt( a : bigint, b : bigint ) : number

quickCompareBigRational( a : BigRational, b : BigRational ) : number

Provides a stable comparison, but this is NOT numerical!!!

quickCompareBigRationalVector2( a : BigRationalVector2, b : BigRationalVector2 ) : number

filterAndConnectHalfEdges( rationalHalfEdges : RationalHalfEdge[] ) : RationalHalfEdge[]

Source Code

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