Browse Search Popular Register Upload Rules User list Login:
Search:
Polygon simplifier that work

Image:
screenshot of the scene

Author: AverageCoder

Group: Default

Filesize: 400.54 kB

Date added: 2024-10-27

Rating: 5

Downloads: 560

Views: 241

Comments: 9

Ratings: 1

Times favored: 0

Made with: Algodoo v2.2.0b

Tags:

Scene tag

This scene was mode for developers but you do not need to know how code to use this.

Anyways, this is how it works:

for each vertex in (surfaces) do...
check if the distance between the angle between this vertex and the next vertex and the past angle are less than a tolerance
if that is true, keep the vertex but otherwise drop it.

I don't know if that makes enough sense but this is kind of just a tool

any polygon infront of the laser will be simplified but the algorithm may fail its job.
Other directions are in the scene.

oct27-gradual curves are better
oct28-white box doesnt dissapear anymore
Nov3- multiple layers are supported, this means hollow shapes or shapes with holes
Last edited at 2024/11/11 18:58:44 by AverageCoder
Please log in to rate this scene
edit
Similar scenes
Title: Polygon Simplifier
Rating: 5.625
Filesize: 1.23 MB
Downloads: 2594
Comments: 3
Ratings: 2
Date added: 2024/10/29 20:53:25
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: Polygon "Distortion"
Rating: 5
Filesize: 9.66 kB
Downloads: 673
Comments: 6
Ratings: 1
Date added: 2014/02/17 16:18:53
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: cyclogon 3
Rating: 5
Filesize: 14.1 kB
Downloads: 468
Comments: 0
Ratings: 1
Date added: 2017/07/27 10:14:36
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: irreglaur cyclogon 1
Rating: 5
Filesize: 21.36 kB
Downloads: 405
Comments: 1
Ratings: 1
Date added: 2017/07/27 10:18:31
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: [LAG?] Bounding Box Creator for Polygons
Rating: 5.375
Filesize: 11.16 kB
Downloads: 531
Comments: 5
Ratings: 2
Date added: 2024/06/17 11:19:05
Made with: Algodoo v2.1.0
Rating: rated 5.4
download
Title: Polygon Clones
Rating: 5
Filesize: 49.47 kB
Downloads: 883
Comments: 1
Ratings: 1
Date added: 2009/09/05 17:27:01
Made with: Phun
Rating: rated 5
download
Responses to this scene
show list
Title: Polygon Simplifier
Rating: 5.625
Filesize: 1.23 MB
Downloads: 2594
Comments: 3
Ratings: 2
Date added: 2024/10/29 20:53:25
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
You will need to tweak the degree tolerance for smoother polygons.
It doesn't work very well with gradual curves. What if, for dropped vertices, it keeps the degree count and adds it to the degree count of the next vertex, and this could go on forever? :lol:

EDIT: I tried changing the code a tiny bit to incorporate this idea and it worked!
All I had to do was move a single line of code!

I moved `oldRad = newRad` to the if-then statement for verts that get added - that way discarded vertexes don't update oldRad.

Now gradual curves look much better!

I kind of want to try making my own polygon simplifier now -- may I share it as a scene response?
Last edited at 2024/10/27 23:47:05 by Little
Yes, yes you may share your scene as a response.
I am also okay with code being borrowed (this applies for all of my scenes)
I will also try to implement your solution for gradual curves.
Wow, implementing that was really freaking easy, all I had to do was but a line of code in a different place.
Thanks, Little!
You're welcome!
I reloaded the scene and as soon as I hit play the white box that spawns the polygons vanished! :(
@little -- It did that for me too. It vanished because the white box timeToLive was set to a very small decimal value. To fix it, I changed the timeToLive value to +inf before running the scene.

@AverageCoder -- As s_noonan told you in a previous scene you should check your scenes AFTER uploading them to Algobox. You do that by downloading the scene immediately after uploading it. That way you will uncover bugs that you may not catch when you only run the scene on your computer. I make a habit of doing that with my own scenes and occasionally I catch a bug that I would not have found otherwise.

Very impressive coding! :tup:
Last edited at 2024/10/28 16:33:27 by Xray
I fixed it
Xray, I am unfortunately very guilty of what you mentioned about uploading a scene and finding bugs! :lol:

My friends who have subscribed to me have asked me multiple times why, when I upload a scene, I usually make several edits within the first few moments. For some reason that's just when I find all of the bugs and issues )|(

The main reason I upload first is mainly because I don't feel like setting up the thumbnail again. I kind of feel like I should make some sort of dedicated thing for thumbnails -- maybe a phunlet that I can just drag into a scene, put an image on, and then it's all done?


Generally though, the first thing I do when I upload a scene is reload it within Algodoo and make sure the scene starts properly. (Again, I really want to do something so that I don't you know, upload a broken scene for a minute or two first but... )|( )