difference / tesselate-monkey Goto Github PK
View Code? Open in Web Editor NEWPoly earclipper that deals with holes. Draw lines and polylines with linewidth and miter/bevel joints
Poly earclipper that deals with holes. Draw lines and polylines with linewidth and miter/bevel joints
I'm busy with a simple collision polygon check, but after reading I must convert all non convex polygons to convex polygons first.
http://www.monkey-x.com/Community/posts.php?topic=9835
That image at that forum is not a convex polygon right ?
So I will need to create the triangles using the outline (verts[] below), (I have all the corners if needed)
When I'm using that in mojo (not mojo2) I get exactly the same points (outline) using this.
Method Create:Void()
itris = MakeIndexedTriangles([CleanUpPolygon(TheVertsBelow)])
End
Method Draw:Void()
SetColor(255,0,0)
For Local i:Int = 0 Until itris.points.Length() Step 2
DrawPoint(itris.points[i],itris.points[i+1])
Next
End
Is that correct ?
That I get exactly the same outline, I have the feeling I don't see the correct thing ?
The next part is the collision part, but that is working then I guess haha.
Full line
TheVertsBelow:Float[] = [22.0,130.0,23.0,130.0,24.0,130.0,25.0,130.0,26.0,130.0,27.0,130.0,28.0,130.0,29.0,130.0,30.0,130.0,31.0,130.0,31.0,129.0,31.0,128.0,31.0,127.0,31.0,126.0,31.0,125.0,31.0,124.0,31.0,123.0,31.0,122.0,31.0,121.0,31.0,120.0,31.0,119.0,31.0,118.0,31.0,117.0,31.0,116.0,31.0,115.0,31.0,114.0,31.0,113.0,31.0,112.0,31.0,111.0,31.0,110.0,31.0,109.0,31.0,108.0,31.0,107.0,31.0,106.0,31.0,105.0,31.0,104.0,31.0,103.0,31.0,102.0,31.0,101.0,31.0,100.0,31.0,99.0,31.0,98.0,31.0,97.0,31.0,96.0,31.0,95.0,31.0,94.0,31.0,93.0,31.0,92.0,31.0,91.0,31.0,90.0,31.0,89.0,31.0,88.0,31.0,87.0,31.0,86.0,31.0,85.0,31.0,84.0,31.0,83.0,31.0,82.0,31.0,81.0,31.0,80.0,31.0,79.0,31.0,78.0,31.0,77.0,31.0,76.0,31.0,75.0,31.0,74.0,31.0,73.0,31.0,72.0,31.0,71.0,31.0,70.0,31.0,69.0,31.0,68.0,31.0,67.0,31.0,66.0,31.0,65.0,31.0,64.0,31.0,63.0,31.0,62.0,31.0,61.0,31.0,60.0,31.0,59.0,31.0,58.0,31.0,57.0,31.0,56.0,31.0,55.0,31.0,54.0,31.0,53.0,31.0,52.0,31.0,51.0,31.0,50.0,31.0,49.0,31.0,48.0,31.0,47.0,31.0,46.0,31.0,45.0,32.0,45.0,33.0,45.0,34.0,45.0,35.0,45.0,36.0,45.0,37.0,45.0,38.0,45.0,39.0,45.0,40.0,45.0,41.0,45.0,42.0,45.0,43.0,45.0,44.0,45.0,45.0,45.0,46.0,45.0,47.0,45.0,48.0,45.0,49.0,45.0,50.0,45.0,51.0,45.0,52.0,45.0,53.0,45.0,54.0,45.0,55.0,45.0,56.0,45.0,57.0,45.0,58.0,45.0,59.0,45.0,60.0,45.0,61.0,45.0,62.0,45.0,63.0,45.0,64.0,45.0,65.0,45.0,66.0,45.0,67.0,45.0,68.0,45.0,69.0,45.0,70.0,45.0,71.0,45.0,72.0,45.0,73.0,45.0,74.0,45.0,75.0,45.0,76.0,45.0,77.0,45.0,78.0,45.0,79.0,45.0,80.0,45.0,81.0,45.0,82.0,45.0,83.0,45.0,84.0,45.0,85.0,45.0,86.0,45.0,87.0,45.0,88.0,45.0,89.0,45.0,90.0,45.0,91.0,45.0,92.0,45.0,93.0,45.0,94.0,45.0,95.0,45.0,96.0,45.0,97.0,45.0,98.0,45.0,99.0,45.0,100.0,45.0,101.0,45.0,102.0,45.0,103.0,45.0,104.0,45.0,105.0,45.0,106.0,45.0,107.0,45.0,108.0,45.0,109.0,45.0,110.0,45.0,111.0,45.0,112.0,45.0,113.0,45.0,114.0,45.0,115.0,45.0,116.0,45.0,117.0,45.0,118.0,45.0,119.0,45.0,120.0,45.0,121.0,45.0,122.0,45.0,123.0,45.0,124.0,45.0,125.0,45.0,126.0,45.0,127.0,45.0,128.0,45.0,129.0,45.0,130.0,45.0,131.0,45.0,132.0,45.0,133.0,45.0,134.0,45.0,135.0,45.0,136.0,45.0,137.0,45.0,138.0,45.0,139.0,45.0,140.0,45.0,141.0,45.0,142.0,45.0,143.0,45.0,144.0,45.0,145.0,45.0,146.0,45.0,147.0,45.0,148.0,45.0,149.0,45.0,150.0,45.0,151.0,45.0,152.0,45.0,153.0,45.0,154.0,45.0,155.0,45.0,156.0,45.0,157.0,45.0,158.0,45.0,159.0,45.0,160.0,45.0,161.0,45.0,162.0,45.0,163.0,45.0,164.0,45.0,165.0,45.0,166.0,45.0,167.0,45.0,168.0,45.0,169.0,45.0,170.0,45.0,171.0,45.0,172.0,45.0,173.0,45.0,174.0,45.0,175.0,45.0,176.0,45.0,177.0,45.0,178.0,45.0,179.0,45.0,180.0,45.0,181.0,45.0,182.0,45.0,183.0,45.0,184.0,45.0,185.0,45.0,186.0,45.0,187.0,45.0,188.0,45.0,189.0,45.0,190.0,45.0,191.0,45.0,192.0,45.0,193.0,45.0,194.0,45.0,195.0,45.0,196.0,45.0,197.0,45.0,198.0,45.0,199.0,45.0,200.0,45.0,201.0,45.0,202.0,45.0,203.0,45.0,204.0,45.0,205.0,45.0,206.0,45.0,207.0,45.0,208.0,45.0,209.0,45.0,210.0,45.0,210.0,46.0,210.0,47.0,210.0,48.0,210.0,49.0,210.0,50.0,210.0,51.0,210.0,52.0,210.0,53.0,210.0,54.0,210.0,55.0,210.0,56.0,210.0,57.0,210.0,58.0,210.0,59.0,210.0,60.0,210.0,61.0,210.0,62.0,210.0,63.0,210.0,64.0,210.0,65.0,210.0,66.0,210.0,67.0,210.0,68.0,210.0,69.0,210.0,70.0,210.0,71.0,210.0,72.0,210.0,73.0,210.0,74.0,210.0,75.0,210.0,76.0,210.0,77.0,210.0,78.0,210.0,79.0,210.0,80.0,210.0,81.0,210.0,82.0,210.0,83.0,210.0,84.0,210.0,85.0,210.0,86.0,210.0,87.0,210.0,88.0,210.0,89.0,210.0,90.0,210.0,91.0,210.0,92.0,210.0,93.0,210.0,94.0,210.0,95.0,210.0,96.0,210.0,97.0,210.0,98.0,210.0,99.0,210.0,100.0,210.0,101.0,210.0,102.0,210.0,103.0,210.0,104.0,210.0,105.0,210.0,106.0,210.0,107.0,210.0,108.0,210.0,109.0,210.0,110.0,210.0,111.0,210.0,112.0,210.0,113.0,210.0,114.0,210.0,115.0,210.0,116.0,210.0,117.0,210.0,118.0,210.0,119.0,210.0,120.0,210.0,121.0,210.0,122.0,210.0,123.0,210.0,124.0,210.0,125.0,210.0,126.0,210.0,127.0,210.0,128.0,210.0,129.0,210.0,130.0,211.0,130.0,212.0,130.0,213.0,130.0,214.0,130.0,215.0,130.0,216.0,130.0,217.0,130.0,218.0,130.0,219.0,130.0,219.0,129.0,219.0,128.0,219.0,127.0,219.0,126.0,219.0,125.0,219.0,124.0,219.0,123.0,219.0,122.0,219.0,121.0,219.0,120.0,219.0,119.0,219.0,118.0,219.0,117.0,219.0,116.0,219.0,115.0,219.0,114.0,219.0,113.0,219.0,112.0,219.0,111.0,219.0,110.0,219.0,109.0,219.0,108.0,219.0,107.0,219.0,106.0,219.0,105.0,219.0,104.0,219.0,103.0,219.0,102.0,219.0,101.0,219.0,100.0,219.0,99.0,219.0,98.0,219.0,97.0,219.0,96.0,219.0,95.0,219.0,94.0,219.0,93.0,219.0,92.0,219.0,91.0,219.0,90.0,219.0,89.0,219.0,88.0,219.0,87.0,219.0,86.0,219.0,85.0,219.0,84.0,219.0,83.0,219.0,82.0,219.0,81.0,219.0,80.0,219.0,79.0,219.0,78.0,219.0,77.0,219.0,76.0,219.0,75.0,219.0,74.0,219.0,73.0,219.0,72.0,219.0,71.0,219.0,70.0,219.0,69.0,219.0,68.0,219.0,67.0,219.0,66.0,219.0,65.0,219.0,64.0,219.0,63.0,219.0,62.0,219.0,61.0,219.0,60.0,219.0,59.0,219.0,58.0,219.0,57.0,219.0,56.0,219.0,55.0,219.0,54.0,219.0,53.0,219.0,52.0,219.0,51.0,219.0,50.0,219.0,49.0,219.0,48.0,219.0,47.0,219.0,46.0,219.0,45.0,220.0,45.0,221.0,45.0,222.0,45.0,223.0,45.0,224.0,45.0,225.0,45.0,226.0,45.0,227.0,45.0,228.0,45.0,229.0,45.0,230.0,45.0,231.0,45.0,232.0,45.0,233.0,45.0,234.0,45.0,235.0,45.0,236.0,45.0,237.0,45.0,238.0,45.0,239.0,45.0,240.0,45.0,240.0,44.0,240.0,43.0,240.0,42.0,240.0,41.0,240.0,40.0,240.0,39.0,240.0,38.0,240.0,37.0,240.0,36.0,240.0,35.0,240.0,34.0,240.0,33.0,240.0,32.0,240.0,31.0,240.0,30.0,240.0,29.0,240.0,28.0,240.0,27.0,240.0,26.0,240.0,25.0,240.0,24.0,240.0,23.0,240.0,22.0,240.0,21.0,240.0,20.0,240.0,19.0,240.0,18.0,240.0,17.0,240.0,16.0,240.0,15.0,240.0,14.0,240.0,13.0,240.0,12.0,240.0,11.0,240.0,10.0,240.0,9.0,240.0,8.0,240.0,7.0,240.0,6.0,240.0,5.0,240.0,4.0,240.0,3.0,240.0,2.0,240.0,1.0,239.0,1.0,238.0,1.0,237.0,1.0,236.0,1.0,235.0,1.0,234.0,1.0,233.0,1.0,232.0,1.0,231.0,1.0,230.0,1.0,229.0,1.0,228.0,1.0,227.0,1.0,226.0,1.0,225.0,1.0,224.0,1.0,223.0,1.0,222.0,1.0,221.0,1.0,220.0,1.0,219.0,1.0,218.0,1.0,217.0,1.0,216.0,1.0,215.0,1.0,214.0,1.0,213.0,1.0,212.0,1.0,211.0,1.0,210.0,1.0,209.0,1.0,208.0,1.0,207.0,1.0,206.0,1.0,205.0,1.0,204.0,1.0,203.0,1.0,202.0,1.0,201.0,1.0,200.0,1.0,199.0,1.0,198.0,1.0,197.0,1.0,196.0,1.0,195.0,1.0,194.0,1.0,193.0,1.0,192.0,1.0,191.0,1.0,190.0,1.0,189.0,1.0,188.0,1.0,187.0,1.0,186.0,1.0,185.0,1.0,184.0,1.0,183.0,1.0,182.0,1.0,181.0,1.0,180.0,1.0,179.0,1.0,178.0,1.0,177.0,1.0,176.0,1.0,175.0,1.0,174.0,1.0,173.0,1.0,172.0,1.0,171.0,1.0,170.0,1.0,169.0,1.0,168.0,1.0,167.0,1.0,166.0,1.0,165.0,1.0,164.0,1.0,163.0,1.0,162.0,1.0,161.0,1.0,160.0,1.0,159.0,1.0,158.0,1.0,157.0,1.0,156.0,1.0,155.0,1.0,154.0,1.0,153.0,1.0,152.0,1.0,151.0,1.0,150.0,1.0,149.0,1.0,148.0,1.0,147.0,1.0,146.0,1.0,145.0,1.0,144.0,1.0,143.0,1.0,142.0,1.0,141.0,1.0,140.0,1.0,139.0,1.0,138.0,1.0,137.0,1.0,136.0,1.0,135.0,1.0,134.0,1.0,133.0,1.0,132.0,1.0,131.0,1.0,130.0,1.0,129.0,1.0,128.0,1.0,127.0,1.0,126.0,1.0,125.0,1.0,124.0,1.0,123.0,1.0,122.0,1.0,121.0,1.0,120.0,1.0,119.0,1.0,118.0,1.0,117.0,1.0,116.0,1.0,115.0,1.0,114.0,1.0,113.0,1.0,112.0,1.0,111.0,1.0,110.0,1.0,109.0,1.0,108.0,1.0,107.0,1.0,106.0,1.0,105.0,1.0,104.0,1.0,103.0,1.0,102.0,1.0,101.0,1.0,100.0,1.0,99.0,1.0,98.0,1.0,97.0,1.0,96.0,1.0,95.0,1.0,94.0,1.0,93.0,1.0,92.0,1.0,91.0,1.0,90.0,1.0,89.0,1.0,88.0,1.0,87.0,1.0,86.0,1.0,85.0,1.0,84.0,1.0,83.0,1.0,82.0,1.0,81.0,1.0,80.0,1.0,79.0,1.0,78.0,1.0,77.0,1.0,76.0,1.0,75.0,1.0,74.0,1.0,73.0,1.0,72.0,1.0,71.0,1.0,70.0,1.0,69.0,1.0,68.0,1.0,67.0,1.0,66.0,1.0,65.0,1.0,64.0,1.0,63.0,1.0,62.0,1.0,61.0,1.0,60.0,1.0,59.0,1.0,58.0,1.0,57.0,1.0,56.0,1.0,55.0,1.0,54.0,1.0,53.0,1.0,52.0,1.0,51.0,1.0,50.0,1.0,49.0,1.0,48.0,1.0,47.0,1.0,46.0,1.0,45.0,1.0,44.0,1.0,43.0,1.0,42.0,1.0,41.0,1.0,40.0,1.0,39.0,1.0,38.0,1.0,37.0,1.0,36.0,1.0,35.0,1.0,34.0,1.0,33.0,1.0,32.0,1.0,31.0,1.0,30.0,1.0,29.0,1.0,28.0,1.0,27.0,1.0,26.0,1.0,25.0,1.0,24.0,1.0,23.0,1.0,22.0,1.0,21.0,1.0,20.0,1.0,19.0,1.0,18.0,1.0,17.0,1.0,16.0,1.0,15.0,1.0,14.0,1.0,13.0,1.0,12.0,1.0,11.0,1.0,10.0,1.0,9.0,1.0,8.0,1.0,7.0,1.0,6.0,1.0,5.0,1.0,4.0,1.0,3.0,1.0,2.0,1.0,1.0,1.0,1.0,2.0,1.0,3.0,1.0,4.0,1.0,5.0,1.0,6.0,1.0,7.0,1.0,8.0,1.0,9.0,1.0,10.0,1.0,11.0,1.0,12.0,1.0,13.0,1.0,14.0,1.0,15.0,1.0,16.0,1.0,17.0,1.0,18.0,1.0,19.0,1.0,20.0,1.0,21.0,1.0,22.0,1.0,23.0,1.0,24.0,1.0,25.0,1.0,26.0,1.0,27.0,1.0,28.0,1.0,29.0,1.0,30.0,1.0,31.0,1.0,32.0,1.0,33.0,1.0,34.0,1.0,35.0,1.0,36.0,1.0,37.0,1.0,38.0,1.0,39.0,1.0,40.0,1.0,41.0,1.0,42.0,1.0,43.0,1.0,44.0,1.0,45.0,2.0,45.0,3.0,45.0,4.0,45.0,5.0,45.0,6.0,45.0,7.0,45.0,8.0,45.0,9.0,45.0,10.0,45.0,11.0,45.0,12.0,45.0,13.0,45.0,14.0,45.0,15.0,45.0,16.0,45.0,17.0,45.0,18.0,45.0,19.0,45.0,20.0,45.0,21.0,45.0,22.0,45.0,22.0,46.0,22.0,47.0,22.0,48.0,22.0,49.0,22.0,50.0,22.0,51.0,22.0,52.0,22.0,53.0,22.0,54.0,22.0,55.0,22.0,56.0,22.0,57.0,22.0,58.0,22.0,59.0,22.0,60.0,22.0,61.0,22.0,62.0,22.0,63.0,22.0,64.0,22.0,65.0,22.0,66.0,22.0,67.0,22.0,68.0,22.0,69.0,22.0,70.0,22.0,71.0,22.0,72.0,22.0,73.0,22.0,74.0,22.0,75.0,22.0,76.0,22.0,77.0,22.0,78.0,22.0,79.0,22.0,80.0,22.0,81.0,22.0,82.0,22.0,83.0,22.0,84.0,22.0,85.0,22.0,86.0,22.0,87.0,22.0,88.0,22.0,89.0,22.0,90.0,22.0,91.0,22.0,92.0,22.0,93.0,22.0,94.0,22.0,95.0,22.0,96.0,22.0,97.0,22.0,98.0,22.0,99.0,22.0,100.0,22.0,101.0,22.0,102.0,22.0,103.0,22.0,104.0,22.0,105.0,22.0,106.0,22.0,107.0,22.0,108.0,22.0,109.0,22.0,110.0,22.0,111.0,22.0,112.0,22.0,113.0,22.0,114.0,22.0,115.0,22.0,116.0,22.0,117.0,22.0,118.0,22.0,119.0,22.0,120.0,22.0,121.0,22.0,122.0,22.0,123.0,22.0,124.0,22.0,125.0,22.0,126.0,22.0,127.0,22.0,128.0,22.0,129.0]
Only the corners dots:
22.0,130.0
31.0,130.0
31.0,45.0
210.0,45.0
210.0,130.0
219.0,130.0
219.0,45.0
240.0,45.0
240.0,1.0
1.0,1.0
1.0,45.0
22.0,45.0
22.0,129.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.