mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Corrected modang() example.
This commit is contained in:
parent
3284950b3b
commit
f3c70d3741
1 changed files with 6 additions and 6 deletions
12
math.scad
12
math.scad
|
@ -602,12 +602,12 @@ function posmod(x,m) =
|
||||||
// Description:
|
// Description:
|
||||||
// Takes an angle in degrees and normalizes it to an equivalent angle value between -180 and 180.
|
// Takes an angle in degrees and normalizes it to an equivalent angle value between -180 and 180.
|
||||||
// Example:
|
// Example:
|
||||||
// a1 = modang(-700,360); // Returns: 20
|
// a1 = modang(-700); // Returns: 20
|
||||||
// a2 = modang(-270,360); // Returns: 90
|
// a2 = modang(-270); // Returns: 90
|
||||||
// a3 = modang(-120,360); // Returns: -120
|
// a3 = modang(-120); // Returns: -120
|
||||||
// a4 = modang(120,360); // Returns: 120
|
// a4 = modang(120); // Returns: 120
|
||||||
// a5 = modang(270,360); // Returns: -90
|
// a5 = modang(270); // Returns: -90
|
||||||
// a6 = modang(700,360); // Returns: -20
|
// a6 = modang(700); // Returns: -20
|
||||||
function modang(x) =
|
function modang(x) =
|
||||||
assert( is_finite(x), "Input must be a finite number.")
|
assert( is_finite(x), "Input must be a finite number.")
|
||||||
let(xx = posmod(x,360)) xx<180? xx : xx-360;
|
let(xx = posmod(x,360)) xx<180? xx : xx-360;
|
||||||
|
|
Loading…
Reference in a new issue