JSXGraph logo
JSXGraph
Examples Database

Share

3D polyhedron - The Septopert - from STL file
QR code
<iframe 
    src="http://jsxgraph.uni-bayreuth.de/share/iframe/3d-polyhedron-the-septopert-from-stl-file" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: 3D polyhedron - The Septopert - from STL file" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    const board = JXG.board(BOARDID, {
        boundingbox: [-8, 8, 8, -8],
        axis: false,
        showNavigation: false,
        zoom: {
             enabled: false
        },
        pan: {
            enabled: false
        }
    });
    
    const bound = [-10, 10];
    const view = board.create('view3d',
        [[-5, -3], [8, 8],
         [bound, bound, bound]],
        {
            axesPosition: 'none',
            projection: 'central',
            trackball: { enabled: true },
            xPlaneRear: { visible: false },
            yPlaneRear: { visible: false },
            zPlaneRear: { fillOpacity: 0.2, visible: true },
            az: {
                slider: {
                    visible: true,
                    start: 1.54
                }
            }
        });
    
    const model = `solid septopert
      facet normal -0.408248290 -0.408248290 0.816496581
        outer loop
          vertex -7 7 7
          vertex -4 -4 3
          vertex 7 -7 7
        endloop
      endfacet
      facet normal -0.000000000 0.000000000 1.000000000
        outer loop
          vertex -7 7 7
          vertex 7 -7 7
          vertex 7 7 7
        endloop
      endfacet
      facet normal -0.408248290 0.816496581 -0.408248290
        outer loop
          vertex -7 7 7
          vertex 7 7 -7
          vertex -4 3 -4
        endloop
      endfacet
      facet normal -0.000000000 1.000000000 -0.000000000
        outer loop
          vertex -7 7 7
          vertex 7 7 7
          vertex 7 7 -7
        endloop
      endfacet
      facet normal -0.962250449 -0.192450090 -0.192450090
        outer loop
          vertex -7 7 7
          vertex -4 3 -4
          vertex -4 -4 3
        endloop
      endfacet
      facet normal 0.816496581 -0.408248290 -0.408248290
        outer loop
          vertex 7 -7 7
          vertex 3 -4 -4
          vertex 7 7 -7
        endloop
      endfacet
      facet normal 1.000000000 -0.000000000 0.000000000
        outer loop
          vertex 7 -7 7
          vertex 7 7 -7
          vertex 7 7 7
        endloop
      endfacet
      facet normal -0.192450090 -0.962250449 -0.192450090
        outer loop
          vertex 7 -7 7
          vertex -4 -4 3
          vertex 3 -4 -4
        endloop
      endfacet
      facet normal -0.192450090 -0.192450090 -0.962250449
        outer loop
          vertex 7 7 -7
          vertex 3 -4 -4
          vertex -4 3 -4
        endloop
      endfacet
      facet normal -0.577350269 -0.577350269 -0.577350269
        outer loop
          vertex 3 -4 -4
          vertex -4 -4 3
          vertex -4 3 -4
        endloop
      endfacet
    endsolid septopert`;
    
    const m = JXG.Parse3D.STL(model);
    const polyhedron = view.create('polyhedron3d', m[0], {
                    layer: 12,
                    strokeWidth: 1,
                    strokeColor: 'black',
                    shader: {
                        enabled: true,
                        type: 'angle',
                        hue: 0 + 60,
                        saturation: 90,
                        minlightness: 60,
                        maxLightness: 80
                    },
                    fillOpacity: 0.8
                });
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

const board = JXG.board(BOARDID, {
    boundingbox: [-8, 8, 8, -8],
    axis: false,
    showNavigation: false,
    zoom: {
         enabled: false
    },
    pan: {
        enabled: false
    }
});

const bound = [-10, 10];
const view = board.create('view3d',
    [[-5, -3], [8, 8],
     [bound, bound, bound]],
    {
        axesPosition: 'none',
        projection: 'central',
        trackball: { enabled: true },
        xPlaneRear: { visible: false },
        yPlaneRear: { visible: false },
        zPlaneRear: { fillOpacity: 0.2, visible: true },
        az: {
            slider: {
                visible: true,
                start: 1.54
            }
        }
    });

