Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions examplesES/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# verb

<strong>verb</strong> is a library for creating and manipulating NURBS surfaces and curves in many languages including JavaScript.

These examples use the JavaScript import declaration to load Three.js, <strong>verb</strong> and WebWorker modules (libraries).

Each example is kept as simple as possible, creating surfaces, curves, etc.

The examples include specific functions which convert from VERB geometry to Three.js geometry,
and then render the Three.js geometry.

See the 'js' folder.

Please read through the examples if interested in specific VERB supplied functionality.

Because of CORS, these examples must be provided by a webserver. If you open one of the HTML files and see "Cross-Origin Request Blocked" then you will understand.

The easiest HTTP server is provided by NPM.

```
cd examplesES
npx http-server
```

And follow the instructions to open one of the HTML pages.

69 changes: 69 additions & 0 deletions examplesES/conics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>

<head>
<title>Conics</title>

<script async src="https://cdn.jsdelivr.net/npm/[email protected]/dist/es-module-shims.min.js"></script>

<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"verb": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"web-worker": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"tessellate": "./js/tessellateThree.js",
"scene": "./js/sceneThree.js",
"codeViewer": "./js/codeViewer.js"
}
}
</script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/atom-one-dark.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>

<link rel="stylesheet" href="css/example.css">
</head>

</body>
<div id="viewer">
<div id="title"></div>
</div>

<script type="module" id="script">
import verb from 'verb'
import { tessellateCurve } from 'tessellate'
import { Scene } from 'scene'

const scene = new Scene()

let arc = new verb.geom.Arc( [0,0,0], [1,0,0], [0,1,0], 5, 0, 3* Math.PI/2 )
let circle = new verb.geom.Circle( [12,0,0], [1,0,0], [0,1,0], 5 )
let ellipse = new verb.geom.Ellipse( [24,0,0], [5,0,0], [0,2,0] )
let ellipseArc = new verb.geom.EllipseArc( [36,0,0], [5,0,0], [0,2,0], 0, 3* Math.PI/2 )
let parabola = new verb.geom.BezierCurve( [[43,5,0], [48,-10,0], [51,5,0]] )

scene.addCurve( tessellateCurve( arc ) )
scene.addCurve( tessellateCurve( circle ) )
scene.addCurve( tessellateCurve( ellipse ) )
scene.addCurve( tessellateCurve( ellipseArc ) )
scene.addCurve( tessellateCurve( parabola ) )

scene.render()
</script>

<div id="button">Show/Hide Code</div>
<pre><code id="code-container" class="language-javascript"></code></pre>

<script type='module'>
import { setupViewer } from 'codeViewer'

setupViewer()

hljs.highlightAll()
</script>

</body>

</html>
Loading