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

Alex Gibson alex at alexgibson.net
Sat Jul 20 21:12:06 EDT 2019

.so that's my problem solved for this time.

But I'm still interested in solving with maths, with the idea of making a
post-processing tool...

Alex Gibson

edumaker limited

.         Project management

.         Operations & Process improvement

.         3D Printing

From: Discuss [mailto:discuss-bounces at lists.openscad.org] On Behalf Of Alex
Gibson
Sent: 21 July 2019 02:05
Subject: Re: [OpenSCAD] Maths problem = finding corners of an intersection
of 2 polygons

Yep - playing the GCODE back in Simplify3D gets a perfect square:

That is:

G92 E0

G1 X378.546 Y352.217

G1 X458.698 Y272.065 E76.6848 ;

G1 X457.434 Y271.615

G1 X384.642 Y252.783

G1 X324.204 Y313.221 E144.1098 ;

G1 X323.103 Y312.381

G1 X379.141 Y252.143

G1 X470.219 Y343.221 E58.8828 ;

G1 X469.321 Y343.146

G1 X403.880 Y370.221

G1 X301.294 Y267.635 E129.3704 ;

; layer 717, Z = 359.250

G1 Z359.250

G1 X382.211 Y348.552

G1 X428.88 Y301.883 E76.6848 ;

G1 X382.211 Y255.214 E144.1098 ;

G1 X335.542 Y301.883 E58.8828 ;

G1 X382.211 Y348.552 E129.3704 ;

Now I just have to make a couple of versions of this, one repeating 3 times
with no extrusion and one just once with extrusion, and jog the printer in
between until I find the perfect offset!

Thanks again

Alex Gibson

edumaker limited

.         Project management

.         Operations & Process improvement

.         3D Printing

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

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.jpg
Type: image/jpeg
Size: 27792 bytes
Desc: not available
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 2166 bytes
Desc: not available