Skip to content

amoradi/shapen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shapen

experimental

A rudimentary shape library.

Primitives

type Point = { x: number, y: number, z: number };

type Line = [ Point, Point ];

type Vertices = [ Point, Point, Point ];

type Planes = Vertices[];

type Constitution = Point | Vertices | Planes;

Shapes

Circle

  • constitution: Point
  • material: string
  • radius: number

Polygon

  • constitution: Vertices
  • material: string

Adapters

Three JS

CircleToThreeJsAdapter

let myCircle = new Circle(point(0,0,0), "ff0000", 3);
let circle = new CircleToThreeJsAdapter(myCircle).call();

PolygonToThreeJsAdapter

let myPoly = new Polygon([
  point(-2, 0, 0),
  point(-2, -2, 0),
  point(3, -2, 0),
  point(3, 0, 0),
  ], "ffffff");
let poly = new PolygonToThreeJsAdapter(myPoly).call();

Authors

  • Aaron Moradi - Initial work - amoradi

License

MIT, see LICENSE.md for details.