ts-simple-2d-geometry
v0.0.6
Published
A Simple 2D Geometry Library with Point and Line classes written with TypeScript
Downloads
4
Readme
simple-2d-geometry
A Simple 2D Geometry Library with Point and Line classes written with TypeScript
This projects code is licensed under the terms of the GNU GPL-3.0 license.
to run the library in an example page:
npm run dev
this will start a local server and open the example page in your default browser
here is an excerpt of the code in drawPetal.tsx that creates a 6 petals flower using the Point class from the library.
...
const myAngle = new Angle(angle, 'degrees')
let radius = petalLength * (2 + 2 * Math.cos(petalNumber * myAngle.toRadians()))
let TempPoint = Point.fromPolar(radius, myAngle, `P-${angle}`)
// and move the point so it's centered
TempPoint.moveRel(offsetX,offsetY)
...