sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [PLUGIN] Voronoi + Conic Curve

    Scheduled Pinned Locked Moved Plugins
    136 Posts 53 Posters 222.3k Views 52 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      MattC
      last edited by

      True TIG
      I already implemented this trap, but also encountered another case that is a bit problematic.
      It is geometry limitation of Sketchup.

      I will update script when this will be solved, in a meantime if anyone also has non-working combination of points, post it here.
      I will have more material to analyse.

      Matt

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Putting the code inside a begin...do_point...rescue...end structure will allow the code to fail on the point without a crash ?
        But a simple intersect_lines...if point...do_stuff...else...next_point...end would suffice here...
        Something like:
        if **int &&** (test[0]==0)&&(test[1]==0)&&(test[2]==0) intprim=int+int.vector_to(pointstable[bpntindx])+int.vector_to(pointstable[bpntindx]) points<<intprim.project_to_line([midlines[0][0],midlines[0][1]]) points<<intprim points<<intprim.project_to_line([midlines[1][0],midlines[1][1]]) els**if int** points<<int end
        and
        if **int &&** point_is_between(p1,p2,int)&&point_is_between(polygon[i],polygon[j],int) point<<int end
        AND any other place where int is set as an 'intersection' that might fail - test for its existence before trying to use it.
        Only uses int if it's not ' nil'.

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          MattC
          last edited by

          Yup, second way is exactly how I changed it.
          My fault was testing it on set of random points, and combination of 3 colinear points didn't occure.
          Matt

          1 Reply Last reply Reply Quote 0
          • S Offline
            Sl-m
            last edited by

            Hi there,

            I found this Voronoi so cool... couldn't resist posting this.
            Interacting with the mouse moving over the points.

            Is that code any useful to ruby Heros ?

            http://mbostock.github.com/d3/ex/voronoi.html

            Have a great day/night!
            Sl!m

            1 Reply Last reply Reply Quote 0
            • J Offline
              juanjo
              last edited by

              Hi Matt
              Great plugin mate... lots of potential here
              But I have a little problem: you say that for this to run properly this plugin requires "delauney3.rb"
              I don't have it... I only have "delaunay2.rb".
              I get the Typical plugin error..."Error loading file VoronoiXY.rb no such file to load -- delauney3.rb"

              But I can't find the robust version that TIG is refering to here: http://forums.sketchucation.com/viewtopic.php?t=8314

              I did got the "conic curve" plugin to work and it's awesome.

              Also tried to use "qhull.rb" but it's a mess! I just get flashing DOS-screen ans crashes.... It's a shame, since it would also be a super-tool...
              Have you heard of any progress on that???
              http://forums.sketchucation.com/viewtopic.php?t=19040
              http://forums.sketchucation.com/viewtopic.php?t=8116

              I'd really appreciate your help so i can start using this baby!
              Thanks!

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                My 'modularized' version of 'delauney' [ delauney3.rb] ships as part of my 'Triangulate Points' tool - which is very much like Didier's original... BUT avoids potential clashes with common loose method names like 'triangulate' !
                http://forums.sketchucation.com/viewtopic.php?p=301274#p301274
                It doesn't replace the original, it just makes a 'safer' alternative for any tool that is using it instead...

                TIG

                1 Reply Last reply Reply Quote 0
                • M Offline
                  MattC
                  last edited by

                  @juanjo said:

                  But I have a little problem: you say that for this to run properly this plugin requires "delauney3.rb"
                  I don't have it... I only have "delaunay2.rb".
                  Also tried to use "qhull.rb" but it's a mess! I just get flashing DOS-screen ans crashes.... It's a shame, since it would also be a super-tool...
                  Have you heard of any progress on that???

                  Hi juanjo, if You download a zip package made by pjt, and not separate files from first post, then You will have "delauney3.rb" as a part of it.
                  I couldn't get "qhull.rb" to work, and that was one of the reasons why I started to work on this project.
                  But I have some problems with the code. Some cases generates strange forms. So the work continues.
                  Greets

                  Matt

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    dtolios
                    last edited by

                    @mattc said:

                    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

                    Would it be too much to ask for 3D Voronoi?
                    I would be in...even if not for free... ๐Ÿ‘

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      MattC
                      last edited by

                      Well... I think 2D voronoi package (delauney triangulation by TIG + Voronoi on XY plane + Conic Curve + Convex hull on XY plane) is almost ready.
                      Next step will be: (delauney triangulation in 3D + Voronoi 3D + Conic Curve + Convex hull 3D).
                      But it is a lot more complicated.
                      So it is a bit to early to decide free / paid - but I think donationware ( if You like it - gratify creator) is the way to go.
                      Cheers
                      Matt

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        the.pjt
                        last edited by

                        hello Matt, did you got the Icons ? ... or a more important question: is this plugin still alive ?

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          MattC
                          last edited by

                          Hi
                          Yes I got it, Thanks a lot, I am a bit busy at my normal work, but plugin is still alive.
                          I will try to get updated version online this weekend, but I was already focused on Voronoi2D version 2.0
                          Cheers
                          Matt

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            MattC
                            last edited by

                            @ 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.html
                              http://en.wikipedia.org/wiki/Conic_section

                            If 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

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              dekay
                              last edited by

                              tanks a lot, your script is very easy to use compared to others.it has been very helpful to me.

                              thank you once again..

                              1 Reply Last reply Reply Quote 0
                              • V Offline
                                victor hugo
                                last edited by

                                Very interesting plugin...
                                where can I get the CPOINT creator or a CPOINT plugin?

                                Thanks.

                                1 Reply Last reply Reply Quote 0
                                • cottyC Offline
                                  cotty
                                  last edited by

                                  @unknownuser said:

                                  Very interesting plugin...
                                  where can I get the CPOINT creator or a CPOINT plugin?
                                  Thanks.

                                  Here

                                  my SketchUp gallery

                                  1 Reply Last reply Reply Quote 0
                                  • pilouP Offline
                                    pilou
                                    last edited by

                                    Why not put in the first post the link for the Delauney3.rb by Tig ?
                                    It was not so evident to find it! ๐Ÿ˜ฎ
                                    here the link! ๐Ÿ˜‰

                                    Else works fine ๐Ÿ˜„

                                    voro01.jpg


                                    voro02.jpg

                                    Frenchy Pilou
                                    Is beautiful that please without concept!
                                    My Little site :)

                                    1 Reply Last reply Reply Quote 0
                                    • I Offline
                                      ivreich
                                      last edited by

                                      VoronoiXY Error

                                      Hi MattC

                                      I'm still having problems creating a simple 2D Voronoi. Have attached the file with the cpoints and the error message.

                                      Conic curve seems to work fine...

                                      Cheers

                                      joel

                                      UPDATE: I see what the problem is. It's still the co-linear points. The plugin will not work if any of the points are colinear in either the X or Y axis.

                                      Something that can be fixed?


                                      SU File


                                      Error message

                                      1 Reply Last reply Reply Quote 0
                                      • pilouP Offline
                                        pilou
                                        last edited by

                                        And about Conic Curve
                                        Does this possible ?

                                        conic_wanted.jpg

                                        Frenchy Pilou
                                        Is beautiful that please without concept!
                                        My Little site :)

                                        1 Reply Last reply Reply Quote 0
                                        • pilouP Offline
                                          pilou
                                          last edited by

                                          Hello

                                          For the Voronoรฏ (with SU V7 tested) images previous post
                                          All works fine except I must click on the Ok Botton for have a voronoรฏ polygon for each new polygon! ๐Ÿ˜ฒ ๐Ÿ˜ฎ

                                          Tig triangle works for a selection of points in one pass! ๐Ÿ‘

                                          And for the conic curve : does it possible to have the same for a selection of faces ?
                                          Click on each polygon is some tiedious when you have thousand of them!

                                          voronoi2.jpg

                                          EDIT : About Voronoรฏ xy

                                          @unknownuser said:

                                          I must click on the Ok Botton

                                          Works fine in V8 ! โ˜€

                                          But something must be made for the UNDO !!! ๐Ÿ˜‰
                                          Here you must make each CTRL+ Z for each polygon ! ๐Ÿ˜ฎ

                                          Frenchy Pilou
                                          Is beautiful that please without concept!
                                          My Little site :)

                                          1 Reply Last reply Reply Quote 0
                                          • M Offline
                                            MattC
                                            last edited by

                                            Hi Pilou, Hello everybody

                                            Currently I am rewriting the whole Voronoi 2D plug-in.
                                            It is going painfully slow, but I have a lot of other things on my head right now.
                                            Why I am completely redesigning it? Well my understanding of Ruby got a bit better, and also I got some new ideas how to tackle this problem.
                                            What I want to accomplish:

                                            1. prepare a nice flow chart for a process of creating 2D Voronoi diagram
                                            2. based on that define set of standard functions that will be used
                                            3. compose final version of Voronoi 2D plug-in
                                            • do steps 1-3 with 3D Voronoi
                                            • do steps 1-3 with Conic Curve
                                            • do steps 1-3 with random point generator (2D and 3D)

                                            Shall I succeed then next step would be a "fracture tool" similar to one in Blender.

                                            @ Pilou
                                            So to create voronoi diagram You have to iterate through the message boxes i=1, i=2 ... etc?
                                            I think that that was one of the first complains and I have disabled it in one of later versions. If not I can do it one more time. the same applies to UNDO in one step. Conic curve on all faces in selection was also made, but I don't know if it was made an official release.

                                            Your last question is more complicated. Conic curve plug-in was made as a response to the topic in the first post. There You can see that there are multiple curves inside polygons. And all the polygons are convex. So the conic curve , which is a construction based on 3 points (let's say A B and C), is always located inside the smaller angle near the point B. In Your case polygon is Concave and conic curve will go outside. Is it possible to force it inside? Well it is.
                                            See explanation of how the conic curve is made in first post. You have to set an offset that will sit well inside, and also play with a weight value. But in this version You cannot set different weights for every vertex. Maybe I will get to that in one of the future releases.

                                            Stay tuned for more details. I will try to make a nice blog (possibly later an e-book) about it.

                                            Cheers
                                            Matt

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 3 / 7
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement