Put each script block next to the associated board div
This commit is contained in:
parent
7a79ed1de0
commit
883e660e7c
6 changed files with 106 additions and 84 deletions
|
@ -10,24 +10,13 @@
|
|||
|
||||
<h1>3D polygon sampler</h1>
|
||||
|
||||
<!-- creating a polygon -->
|
||||
|
||||
<h2>Creating a polygon</h2>
|
||||
<p>A polygon is created from a list of vertices. Each vertex is given either in coordinates or as a <a href="https://jsxgraph.org/docs/symbols/Point3D.html#constructor"><code>Point3D</code></a> element. The vertices that are created from coordinates are styled according to the <code>vertices</code> attribute. The edges of the polygon are styled according to the <code>borders</code> attribute.</p>
|
||||
<p>To make the layout of the vertices easier to see, I’ve set the view’s <code>depthOrderPoints</code> attribute to <code>true</code>.
|
||||
<div id="polygon-homog-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<h2>Mixing coordinates and <code>Point3D</code> elements</h2>
|
||||
<p>This example shows how you can mix coordinates and <a href="https://jsxgraph.org/docs/symbols/Point3D.html#constructor"><code>Point3D</code></a> elements in a polygon’s vertex list.</p>
|
||||
<div id="polygon-mixed-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<h2>Filling a polygon</h2>
|
||||
<p>You can set the fill and opacity of a 3D polygon just like you would with a 2D polygon. I recommend only filling polygons that are guaranteed to stay planar. In this example, the polygons are always planar because they’re triangles.</p>
|
||||
<div id="planar-fill-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<h2>The pitalls of filling a non-planar polygon</h2>
|
||||
<p>Make the polygon below non-planar by dragging its vertices. This will probably make the fill look really weird from certain angles.</p>
|
||||
<div id="non-planar-fill-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<!-- creating a polygon -->
|
||||
<script type="text/javascript">
|
||||
// to prevent variable name conflicts, we define variables locally using `let`
|
||||
// and put the code for each board in its own block
|
||||
|
@ -130,6 +119,11 @@
|
|||
</script>
|
||||
|
||||
<!-- mixing coordinates and Point3D elements -->
|
||||
|
||||
<h2>Mixing coordinates and <code>Point3D</code> elements</h2>
|
||||
<p>This example shows how you can mix coordinates and <a href="https://jsxgraph.org/docs/symbols/Point3D.html#constructor"><code>Point3D</code></a> elements in a polygon’s vertex list.</p>
|
||||
<div id="polygon-mixed-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// to prevent variable name conflicts, we define variables locally using `let`
|
||||
// and put the code for each board in its own block
|
||||
|
@ -223,6 +217,11 @@
|
|||
</script>
|
||||
|
||||
<!-- filling a polygon -->
|
||||
|
||||
<h2>Filling a polygon</h2>
|
||||
<p>You can set the fill and opacity of a 3D polygon just like you would with a 2D polygon. I recommend only filling polygons that are guaranteed to stay planar. In this example, the polygons are always planar because they’re triangles.</p>
|
||||
<div id="planar-fill-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// to prevent variable name conflicts, we define variables locally using `let`
|
||||
// and put the code for each board in its own block
|
||||
|
@ -326,6 +325,11 @@
|
|||
</script>
|
||||
|
||||
<!-- the pitfalls of filling a non-planar polygon -->
|
||||
|
||||
<h2>The pitalls of filling a non-planar polygon</h2>
|
||||
<p>Make the polygon below non-planar by dragging its vertices. This will probably make the fill look really weird from certain angles.</p>
|
||||
<div id="non-planar-fill-board" class="jxgbox" style="width:600px; height:600px"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// to prevent variable name conflicts, we define variables locally using `let`
|
||||
// and put the code for each board in its own block
|
||||
|
@ -400,5 +404,6 @@
|
|||
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue