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

Alex Gibson alex at alexgibson.net
Sat Jul 20 20:49:29 EDT 2019

```Fantastic, thanks Torsten, I was just thinking on similar lines...

I remembered an online STL to OpenSCAD converter.

So I did a Linear_extrude of my intersection and got:

Then used this dead useful tool https://jsfiddle.net/Riham/yzvGD/ to get:

module object1(scale) {polyhedron(

points=[[382.211,348.552,0],[428.88,301.883,0],[382.211,255.214,0],[382.211,
348.552,0],[382.211,255.214,0],[335.542,301.883,0],[382.211,255.214,10],[428
.88,301.883,10],[382.211,348.552,10],[335.542,301.883,10],[382.211,255.214,1
0],[382.211,348.552,10],[382.211,348.552,0],[428.88,301.883,10],[428.88,301.
883,0],[382.211,348.552,0],[382.211,348.552,10],[428.88,301.883,10],[335.542
,301.883,0],[382.211,348.552,10],[382.211,348.552,0],[335.542,301.883,0],[33
5.542,301.883,10],[382.211,348.552,10],[382.211,255.214,0],[335.542,301.883,
10],[335.542,301.883,0],[382.211,255.214,0],[382.211,255.214,10],[335.542,30
1.883,10],[428.88,301.883,0],[382.211,255.214,10],[382.211,255.214,0],[428.8
8,301.883,0],[428.88,301.883,10],[382.211,255.214,10] ],

faces=[[0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14],[15,16,17],[18,19,20],[2
1,22,23],[24,25,26],[27,28,29],[30,31,32],[33,34,35]]);}

translate([200,0,0])

object1(1);

Which if I strip it down a bit gets:

module object4(scale) {polyhedron(

points=[[382.211,348.552,0],

[428.88,301.883,0],

[382.211,255.214,0],

[335.542,301.883,0]],

faces=[[0,1,2,3]]);}

object4(1);

.which are exactly the same co-ordinates you got with rounding error of
0.001mm so that's verified nicely via 2 methods!

Thanks very much!!!

Now I can use these co-ordinates to make a GCODE file that plays repeats of
a square movement between those co-ordinates, and finally one that extrudes
plastic for when I think I've jogged X and Y successfully!

Alex Gibson

edumaker limited

. Project management

. Operations & Process improvement

. 3D Printing

-----Original Message-----
From: Discuss [mailto:discuss-bounces at lists.openscad.org] On Behalf Of
Torsten Paul
Sent: 21 July 2019 01:39
Subject: Re: [OpenSCAD] Maths problem = finding corners of an intersection
of 2 polygons

On 21.07.19 02:20, Alex Gibson wrote:

> 2)      A way to get OpenSCAD to output the corner co-ordinates?

Export as SVG, that gives:

M 428.88,-301.882 L 382.211,-348.552 L 335.542,-301.883 L 382.212,-255.214 z

Note that the Y coordinates are negated due to SVG coordinate

system having the origin top left.

ciao,

Torsten.

_______________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 2166 bytes
Desc: not available