UNPKG

verb-nurbs

Version:

A library for creating and manipulating NURBS surfaces and curves in many languages

56 lines (42 loc) 1.91 kB
<!DOCTYPE html> <html> <head> <title>Surface Boundary Curves</title> <script src="js/verb.min.js"></script> <script src="js/three.min.js"></script> <script src="js/verbToThreeConversion.js"></script> <script src="js/OrbitControls.js"></script> <script src="js/codemirror.js"></script> <script src="js/javascript.js"></script> <script src="js/threeBasic.js"></script> <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/codemirror.css"> <link rel="stylesheet" href="css/example.css"> <link rel="stylesheet" href="css/colorforth.css"> </head> <body> <div id="button">Show/Hide Code</div> <div id="viewer" class="col"> <div id="title"></div> </div> <div id="code-container" class="col scroll-y"></div> </body> <script id="script"> setupScene(); var degree = 3 , knots = [0, 0, 0, 0, 0.333, 0.666, 1, 1, 1, 1] , pts = [ [ [0, 0, -10], [10, 0, 0], [20, 0, 0], [30, 0, 0] , [40, 0, 0], [50, 0, 0] ], [ [0, -10, 0], [10, -10, 10], [20, -10, 10], [30, -10, 0] , [40, -10, 0], [50, -10, 0] ], [ [0, -20, 0], [10, -20, 10], [20, -20, 10], [30, -20, 0] , [40, -20, -2], [50, -20, -12] ], [ [0, -30, 0], [10, -30, 0], [20, -30, -23], [30, -30, 0] , [40, -30, 0], [50, -30, 0] ], [ [0, -40, 0], [10, -40, 0], [20, -40, 0], [30, -40, 4] , [40, -40, -20], [50, -40, 0] ], [ [0, -50, 12], [10, -50, 0], [20, -50, 20], [30, -50, 0] , [50, -50, -10], [50, -50, -15] ] ]; var srf = verb.geom.NurbsSurface.byKnotsControlPointsWeights( degree, degree, knots, knots, pts ); srf.boundaries().map(function(x){ addCurveToScene( x.toThreeGeometry() ); }); addMeshToScene( srf.toThreeGeometry() ); renderScene(); </script> <script src="js/example.js"></script> </html>