Skip to content

Vertex

Overview

Represents a point in space that connects to edges. It stores the edges that are connected (directionally as half-edges since Cubic segments can start and end at the same point/vertex), and can handle sorting edges so that a half-edge's "next" half-edge (following counter-clockwise) can be determined.

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

Class Vertex

import { Vertex } from 'scenerystack/kite';

Instance Methods

initialize( point )

Similar to a usual constructor, but is set up so it can be called multiple times (with dispose() in-between) to support pooling. @private

@param {Vector2} point @returns {Vertex} - This reference for chaining

serialize()

Returns an object form that can be turned back into a segment with the corresponding deserialize method. @public

@returns {Object}

dispose()

Removes references (so it can allow other objects to be GC'ed or pooled), and frees itself to the pool so it can be reused. @public

sortEdges()

Sorts the edges in increasing angle order. @public

freeToPool()

@public

Static Methods

edgeComparison( halfEdgeA, halfEdgeB )

Compare two edges for sortEdges. Should have executed that first, as it relies on information looked up in that process. @public

@param {Edge} halfEdgeA @param {Edge} halfEdgeB @returns {number}

Static Properties

pool : Pool

@public

Source Code

See the source for Vertex.js in the kite repository.