JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31118
  • Score
    100M100P100Q147838F
  • License BSD

A collection of classes used in affine geometry

Package Exports

  • kld-affine
  • kld-affine/lib/Point2D

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kld-affine) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

kld-affine

A collection of classes used in affine geometry. This currently consists of the following:

  • Point2D
  • Vector2D
  • Matrix2D

These have been extracted from kld-intersections so they can stand alone. As such, there are some parts of the API that I want to remove, but I will need to update kld-intersections before being able to do that. Specifically, I would like to remove all self-mutable methods in preference of a more functional approach that creates a new instance with each modification.

Install

npm install kld-affine

Point2D

A class used to represent two-dimensional points on a plane. This currently supports the following methods:

  • clone
  • add
  • addEquals - deprecated
  • rmoveTo - deprecated
  • scalarAdd
  • scalarAddEquals - deprecated
  • subtract
  • subtractEquals - deprecated
  • scalarSubtract
  • scalarSubtractEquals - deprecated
  • multiply
  • multiplyEquals - deprecated
  • divide
  • divideEquals - deprecated
  • compare
  • equals
  • lerp
  • distanceFrom
  • min
  • max
  • toString
  • setXY - deprecated
  • setFromPoint - deprecated
  • swap - deprecated

Vector2D

A class used to represent a two-dimensional vector. This currently supports the following methods:

  • length
  • dot
  • cross
  • unit
  • unitEquals - deprecated
  • add
  • addEquals - deprecated
  • subtract
  • subtractEquals - deprecated
  • multiply
  • multiplyEquals - deprecated
  • divide
  • divideEquals - deprecated
  • perp
  • perpendicular
  • project
  • equals
  • toString
  • Vector2D.fromPoints

Matrix2D

A class used to represent affine transformations. This current supports the following methods:

  • multiply
  • inverse
  • translate
  • scale
  • scaleNonUniform
  • rotate
  • rotateFromVector
  • flipX
  • flipY
  • skewX
  • skewY
  • equals
  • toString