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/12/01 23:51]
JSCAD Editor [Colors]
en:quick_reference_general [2021/04/08 05:29] (current)
JSCAD Editor
Line 10: Line 10:
  
 ^  Function  ^  Notes  ^ ^  Function  ^  Notes  ^
-| let newshape = colorize([1, 0, 0], oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.colorize | API]]  | +| let newshape = colorize([1, 0, 0], oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.colorize | API]]  | 
-| let rgbcolor = colorNameToRgb('lightblue' | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.colorNameToRgb | 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 === === 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]]  |