Pts Docs

This page provides detailed typescript/javascript API documentation of Pts.js. It's intended for advanced users.

If you're getting started, read the guides and check out the demos first.

Organization

Pts classes are organized into modules like this: Modules ⇢ Classes ⇢ Methods & Accessors.
For example, when using ES6 modules, you can access a Pts function this way:

import {Polygon} from "Op";
              ...
              Polygon.centroid( myPts );

If you don't know what this means, don't worry about it. You can also link pts.js in your html and access all the classes directly. See the getting started guide for a quick example.

Overview

Pts provides you with essential building blocks for creative coding and visualization.

  • Pt module provides Pt and Group classes for manipulating points (ie, n-dimensional vectors).
  • Op and Num modules provides various algorithms for numeric and geometric operations.
  • Canvas module provides the corresponding Space and Form classes for html canvas. SVG module provide the same for SVG.
  • Check out other useful modules like Create and Color

{{ contents.name }}

{{ contents.kind }} extends {{ contents.extends.join(", ") }} implements {{ contents.implements.join(", ") }} in {{contents.source[0][0]}}

Constructor

new {{ contents.name }} ( {{ params(m.signatures) }} )

parameters
{{ p.name }}: {{ p.type }} (default value: {{ p.default }})
returns
An instance of {{ contents.name }}
{{se.tag}}
source
Overrides {{ m.overrides }} Inherited from {{ m.inherits }} in {{m.source[0][0]}}

Internal Properties

{{ m.name }}

Overrides {{ m.overrides }} Inherited from {{ m.inherits }} in {{m.source[0][0]}}

{{ m.name }}

Overrides {{ m.overrides }} Inherited from {{ m.inherits }} in {{m.source[0][0]}}

Accessors

GET SET {{ m.name }} : {{ m.getter.type || m.setter.parameters.type || "" }}

Overrides {{ m.overrides }} Inherited from {{ m.inherits }} in {{m.source[0][0]}}

Methods

STATIC {{ m.name }} ( {{ params(m.signatures) }} )

parameters
{{ p.name }}: {{ p.type }} (default value: {{ p.default }})
returns
{{ s.returns }}
{{se.tag}}
source
Overrides {{ m.overrides }} Inherited from {{ m.inherits }} in {{m.source[0][0]}}

Type Alias

equivalent to