meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:design_guide_polyhedron [2020/11/29 06:23]
JSCAD Editor
en:design_guide_polyhedron [2022/04/13 06:57] (current)
rozek included "require" statement
Line 7: Line 7:
 //[[http://www.mathsisfun.com/geometry/polyhedron.html|Learn about polyhedrons at MathIsFun.com]]// //[[http://www.mathsisfun.com/geometry/polyhedron.html|Learn about polyhedrons at MathIsFun.com]]//
  
-Create a polyhedron from a list of 'points' and a list of 'faces'. The 'points' list all the vertexes of the shape, while the 'faces' define the 'pointsused within each face. Note: The order of the points must be consistent, defining 'inward' or 'outward' facing polygons.+Create a polyhedron from a list of ''points'' and a list of ''faces''. The ''points'' list all the vertexes of the shape, while the ''faces'' define the points used within each face. 
 + 
 +//Note: The order of the points must be consistent, defining 'inward' or 'outward' facing polygons.//
  
 <code javascript> <code javascript>
-let points = [ [10, 10, 0], [10, -10, 0], [-10, -10, 0], [-10, 10, 0], [0, 0, 10] ] +const { polyhedron } = require('@jscad/modeling').primitives 
-let faces = [ [0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3] ] + 
-let myshape = polyhedron({points, faces, orientation: 'inward'})+const points = [ [10, 10, 0], [10, -10, 0], [-10, -10, 0], [-10, 10, 0], [0, 0, 10] ] 
 +const faces = [ [0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3] ] 
 +const myshape = polyhedron({points, faces, orientation: 'inward'})
 </code> </code>