Skip to content

Loop

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/Loop.ts for the most up-to-date information.

Overview

A directed set of half-edges determined by how the original shapes/subpaths were directionally. This is distinct from boundaries, as: 1. Input shapes/subpaths can self-intersect, ignore clockwise restrictions, and avoid boundary restrictions. 2. Input shapes/subpaths can repeat over the same edges multiple times (affecting winding order), and can even double-back or do other operations. 3. We need to record separate shape IDs for the different loops, so we can perform CAG operations on separate ones. This means we need to track winding order separately for each ID.

As operations simplify/remove/replace edges, it will handle replacement of the edges in the loops.

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

Class Loop

import { Loop } from 'scenerystack/kite';

Instance Methods

serialize() : SerializedLoop

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.

freeToPool()

Instance Properties

id : number

(readonly)

shapeId

Set in initialize

closed

halfEdges : HalfEdge[]

Static Properties

pool : Pool

Type SerializedLoop

import type { SerializedLoop } from 'scenerystack/kite';
  • type: "Loop"
  • id: number
  • shapeId: number
  • closed: boolean
  • halfEdges: number[]

Source Code

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