const model = `solid septopert
  facet normal -0.408248290 -0.408248290 0.816496581
    outer loop
      vertex -7 7 7
      vertex -4 -4 3
      vertex 7 -7 7
    endloop
  endfacet
  facet normal -0.000000000 0.000000000 1.000000000
    outer loop
      vertex -7 7 7
      vertex 7 -7 7
      vertex 7 7 7
    endloop
  endfacet
  facet normal -0.408248290 0.816496581 -0.408248290
    outer loop
      vertex -7 7 7
      vertex 7 7 -7
      vertex -4 3 -4
    endloop
  endfacet
  facet normal -0.000000000 1.000000000 -0.000000000
    outer loop
      vertex -7 7 7
      vertex 7 7 7
      vertex 7 7 -7
    endloop
  endfacet
  facet normal -0.962250449 -0.192450090 -0.192450090
    outer loop
      vertex -7 7 7
      vertex -4 3 -4
      vertex -4 -4 3
    endloop
  endfacet
  facet normal 0.816496581 -0.408248290 -0.408248290
    outer loop
      vertex 7 -7 7
      vertex 3 -4 -4
      vertex 7 7 -7
    endloop
  endfacet
  facet normal 1.000000000 -0.000000000 0.000000000
    outer loop
      vertex 7 -7 7
      vertex 7 7 -7
      vertex 7 7 7
    endloop
  endfacet
  facet normal -0.192450090 -0.962250449 -0.192450090
    outer loop
      vertex 7 -7 7
      vertex -4 -4 3
      vertex 3 -4 -4
    endloop
  endfacet
  facet normal -0.192450090 -0.192450090 -0.962250449
    outer loop
      vertex 7 7 -7
      vertex 3 -4 -4
      vertex -4 3 -4
    endloop
  endfacet
  facet normal -0.577350269 -0.577350269 -0.577350269
    outer loop
      vertex 3 -4 -4
      vertex -4 -4 3
      vertex -4 3 -4
    endloop
  endfacet
endsolid septopert`;

const m = JXG.Parse3D.STL(model);
const polyhedron = view.create('polyhedron3d', m[0], {
                layer: 12,
                strokeWidth: 1,
                strokeColor: 'black',
                shader: {
                    enabled: true,
                    type: 'angle',
                    hue: 0 + 60,
                    saturation: 90,
                    minlightness: 60,
                    maxLightness: 80
                },
                fillOpacity: 0.8
            });
<jsxgraph width="100%" aspect-ratio="1 / 1" title="3D polyhedron - The Septopert - from STL file" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution ShareAlike 4.0 International License.
   https://creativecommons.org/licenses/by-sa/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   const board = JXG.board(BOARDID, {
       boundingbox: [-8, 8, 8, -8],
       axis: false,
       showNavigation: false,
       zoom: {
            enabled: false
       },
       pan: {
           enabled: false
       }
   });
   
   const bound = [-10, 10];
   const view = board.create('view3d',
       [[-5, -3], [8, 8],
        [bound, bound, bound]],
       {
           axesPosition: 'none',
           projection: 'central',
           trackball: { enabled: true },
           xPlaneRear: { visible: false },
           yPlaneRear: { visible: false },
           zPlaneRear: { fillOpacity: 0.2, visible: true },
           az: {
               slider: {
                   visible: true,
                   start: 1.54
               }
           }
       });
   
   const model = `solid septopert
     facet normal -0.408248290 -0.408248290 0.816496581
       outer loop
         vertex -7 7 7
         vertex -4 -4 3
         vertex 7 -7 7
       endloop
     endfacet
     facet normal -0.000000000 0.000000000 1.000000000
       outer loop
         vertex -7 7 7
         vertex 7 -7 7
         vertex 7 7 7
       endloop
     endfacet
     facet normal -0.408248290 0.816496581 -0.408248290
       outer loop
         vertex -7 7 7
         vertex 7 7 -7
         vertex -4 3 -4
       endloop
     endfacet
     facet normal -0.000000000 1.000000000 -0.000000000
       outer loop
         vertex -7 7 7
         vertex 7 7 7
         vertex 7 7 -7
       endloop
     endfacet
     facet normal -0.962250449 -0.192450090 -0.192450090
       outer loop
         vertex -7 7 7
         vertex -4 3 -4
         vertex -4 -4 3
       endloop
     endfacet
     facet normal 0.816496581 -0.408248290 -0.408248290
       outer loop
         vertex 7 -7 7
         vertex 3 -4 -4
         vertex 7 7 -7
       endloop
     endfacet
     facet normal 1.000000000 -0.000000000 0.000000000
       outer loop
         vertex 7 -7 7
         vertex 7 7 -7
         vertex 7 7 7
       endloop
     endfacet
     facet normal -0.192450090 -0.962250449 -0.192450090
       outer loop
         vertex 7 -7 7
         vertex -4 -4 3
         vertex 3 -4 -4
       endloop
     endfacet
     facet normal -0.192450090 -0.192450090 -0.962250449
       outer loop
         vertex 7 7 -7
         vertex 3 -4 -4
         vertex -4 3 -4
       endloop
     endfacet
     facet normal -0.577350269 -0.577350269 -0.577350269
       outer loop
         vertex 3 -4 -4
         vertex -4 -4 3
         vertex -4 3 -4
       endloop
     endfacet
   endsolid septopert`;
   
   const m = JXG.Parse3D.STL(model);
   const polyhedron = view.create('polyhedron3d', m[0], {
                   layer: 12,
                   strokeWidth: 1,
                   strokeColor: 'black',
                   shader: {
                       enabled: true,
                       type: 'angle',
                       hue: 0 + 60,
                       saturation: 90,
                       minlightness: 60,
                       maxLightness: 80
                   },
                   fillOpacity: 0.8
               });
