Computational Geometry and Rendering library for JavaScript
version: 1.0.0(80 kB minified)
Examples:
Bounding Boxes
Convex Hulls
Intersections
const{Scene2D,CompositeCurve,ParametricCurve,Ellipse,Circle,Arc,QBezier,CBezier,Line,Polyline,Polygon,Rect,Matrix2D}=Geometrize;
constscene=Scene2D(document.getElementById('container'),0,0,300,300);
constspiral=ParametricCurve((t)=>({x:190+t*50*Math.cos(t*6*Math.PI),y:80+t*50*Math.sin(t*6*Math.PI)}));
constellipse=Ellipse([40,40],30,10,-45);
constcircle=Circle([30,30],20);
constarc=Arc([100,100],[170,90],30,10,30,0,1);
constqbezier=QBezier([[80,110],[120,40],[160,120]]);
constcbezier=CBezier([[40,80],[120,40],[140,200],[160,90]]);
constcurve=CompositeCurve([
Line([20,100],[40,100]),
Arc([40,100],[40,80],10,10,0,0,0),
QBezier([[40,80],[20,100],[60,120]]),
Line([60,120],[70,100])
]).transform(Matrix2D.translate(-20,0));
constline1=Line([20,20],[60,60]).setStyle('stroke','blue');
constline2=Line([50,2],[20,70]).setStyle('stroke','green');
constline3=Line([60,160],[300,0]).setStyle('stroke','orange');
constline4=Line([60,120],[300,-40]).setStyle('stroke','cyan');
letintersections=[];
scene.add(spiral);
scene.add(ellipse);
scene.add(circle);
scene.add(arc);
scene.add(qbezier);
scene.add(cbezier);
scene.add(curve);
scene.add(line1);
scene.add(line2);
scene.add(line3);
scene.add(line4);
intersections=scene.getIntersections();
intersections.forEach(p=>{
scene.add(p.setStyle('stroke','red').setStyle('stroke-width',2));
});
see also:
- Abacusadvanced Combinatorics and Algebraic Number Theory Symbolic Computation library for JavaScript, Python
- TensorViewview array data as multidimensional tensors of various shapes efficiently
- GeometrizeComputational Geometry and Rendering Library for JavaScript
- Plot.jssimple and small library which can plot graphs of functions and various simple charts and can render to Canvas, SVG and plain HTML
- MOD33D Modifier Library in JavaScript
- HAAR.jsimage feature detection based on Haar Cascades in JavaScript (Viola-Jones-Lienhart et al Algorithm)
- HAARPHPimage feature detection based on Haar Cascades in PHP (Viola-Jones-Lienhart et al Algorithm)
- FILTER.jsvideo and image processing and computer vision Library in pure JavaScript (browser and node)
- Xpresiona simple and flexible eXpression parser engine (with custom functions and variables support), based onGrammarTemplate,for PHP, JavaScript, Python
- Regex Analyzer/ComposerRegular Expression Analyzer and Composer for PHP, JavaScript, Python
- GrammarTemplategrammar-based templating for PHP, JavaScript, Python
- codemirror-grammartransform a formal grammar in JSON format into a syntax-highlight parser for CodeMirror editor
- ace-grammartransform a formal grammar in JSON format into a syntax-highlight parser for ACE editor
- prism-grammartransform a formal grammar in JSON format into a syntax-highlighter for Prism code highlighter
- highlightjs-grammartransform a formal grammar in JSON format into a syntax-highlight mode for Highlight.js code highlighter
- syntaxhighlighter-grammartransform a formal grammar in JSON format to a highlight brush for SyntaxHighlighter code highlighter
- SortingAlgorithmsimplementations of Sorting Algorithms in JavaScript
- PatternMatchingAlgorithmsimplementations of Pattern Matching Algorithms in JavaScript
- CanvasLitean html canvas implementation in pure JavaScript
- Rasterizerstroke and fill lines, rectangles, curves and paths, without canvaσ
- Gradientcreate linear, radial, conic and elliptic gradients and image patterns without canvas
- css-colorsimple class to parse and manipulate colors in various formats