JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

Elements
Classes

Namespace JXG.Parse3D


      ↳ JXG.Parse3D



Defined in: 3dmodels.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Namespace Parse3D.
Method Summary
Method Attributes Method Name and Description
<static>  
JXG.Parse3D.STL(str)
Parser for the ASCII STL format, see https://en.wikipedia.org/wiki/STL_(file_format).
Namespace Detail
JXG.Parse3D
Namespace Parse3D. Contains parsers for 3D models like STL.
Method Detail
<static> {Array} JXG.Parse3D.STL(str)
Parser for the ASCII STL format, see https://en.wikipedia.org/wiki/STL_(file_format). STL stands for stereo-lithography.
Parameters:
{String} str
String containing STL file format
Returns:
{Array} [[vertices, faces], ...] as list of polyhedra. Each entry is the input for a polyhedron3d.
Examples:
        const board = JXG.JSXGraph.initBoard(
            'jxgbox',
            {
                boundingbox: [-8, 8, 8, -8],
                minimizeReflow: 'svg',
                axis: false,
                showNavigation: false,
                zoom: {
                    enabled: false
                },
                pan: {
                    enabled: false
                }
            }
        );

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

            }
        );

 // Tetrahedron
 var model = `solid m
 facet normal 0 0 0
   outer loop
     vertex 0 0 0
     vertex 1 0 0
     vertex 1 1 0
   endloop
  endfacet
 facet normal 0 0 0
   outer loop
     vertex 0 0 0
     vertex 1 0 0
     vertex 0.5 0.5 1
   endloop
  endfacet
 facet normal 0 0 0
   outer loop
     vertex 0 0 0
     vertex 1 1 0
     vertex 0.5 0.5 1
   endloop
  endfacet
 facet normal 0 0 0
   outer loop
     vertex 1 0 0
     vertex 1 1 0
     vertex 0.5 0.5 1
   endloop
  endfacet
endsolid m`;

var m = JXG.Parse3D.STL(model);

 for (let i = 0; i < m.length; i++) {
     view.create('polyhedron3d', m[i], {
          fillColorArray: [], // ['yellow', 'red', 'green', 'blue'],
          layer: 12,
          strokeWidth: 0,
          shader: {
              enabled: true,
              type: 'angle',
              hue: 0 + 60 * i,
              saturation: 90,
              minlightness: 60,
              maxLightness: 80
          },
          fillOpacity: 0.8
      });
  }


					
					

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Oct 06 2025 17:36:53 GMT+0200 (Mitteleuropäische Sommerzeit)