/ src / in_shape.scad
in_shape.scad
 1  /**
 2  * in_shape.scad
 3  *
 4  * @copyright Justin Lin, 2019
 5  * @license https://opensource.org/licenses/lgpl-3.0.html
 6  *
 7  * @see https://openhome.cc/eGossip/OpenSCAD/lib3x-in_shape.html
 8  *
 9  **/
10  
11  use <__comm__/__lines_from.scad>
12  use <_impl/_in_shape_impl.scad>
13  
14  function in_shape(shapt_pts, pt, include_edge = false, epsilon = 0.0001) = 
15      let(
16          leng = len(shapt_pts),
17          edges = __lines_from(shapt_pts, true)
18      )
19      _in_any_edges(edges, pt, epsilon) ? include_edge : 
20      _in_shape_sub(shapt_pts, leng, pt, _does_pt_cross(shapt_pts[leng - 1], shapt_pts[0], pt));