mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-16 13:50:05 +01:00
729 B
729 B
has
If lt
contains elem
, this function returns true
. If you want to test elements repeatly, sorting lt
first and setting sorted
to true
will be faster.
Since: 2.3
Parameters
lt
: A list of vectors.elem
: A vector.sorted
: Iffalse
(default), use nativesearch
. Iftrue
,lt
must be sorted by zyx (from the last index to the first one) andhas
will use binary search internally.
Examples
use <voxel/vx_circle.scad>
use <util/sort.scad>
use <util/has.scad>
pts = vx_circle(10);
assert(has(pts, [2, -10]));
assert(!has(pts, [0, 0]));
sorted_pts = sort(pts, by = "vt");
assert(has(sorted_pts, [2, -10]));
assert(!has(sorted_pts, [0, 0]));