hanskellner / Fusion360Voronoi

Voronoi Sketch Generator Script for Autodesk Fusion 360
https://hanskellner.github.io/Fusion360Voronoi/Voronoi.html
Other
132 stars 21 forks source link

Voronoi cells intersection issues #8

Open wassfila opened 4 years ago

wassfila commented 4 years ago

This plugin creates a Voronoi like effect, but wrong with regard to the Voronoi concept. In a Voronoi segmented space, cells never interact because cells are not independently created, it is rather the intersection line that creates the cells segmentation, then a morphology operation can homogeneously thickens the edges. So the edges will in any case have similar thickness overall. What this plugin does is some kind of random points generation (maybe Vornoi is used at firs step), then the issue is that cells are created independently from one another, and it is only the scale as a trick that avoids intersections, but with 100% that are lots of intersections, which is not the Voronoi concept. This plugin is nevertheless valuable and unique in terms of Fusion360 integrations, and Vornoi algorithms libraries are available, raising this issue has the scope to improve it and open its usage to a wider designers looking for detailed real Voronoi effect. That would also make it simpler to use for normal users and not having to tweak percentage to get random sides thickness.

wassfila commented 4 years ago

Not Vornoi image

Voronoi image

see this reference as a real Voronoi partitionning https://www.craftsmanspace.com/free-patterns/voronoi-2d-patterns.html

LeonFedotov commented 4 years ago

Hey, this plugin warps around a javascript library called gorhill/Javascript-Voronoi do you know objectively that the linked library isn't creating the voronoi or is it some flaw in the implementation of this integration? Maybe you should try using loyed's relaxation algorithm to achieve the results you are looking for, I also had the same "AESTETIC" issues with the original plugin and used loyd's to counter this weirdness.

wassfila commented 4 years ago

Hi, you're right, to be fair, I renamed the issue to make it more specific to the integration. So since I posted this ticket, a lot has happened, I spent some time working on a new Voronoi editor and I'm using the same dependency as you do, so I can already confirm that the issue is not from the library. Here below a link to my project, in it a link to a live demo if you'd like to check it out https://github.com/WebSVG/voronoi and here another project using that same library, I forked it to provide a live demo: https://websvg.github.io/svg_voronoi_gen/

You can have a look at my code or the other projects code if you want, but after having implemented it, I realize that your issue could be related to the bezier curves or their control points. Bezier curves could be tangent at the cells centers, where you have the black dots and in your version they're clearly not tangent but intersecting. If you'd like to reuse any code from my project, I'd even help you, I'm a big Fusion360 user but did not venture on plugins yet, so I'd be glad to have the same advanced functions I'll be developing in a Fusion360 plugin.

hanskellner commented 4 years ago

Hi @wassfila and @LeonFedotov -

Yes, the limited spline support within the Fusion 360 API made it impossible to tighten the control points. But, I haven't looked at that issue in a while and it's possible that Fusion's API is improved in that area.

@wassfila - I took a quick look at your code/example. Very nice interaction. Let me think through this a little. I've had improvements to the current code planned (posssible 3d support) but an interim update might be worthwhile

LeonFedotov commented 4 years ago

3d sounds fun :) @hanskellner I can do a cleanup on the code a bit if you'd like, since iv'e got some free time :D

wassfila commented 4 years ago

@hanskellner 3d sounds awesome, if I can be of any help there I'd be glad to. The library we both based our generation on is I think 2d based, so it depends what options you can do on Fusion, if 3d means 2d surface such as sphere or cynlinder, or 3d like in a cheese like Voronoi holes. In both cases, I'm sure that'd be a much welcomed feature by the community.