Skip to content

Vertex

Under Construction

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

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

serialize() : SerializedVertex

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

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.

sortEdges()

Sorts the edges in increasing angle order.

freeToPool()

Instance Properties

id : number

(readonly)

point : Vector2

NOTE: created in initialize. Certain things may be null when disposed (in pool)

incidentHalfEdges : HalfEdge[]

Records the half-edge that points to (ends at) this vertex.

visited

Used for depth-first search

visitIndex

Visit index for bridge detection (more efficient to have inline here)

lowIndex

Low index for bridge detection (more efficient to have inline here)

data : IntentionalAny

Available for arbitrary client usage. -- Keep JSONable

Static Methods

edgeComparison( halfEdgeA : HalfEdge, halfEdgeB : HalfEdge ) : number

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

Static Properties

pool : Pool

Type SerializedVertex

import type { SerializedVertex } from 'scenerystack/kite';
  • type: "Vertex"
  • id: number
  • point: Vector2StateObject
  • incidentHalfEdges: number[]
  • visited: boolean
  • visitIndex: number
  • lowIndex: number

Source Code

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