by MattC » Tue Jul 24, 2012 10:03 am
UPDATERubies modified according to ThomThom quidelineUPDATE 2VoronoiXY updated - code adjustedHello everybody. A bit time ago there was an interesting challenge posted on this forums: http://forums.sketchucation.com/viewtop ... 23&t=28521I was interested in it , because I want to make something like that for myself. Well maybe a bit smaller. Workflow is clearly stated in that discusion, but two problems onderway were not so easy to solve: - genereating Voronoi diagram from points cloud (as many people struggle with Qhull plugin) - Creating nice cutouts in those cells, So here we go : Voronoi - At this time it is limited to XY plane, but in a code I have put remarks what have to be adjusted (it is not tested, if it is all You have to change). My algorythm uses delauney3.rb , and is based on code of Tig's triangulation. In fact TIG's plugin can create delauney triangulation also for nonplanar set of points, but my voronoi plugin operates on a plane. 
here are base points and result of delauney triangulation 
What we also want to know is convex hull of those points, as that will be limit of our voronoi diagram, here You can see convex hull and combined convexhull and delauney triangulation. 
And result is a Voronoi diagram for base points. Every Voronoi cell is put in a Group.I have put delauney triangulation under voronoi so You can see dependences between those two. Operation: - Select cpoints - Menu plugin / VoronoiXY Next step is creating oval cutouts based on a cells. For those I used Rational Bezier Curves. http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Rational_B.C3.A9zier_curvesAfter executing plugin You can use TAB to change 3 parameters. - offset - if You want to leave some material on the edge of cell - Points- number of points that create every segment of a curve - Weight - it controls how round / pointed curve You get Every curve is put in a group. I think dat pictures will explain everything: 

One remark, because offset produces sometimes intersecting polygon, result of coniccurve can also intersect itself: 
Operation: - Menu Plugins/ Conic Curve in Face - TAB to set parameters - Click Face Feel free to play with it.It is intended for non comertial use. If You decide to change something / improve it - please report here what have You done, so others can also use improved version. Greets Matt PLEASE GET/USE THE LATEST VERSION... FROM THE PluginStore
Last edited by MattC on Wed Jul 25, 2012 10:39 am, edited 3 times in total.
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by Krisidious » Tue Jul 24, 2012 10:12 am
so what are some examples of what you would use this for?
-

Krisidious
-
- Posts: 6048
- Joined: Mon Oct 22, 2007 1:52 pm
- Location: Springfield, Missouri. USA
- Name: Krisidious
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by MattC » Tue Jul 24, 2012 10:18 am
For me it is for a interior decoration purposes. Like a wall panel ,or sort of sculpture. Matt
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by mitcorb » Tue Jul 24, 2012 12:56 pm
I notice you use the name Delaunay and Delauney in this post. Could the various spellings affect functionality of the script? Or, are they not the same thing?
I take the slow, deliberate approach in my aimless wandering.
-

mitcorb
- Top SketchUcator
-
- Posts: 4007
- Joined: Sat Mar 22, 2008 2:32 pm
- Location: USA
- Name: mitcorb
- Operating system: Windows
- SketchUp version: 2016
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Intermediate
by MattC » Tue Jul 24, 2012 1:12 pm
Yup , my fault. I've corrected it. there should be delauney3.rb as it uses that ruby for triangulation. Triangulation name is Delauney Triangulation. Matt
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by thomthom » Tue Jul 24, 2012 1:48 pm
Nice plugin! However, Looking at the code I see that there are many methods on the global namespace. These methods will spread to ALL classes - which is not good. Could you please wrap everything into a separate unique namespace - module? Everything, even all the classes etc. Have a look at this article I put together with guidelines for SketchUp plugins: http://www.thomthom.net/thoughts/2012/0 ... velopment/
-

thomthom
- PluginStore Author

-
- Posts: 19478
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by srx » Tue Jul 24, 2012 3:33 pm
Thanks! 
www.saurus.rs
-

srx
-
- Posts: 862
- Joined: Sat Aug 02, 2008 6:01 pm
- Location: Serbia
- Name: srx
- Operating system: Windows
- SketchUp version: 7
- License type: Free/Make
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by mitcorb » Wed Jul 25, 2012 12:45 am
Forgive my further ignorance, please. Why is it called "Conic Curve?"
I take the slow, deliberate approach in my aimless wandering.
-

mitcorb
- Top SketchUcator
-
- Posts: 4007
- Joined: Sat Mar 22, 2008 2:32 pm
- Location: USA
- Name: mitcorb
- Operating system: Windows
- SketchUp version: 2016
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Intermediate
by pilou » Wed Jul 25, 2012 1:00 am
-

pilou
- Top SketchUcator
-
- Posts: 21112
- Joined: Wed Jan 23, 2008 10:33 pm
- Name: Pilou
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: hobby
- Level of SketchUp: Advanced
-
by MattC » Wed Jul 25, 2012 8:11 am
@ mitcorb - example : If You have polygon with 4 vertices, You can create 4 sets of points ([0,1,2],[1,2,3],[2,3,0],[3,0,1]). You can use those sets of points to create rational bezier spline( http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Rational_B.C3.A9zier_curves) by asigning weight to every point. Special case is when You set for first and third point weight = 1 , and weight "w" for second point. - when w>1 then created curve is a hyperbole - when w=1 then created curve is a parabole - when w<1 then created curve is an ellipse (in special case circle) Hyperbole, parabole ellipse and circle are known as a conic curves or conic sections , because You can create them by cutting cone with a plane. For further read : http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/RB-conics.htmlhttp://en.wikipedia.org/wiki/Conic_sectionIf You draw square, and apply coniccurve with weight w = sqrt(2)/2 = 0,7071, You will get a circle. @ Pilou - This is an implementation of 3DVoronoi - this is my next step, but at this moment I struggle a bit with a code... Matt
Last edited by MattC on Fri Aug 24, 2012 6:37 pm, edited 1 time in total.
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by ivreich » Wed Jul 25, 2012 8:37 am
Hi MattC
Thanks for this plugin..been looking for something like this for a while.
Anyway, I gave it a go and am experiencing lots of problems generating a proper voronoi lattice. have attached a screenshot and also the SU file for you to look at.
Cheers,
Joel
-
ivreich
-
- Posts: 73
- Joined: Fri May 16, 2008 9:28 am
- Location: Australia
- Name: Joel Lee
- Operating system: Windows
- SketchUp version: 2014
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Krisidious » Wed Jul 25, 2012 8:54 am
SO Matt are you saying if I had a box shaped plan I could plan a curve through it to fit well?
-

Krisidious
-
- Posts: 6048
- Joined: Mon Oct 22, 2007 1:52 pm
- Location: Springfield, Missouri. USA
- Name: Krisidious
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by MattC » Wed Jul 25, 2012 9:24 am
Could You show me an example of box shaped plan and what You would like to obtain ?
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by pilou » Wed Jul 25, 2012 9:52 am
Cool things in 3D  
-

pilou
- Top SketchUcator
-
- Posts: 21112
- Joined: Wed Jan 23, 2008 10:33 pm
- Name: Pilou
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: hobby
- Level of SketchUp: Advanced
-
by MattC » Wed Jul 25, 2012 10:29 am
Pilou You 're teasing me  Is it Sketchup ?? Or something else? Well only step that I miss from those, is generation of 3D Voronoi  For rest I have plugins already. @ Joel, indeed there WAS a problem - file in first message is updated. Matt
Last edited by MattC on Wed Jul 25, 2012 10:36 am, edited 1 time in total.
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by pilou » Wed Jul 25, 2012 10:35 am
Or something else
Just image found on the Net  But will be easy to make with your futur plug! 
-

