UConn Computational Geometry

View My GitHub Profile

Compugeom.GitHub.io by compugeom

CG_DynamicPointSet

Description

A collection of vertices added by mouse clicks on the canvas.

Constructor

CG_DynamicPointSet()

Attributes

[CG_Vertex] VertexList An array of vertices in the point set.
function updateFunction A function that is run on each new point when added to the point set.

Functions

CG_Vertex newPoint(Number x, Number y) Creates a new CG_Vertex with coordinates x,y and, if defined, runs updateFunction on the new vertex.
CG_Vertex whichVertex(Number x, Number y) Checks if there is already a vertex with coordinates x,y in the point set.
null mousePressed() Calls whichVertex() on the current mouse location. If there is no vertex at this location, call newPoint() on the current mouse lcoation.