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:math_guide_conversions [2021/05/29 08:22]
JSCAD Editor [Conversions of Radius to Segments]
en:math_guide_conversions [2022/04/16 04:28] (current)
rozek included "require" statements
Line 6: Line 6:
  
 <code javascript> <code javascript>
 +const { degToRad } = require('@jscad/modeling').utils
 let radians = degToRad(90) // PI / 2 radians let radians = degToRad(90) // PI / 2 radians
 </code> </code>
Line 12: Line 13:
  
 <code javascript> <code javascript>
 +const { radToDeg } = require('@jscad/modeling').utils
 let degrees = radToDeg(Math.PI / 2) // 90 degrees let degrees = radToDeg(Math.PI / 2) // 90 degrees
 </code> </code>
Line 17: Line 19:
 ==== Conversions of Radius to Segments ==== ==== Conversions of Radius to Segments ====
  
-Calculate the number of segments from the given radius based on minimum length or angle.+Calculate the number of segments to complete the given radius (full rotation), using either minimum length or minimum angle.
  
 There are various round shapes that support the 'segments' option. However, designs may require a specific 'precision' for specific shapes. For example, an arc as part of a path requires specific length segments for proper laser cutting. There are various round shapes that support the 'segments' option. However, designs may require a specific 'precision' for specific shapes. For example, an arc as part of a path requires specific length segments for proper laser cutting.
Line 23: Line 25:
 This function can be used to calculate the appropriate number of segments based on the radius of the rounded shape. This function can be used to calculate the appropriate number of segments based on the radius of the rounded shape.
  
-//NOTE: The number of segments can become large depending on the 'precision' requirements. Testing designs with lower number of segments is recommended.//+Using the above example, the arc has radius of 3.5 mm (units are typically mm). The laser printer requires 0.1 mm segments or more while moving. The segments can be calculated, and supplied when creating the arc.
  
 <code javascript> <code javascript>
 +const { radiusToSegments } = require('@jscad/modeling').utils
 +
 let segments = radiusToSegments(3.5, 0.1, 0) /* use minimum length */ let segments = radiusToSegments(3.5, 0.1, 0) /* use minimum length */
 let segments = radiusToSegments(3.5, 0, Math.PI * 2 / 300) /* use minimum angle */  let segments = radiusToSegments(3.5, 0, Math.PI * 2 / 300) /* use minimum angle */ 
 </code> </code>
 +
 +//NOTE: The number of segments can become large depending on the 'precision' requirements. Testing designs with a lower number of segments is recommended.//