pilou
- Top SketchUcator
-
- Posts: 21112
- Joined: Wed Jan 23, 2008 10:33 pm
- Name: Pilou
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: hobby
- Level of SketchUp: Advanced
-
by nektares » Wed Jul 25, 2012 8:39 pm
Hey i always loved voronoi structures and i´m very interested on this plugin but when i try to use it i get this:
Error: #<ArgumentError: Cannot convert argument to Sketchup::Point3d> C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:277:in `point_in_polygon_2D' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:277:in `voropoints' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:267:in `each' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:267:in `voropoints' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:128:in `voronoi' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:105:in `each' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:105:in `voronoi' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:36:in `initialize' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:384:in `new' C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/VoronoiXY.rb:384
am i doing something wrong, i read carefully and i think it´s my SketchUp maybe?
-
nektares
-
- Posts: 145
- Joined: Fri Jun 20, 2008 3:38 pm
by MattC » Wed Jul 25, 2012 11:14 pm
Hi Can You attach sketchup file that is causing problems, or is it in general ? Matt
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by the.pjt » Thu Jul 26, 2012 4:33 am
HI Matt ... I have made some PNG Icons ,made a loader and toolbar , define Extention for your exelent codes , and developed them a bit added a custom cursor to the ConicCurveInFace.rb and removed the annoying UI message-box group counter from VoronoiXY.rb I have also added TIG's pointcloude script as a defoult part of it , and I also made a Icon for that tool too ( points cloud triangulation ) .. I also made codes nicely and full commented .. just for you dear main developer suggestion for next versions : add a point cloud generator ruby tool add option to decide the resoult of VoronoiXY tool should be grouped or not add option (ConicCurveInFace.rb) that let user make ConicCurves from grouped face (resoult of VoronoiXY tool) add option (ConicCurveInFace.rb) that let user make ConicCurves from a set of selections .. no need to click and click and click ... and ... thanks a lot for your great script ------- to dear modorators : please please please don't delet this post !!!  .. TIG says : Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies... I didn't delete that copyright part .. and I also added TIG's name after his tool menu item !  is there any copyright issue again ? PLEASE GET/USE THE LATEST VERSION... FROM THE PluginStore...
-
the.pjt
-
- Posts: 208
- Joined: Sun Aug 09, 2009 1:20 pm
- Location: iran
- Name: pejman
by the.pjt » Thu Jul 26, 2012 4:40 am
here is the PSD files of ICONS
-
the.pjt
-
- Posts: 208
- Joined: Sun Aug 09, 2009 1:20 pm
- Location: iran
- Name: pejman
by thomthom » Thu Jul 26, 2012 9:47 am
the.pjt wrote:to dear modorators : please please please don't delet this post !!
This one is ok - as it has explicit statement that it can be modified and distributed. We do however prefer that the downloads for plugins at in the very first post of a plugin's thread. Otherwise it's hard for people to find the latest version if it is buried deep inside the thread. Could you agree with Matt whether that Matt puts the download in the first post - or you create a new thread where you maintain this modified version?
-

thomthom
- PluginStore Author

-
- Posts: 19478
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by unclex » Thu Jul 26, 2012 1:12 pm
wonderful
-
unclex
-
- Posts: 88
- Joined: Fri Sep 18, 2009 12:28 pm
by MattC » Thu Jul 26, 2012 2:52 pm
the.pjt thanks for a hard work. I I must admit that that part of writing rubies is still unknown to me. I just concentrate on making my code running and not on wrapping it in a nice package as You did. One question - as I downloaded Your files I could not access icons, Toolbar was blank. so in place of - Code: Select all
cmd.small_icon = "voronoi_conic/icon0s.png"
I used - Code: Select all
cmd.small_icon = "./icon0s.png"
and it worked. I have no idea why it was like that. As for a wishlist: - add a point cloud generator ruby tool - this should be no problem, if we are talking about random pints in a cube/box, and probably random points on face but I have no idea (for now) about random points in a volume (is it possible in Sketchup ?). -add option to decide the resoult of VoronoiXY tool should be grouped or not - ok , just one userform asking if groups should be exploded in the end. - add option (ConicCurveInFace.rb) that let user make ConicCurves from grouped face (resoult of VoronoiXY tool)- this should also not be a problem - add option (ConicCurveInFace.rb) that let user make ConicCurves from a set of selections .. no need to click and click and click ... - same as above. I will try to get it done, when I finish 3DVoronoi. Cheers Matt
Last edited by MattC on Thu Jul 26, 2012 5:17 pm, edited 1 time in total.
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by the.pjt » Thu Jul 26, 2012 3:18 pm
thanks a lot Matt ... I wish my works have been helpful for you ... and I'm glad for helpping you to have a nice plugin . I myself didn't have any problem with icons and I'm wondering why it can't handle the Icon folder path ... but thanks for learning me the right way of codding ... Matt ... but you know ... I'm not a proggrammer ..  , I wish I could code my sugestions .. and help you more than making some icons .. thanks agane Matt .. have a nice tool 
-
the.pjt
-
- Posts: 208
- Joined: Sun Aug 09, 2009 1:20 pm
- Location: iran
- Name: pejman
by notareal » Thu Jul 26, 2012 3:20 pm
I'll be keeping eye on this. 3D... that would be great.
-
notareal
- Thea Render Support

-
- Posts: 1075
- Joined: Tue Nov 13, 2007 9:54 pm
- Location: Oulu, Finland
- Name: notareal
-
by thomthom » Thu Jul 26, 2012 4:40 pm
Matt, the icons - did you put the icons in the correct folder? The change you did make it appear that you placed them in the root folder... ?
-

thomthom
- PluginStore Author

-
- Posts: 19478
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by MattC » Thu Jul 26, 2012 5:28 pm
I've unpacked it just as at was, so icons sits in a folder Plugins/voronoi_conic. Somehow code - Code: Select all
cmd.small_icon = "voronoi_conic/icon0s.png"
, does not work for me (Win 7 and WinXP) Strangely: 1) : - Code: Select all
cmd.small_icon = "icon0s.png"
and 2) - Code: Select all
cmd.small_icon = "./icon0s.png"
both works. code 1) I understand as icons and ruby that invokes toolbar are in the sam location. But 2) searches for icons in Plugin folder...or am I mistaken? Does it work for You straight away ThomThom?? Matt
-
MattC
-
- Posts: 41
- Joined: Tue Dec 07, 2010 6:35 pm
- Name: MattC
by thomthom » Thu Jul 26, 2012 6:02 pm
Haven't had time to try it - been very busy. Just monitoring the forum a little...
-

thomthom
- PluginStore Author

-
- Posts: 19478
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Sl!m » Fri Jul 27, 2012 11:47 am
Hi the pjt !
Great work!
Few comments : 1/ Could it be possible to undo the voronoi generation in one go ?(ctrl Z is going back through all the steps of the generation) 2/ It does not generate the voronoi all the time. Sometimes nothing happens. Any idea ?
Thanks for making my day with those plugins!
-
Sl!m
- Premium Member

-
- Posts: 15
- Joined: Tue Jan 20, 2009 3:43 am
- Name: sl!m
by the.pjt » Fri Jul 27, 2012 12:42 pm
Matt's original ruby files (could be found in the first post of this topic ) displays a dialog box that counts each step and you should verify each step by pressing OK button .. It could be good for preventing unwanted results ... ( but it was annoying for me ) also you can delete each group of resoults and doing the Voronoi command on a particular face ... but above all I'm not a programmer Author ... I just wanted to help Matt by doing some routine steps of making an SU Extension ... 
-
the.pjt
-
- Posts: 208
- Joined: Sun Aug 09, 2009 1:20 pm
- Location: iran
- Name: pejman
by Ad Machine » 5 minutes ago
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Plugins
|