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_spheroid [2020/11/28 07:09]
JSCAD Editor
en:design_guide_spheroid [2022/04/13 06:51] (current)
rozek included "require" statements, corrected mistake
Line 1: Line 1:
-==== Spheroid ====+==== Ellipsoid ==== 
 + 
 +A three dimensional surface that has three pairwise perpendicular axes of symmetry which intersect at a center. 
 + 
 +{{ :wiki:jscad-ellipsoid.png?nolink | Sphere }} 
 + 
 +The ''radius'' determines the size of the ellipsoid about the X, Y, and Z axis. Ellipsoids can be created at a requested ''center''. The ''segments'' specify the number of segments to create per full rotation. 
 + 
 +Defaults: 
 +  * radius : [1, 1, 1] 
 +  * center : [0, 0, 0] 
 +  * segments : 32 
 + 
 +<code javascript> 
 +const { ellipsoid } = require('@jscad/modeling').primitives 
 + 
 +const myshape = ellipsoid({radius: [5, 10, 20]}) 
 +const myshape = ellipsoid({radius: [5, 10, 20], center: [5, 5, 5], segments: 64}) 
 +</code> 
 + 
 +=== Sphere ===
  
 A three dimensional shape like a ball, where every point on the surface is the same distance from the center. A three dimensional shape like a ball, where every point on the surface is the same distance from the center.
  
-{{ :wiki:mathisfun-sphere.svg?nolink | Sphere }}+{{ :wiki:jscad-sphere.png?nolink | Sphere }}
  
 //[[http://www.mathsisfun.com/geometry/sphere.html|Learn about spheres at MathIsFun.com]]// //[[http://www.mathsisfun.com/geometry/sphere.html|Learn about spheres at MathIsFun.com]]//
  
-Creates a sphere at the requested center. The radius argument determines the size of the sphere. The resolution option determines the number of segments to create in 360 degrees of rotation. +The ''radius'' determines the size of the sphere. Spheres can be created at a requested ''center''. The ''segments'' specify the number of segments to create per full rotation.
- +
-//Note: See the start of 3D Primitives for information about the resolution of three dimenional shapes.//+
  
 Defaults: Defaults:
-  * radius : 1 or [1,1,1] +  * radius : 1 
-  * center : [0,0,0] +  * center : [0, 0, 0] 
-  * resolution Resolution3D (12)+  * segments 32
  
 <code javascript> <code javascript>
-sphere(1); +const { sphere } = require('@jscad/modeling').primitives 
-sphere({r: 2});                    // Note: center:true is default (unlike other primitives, as OpenSCAD) + 
-sphere({r2, center: true});     // Note: OpenSCAD doesn't support center for sphere but we do +const myshape = sphere({radius3.5}) 
-sphere({r2, center: [falsefalsetrue]}); // individual axis center  +const myshape = sphere({radius3.5, center: [555], segments64})
-sphere({r: 10fn100 }); +
-sphere({r: 10, fn: 100, type: 'geodesic'});  // geodesic approach (icosahedron further triangulated)+
 </code> </code>
  
-In case of ``type: 'geodesic'`` the fn tries to match the non-geodesic fn, yet, actually changes in steps of 6 (e.g. fn=6..11 is the same), fn 1 reveals the base form: the icosahedron.+=== Geodesic Sphere ===
  
-The CSG library functions can also be used//NOTE Deprecated in the V2 API//+{{ :wiki:jscad-geodesicSphere.png?nolink | Geodesic Sphere }} 
 + 
 +A three dimensional shape formed by a convex polyhedron consisting of triangles. The base form is the icosahedron polyhedron with 20 faces 
 + 
 +The ''radius'' determines the size of the sphere. The ''frequency'' specifies the division of each face. A frequency of one (1) reveals the base form, icosahedron. 
 + 
 +Defaults: 
 +  * radius : 1 
 +  * frequency : 6
  
 <code javascript> <code javascript>
-CSG.sphere({ +const { geodesicSphere } = require('@jscad/modeling').primitives 
-  center[00, 0], + 
-  radius2,                      // must be scalar +const myshape = geodesicSphere({radius15frequency18}) // frequency should be a multiple of 6
-  resolution: 128 +
-});+
 </code> </code>