meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
en:math_guide_conversions [2020/11/29 07:25] JSCAD Editor created |
en:math_guide_conversions [2022/04/16 04:28] (current) rozek included "require" statements |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Conversions ===== | ===== Conversions ===== | ||
| - | degToRad | + | ==== Conversions between Degrees and Radians ==== |
| - | radToDeg | + | Convert the given angle (degrees) to radians. |
| - | radiusToSegments | + | <code javascript> |
| + | const { degToRad } = require(' | ||
| + | let radians = degToRad(90) // PI / 2 radians | ||
| + | </ | ||
| + | Convert the given angle (radians) to degrees. | ||
| + | |||
| + | <code javascript> | ||
| + | const { radToDeg } = require(' | ||
| + | let degrees = radToDeg(Math.PI / 2) // 90 degrees | ||
| + | </ | ||
| + | |||
| + | ==== Conversions of Radius to Segments ==== | ||
| + | |||
| + | 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 ' | ||
| + | |||
| + | This function can be used to calculate the appropriate number of segments based on the radius of the rounded shape. | ||
| + | |||
| + | Using the above example, the arc has a 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> | ||
| + | const { radiusToSegments } = require(' | ||
| + | |||
| + | let segments = radiusToSegments(3.5, | ||
| + | let segments = radiusToSegments(3.5, | ||
| + | </ | ||
| + | |||
| + | //NOTE: The number of segments can become large depending on the ' | ||