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:quick_reference_general [2020/11/28 06:00]
JSCAD Editor
en:quick_reference_general [2021/04/08 05:29] (current)
JSCAD Editor
Line 1: Line 1:
-===== General Usage =====+===== General Functions =====
  
-The follow defaults are used when creating rounded shapes. In many cases, the ‘resolution’ can be supplied as an option to functions. +==== Colors ====
-  * **CSG.defaultResolution2D: 32** +
-  * **CSG.defaultResolution3D: 12**+
  
 +The 'colors' are accessed through the modeling API using the following:
  
 +<code javascript>
 +const { colorize, hexToRgb } = require('@jscad/modeling').colors
 +</code>
 +
 +^  Function  ^  Notes  ^
 +| let newshape = colorize([1, 0, 0], oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.colorize | API]]  |
 +| let newshape = colorize(colorNameToRgb('lightblue'), oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.colorNameToRgb | API]]  |
 +| let newshape = colorize(hexToRgb('#000080'), oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.hexToRgb | API]]  |
 +| let newshape = colorize(hslToRgb([0.9166666666666666, 1, 0.5]), oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.hslToRgb | API]]  |
 +| let newshape = colorize(hsvToRgb([0.9166666666666666, 1, 1]), oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.hslToRgb | API]]  |
 +
 +=== Utilities ===
 +
 +The 'utils' are accessed through the modeling API using the following:
 +
 +<code javascript>
 +const { radToDeg, degToRad } = require('@jscad/modeling').utils
 +</code>
 +
 +^  Function  ^  Notes  ^
 +| let radians = degToRad(90)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.degToRad | API]]  |
 +| let degrees = radToDeg(Math.PI)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.radToDeg | API]]  |
 +| let segments = radiusToSegments(3.5, 0.1, 0) /* min length */  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.radiusToSegments | API]]  |
 +| let segments = radiusToSegments(3.5, 0, Math.PI * 2 / 300) /* min angle */  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.radiusToSegments | API]]  |