mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 22:28:16 +01:00
updated comments
This commit is contained in:
parent
07b4a648dd
commit
ebed0b5292
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* archimedean_spiral.scad
|
* archimedean_spiral.scad
|
||||||
*
|
*
|
||||||
* Gets all points and angles on the path of an archimedean_spiral. The distance between two points is almost constant.
|
* Gets all points and angles on the path of an archimedean spiral. The distance between two points is almost constant.
|
||||||
*
|
*
|
||||||
* It returns a vector of [[x, y], angle].
|
* It returns a vector of [[x, y], angle].
|
||||||
*
|
*
|
||||||
|
@ -1,52 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* archimedean_spiral.scad
|
* golden_spiral.scad
|
||||||
*
|
*
|
||||||
* Gets all points and angles on the path of an archimedean_spiral. The distance between two points is almost constant.
|
* Gets all points and angles on the path of a golden spiral. The distance between two points is almost constant.
|
||||||
*
|
*
|
||||||
* It returns a vector of [[x, y], angle].
|
* It returns a vector of [[x, y], angle].
|
||||||
*
|
|
||||||
* In polar coordinates (r, <EFBFBD>c) Archimedean spiral can be described by the equation r = b<EFBFBD>c where
|
|
||||||
* <EFBFBD>c is measured in radians. For being consistent with OpenSCAD, the function here use degrees.
|
|
||||||
*
|
|
||||||
* An init_angle less than 180 degrees is not recommended because the function uses an approximate
|
|
||||||
* approach. If you really want an init_angle less than 180 degrees, a larger arm_distance
|
|
||||||
* is required. To avoid a small error value at the calculated distance between two points, you
|
|
||||||
* may try a smaller point_distance.
|
|
||||||
*
|
*
|
||||||
* @copyright Justin Lin, 2017
|
* @copyright Justin Lin, 2017
|
||||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
*
|
*
|
||||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib-archimedean_spiral.html
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib-golden_spiral.html
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function _radian_step(b, theta, l) =
|
|
||||||
let(r_square = pow(b * theta, 2))
|
|
||||||
acos((2 * r_square - pow(l, 2)) / (2 * r_square)) / 180 * 3.14159;
|
|
||||||
|
|
||||||
function _find_radians(b, point_distance, radians, n, count = 1) =
|
|
||||||
let(pre_radians = radians[count - 1])
|
|
||||||
count == n ? radians : (
|
|
||||||
_find_radians(
|
|
||||||
b,
|
|
||||||
point_distance,
|
|
||||||
concat(
|
|
||||||
radians,
|
|
||||||
[pre_radians + _radian_step(b, pre_radians, point_distance)]
|
|
||||||
),
|
|
||||||
n,
|
|
||||||
count + 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
In polar coordinates (r, <EFBFBD>c) Archimedean spiral can be described by the equation r = b<EFBFBD>c where
|
|
||||||
<EFBFBD>c is measured in radians. For being consistent with OpenSCAD, the function here use degrees.
|
|
||||||
An init_angle angle less than 180 degrees is not recommended because the function uses an
|
|
||||||
approximate approach. If you really want an angle less than 180 degrees, a larger arm_distance
|
|
||||||
is required. To avoid a small error value at the calculated distance between two points, you
|
|
||||||
may try a smaller point_distance.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function _fast_fibonacci_sub(nth) =
|
function _fast_fibonacci_sub(nth) =
|
||||||
let(
|
let(
|
||||||
_f = _fast_fibonacci_2_elems(floor(nth / 2)),
|
_f = _fast_fibonacci_2_elems(floor(nth / 2)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user