1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-06-02 02:51:17 +02:00
This commit is contained in:
Justin Lin 2021-02-12 11:28:39 +08:00
parent 7eade29855
commit 226674d30f
3 changed files with 29 additions and 1 deletions

View File

@ -133,7 +133,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
- [sphere_spiral_extrude](https://openhome.cc/eGossip/OpenSCAD/lib2x-sphere_spiral_extrude.html)
### Util
- util/angle_between
- [util/angle_between](https://openhome.cc/eGossip/OpenSCAD/lib3x-angle_between.html)
- [util/bsearch](https://openhome.cc/eGossip/OpenSCAD/lib3x-bsearch.html)
- [util/choose](https://openhome.cc/eGossip/OpenSCAD/lib3x-choose.html)
- [util/dedup](https://openhome.cc/eGossip/OpenSCAD/lib3x-dedup.html)

View File

@ -0,0 +1,18 @@
# angle_between
Returns the angle between two vectors.
**Since:** 3.0
## Parameters
- `vt1` : vector 1.
- `vt2` : vector 2.
## Examples
use <util/angle_between.scad>;
assert(angle_between([0, 1], [1, 0]) == 90);
assert(angle_between([0, 1, 0], [1, 0, 0]) == 90);
assert(round(angle_between([1, 1, 0], [1, 1, sqrt(2)])) == 45);

View File

@ -1 +1,11 @@
/**
* angle_between.scad
*
* @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-angle_between.html
*
**/
function angle_between(vt1, vt2) = acos((vt1 * vt2) / (norm(vt1) * norm(vt2)));