</jsxgraph>

3D polyhedron - The Septopert - from STL file

[The Septopert](https://github.com/tom7/noperts/blob/main/septopert.md) is a convex polyhedron with 7 vertices that is not Rupert (a *"nopert"*). Here, it is given in STL format. See the [API reference](https://jsxgraph.org/docs/JXG.Parse3D.html) for reading and writing STL with JSXGraph. What is "Rupert"? According to [Wikipedia](https://en.wikipedia.org/wiki/Prince_Rupert%27s_cube#Rupert_property): A polyhedron $P$ is said to have the *Rupert property* if a polyhedron of the same or larger size and the same shape as $P$ can pass through a hole in $P$.
// Define the id of your board in BOARDID

const board = JXG.board(BOARDID, {
    boundingbox: [-8, 8, 8, -8],
    axis: false,
    showNavigation: false,
    zoom: {
         enabled: false
    },
    pan: {
        enabled: false
    }
});

const bound = [-10, 10];
const view = board.create('view3d',
    [[-5, -3], [8, 8],
     [bound, bound, bound]],
    {
        axesPosition: 'none',
        projection: 'central',
        trackball: { enabled: true },
        xPlaneRear: { visible: false },
        yPlaneRear: { visible: false },
        zPlaneRear: { fillOpacity: 0.2, visible: true },
        az: {
            slider: {
                visible: true,
                start: 1.54
            }
        }
    });

const model = `solid septopert
  facet normal -0.408248290 -0.408248290 0.816496581
    outer loop
      vertex -7 7 7
      vertex -4 -4 3
      vertex 7 -7 7
    endloop
  endfacet
  facet normal -0.000000000 0.000000000 1.000000000
    outer loop
      vertex -7 7 7
      vertex 7 -7 7
      vertex 7 7 7
    endloop
  endfacet
  facet normal -0.408248290 0.816496581 -0.408248290
    outer loop
      vertex -7 7 7
      vertex 7 7 -7
      vertex -4 3 -4
    endloop
  endfacet
  facet normal -0.000000000 1.000000000 -0.000000000
    outer loop
      vertex -7 7 7
      vertex 7 7 7
      vertex 7 7 -7
    endloop
  endfacet
  facet normal -0.962250449 -0.192450090 -0.192450090
    outer loop
      vertex -7 7 7
      vertex -4 3 -4
      vertex -4 -4 3
    endloop
  endfacet
  facet normal 0.816496581 -0.408248290 -0.408248290
    outer loop
      vertex 7 -7 7
      vertex 3 -4 -4
      vertex 7 7 -7
    endloop
  endfacet
  facet normal 1.000000000 -0.000000000 0.000000000
    outer loop
      vertex 7 -7 7
      vertex 7 7 -7
      vertex 7 7 7
    endloop
  endfacet
  facet normal -0.192450090 -0.962250449 -0.192450090
    outer loop
      vertex 7 -7 7
      vertex -4 -4 3
      vertex 3 -4 -4
    endloop
  endfacet
  facet normal -0.192450090 -0.192450090 -0.962250449
    outer loop
      vertex 7 7 -7
      vertex 3 -4 -4
      vertex -4 3 -4
    endloop
  endfacet
  facet normal -0.577350269 -0.577350269 -0.577350269
    outer loop
      vertex 3 -4 -4
      vertex -4 -4 3
      vertex -4 3 -4
    endloop
  endfacet
endsolid septopert`;

const m = JXG.Parse3D.STL(model);
const polyhedron = view.create('polyhedron3d', m[0], {
                layer: 12,
                strokeWidth: 1,
                strokeColor: 'black',
                shader: {
                    enabled: true,
                    type: 'angle',
                    hue: 0 + 60,
                    saturation: 90,
                    minlightness: 60,
                    maxLightness: 80
                },
                fillOpacity: 0.8
            });

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.