[OpenSCAD] Maths problem = finding corners of an intersection of 2 polygons

adrianv avm4 at cornell.edu
Sun Jul 21 00:14:39 EDT 2019


The BOSL2 library has polygon intersection functions, so you can directly
compute the intersection of your polygons in OpenSCAD.  Be warned that it is
not yet a stable library.  

https://github.com/revarbat/BOSL2/wiki/geometry.scad#intersection

include <BOSL2/std.scad>

polygon1 =
[[378.546,352.217],[458.698,272.065],[384.642,252.783],[324.204,313.221]];
polygon2 =
[[379.141,252.143],[470.219,343.221],[403.88,370.221],[301.294,267.635]];

echo(intersection([polygon1],[polygon2]));

The output printed is:

ECHO: [[[382.211, 348.552], [428.88, 301.882], [382.212, 255.213], [335.542,
301.883], [382.211, 348.552]]]




--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list