Voronoi, convex hull, geometry modification toolset
-
hallo everybody, i'm releasing this now, maybe it will help someone. please note there are still many bugs involved, there is no real documentation and it doesn't always work
basic description:
this tooling package is inspired by techniques described in a book by aranda/lasch : tooling. the book is interesting to read but fails to show you any of the actual algorithms (http://www.arandalasch.com/tooling/) so i tried to create some of them for our beloved sketchup.installation: extract the tooling.zip to your plugins directory, note you have to preserve the pathnames in the zip. if something fails you can manually extract the tooling.rb file to your plugins directory and everything else to a new subdirectory tooling/
entire toolset is tested on a pc only, feel free to debug and adjust for a mactools:
cracking
-works on a group which contains one or more faces, the tool cracks these facesrecursive dent
-works on lines which get bent in the middle, the more times you apply this tool the more deconstructed the lines will getpointify
-creates construction points at all vertices of the selected linesexport construction points
-exports the coordinates of selected construction points for the voronoi and convex hull calculationvoronoi
-creates a mesh of lines and faces in 2d or 3d, while each exported construction points get its own 'cell' - the space is equally subdivided by each point's position
-note: only finite space cells get drawn since i couldn't figure out a way for the Qhull to export these infinite lines vectors (workaround: try to add more outer points, then intersect the result with a bounding shape of your choice)convex hull
-encloses all exported construction points in a convex mesh (useful for bridging two point loops,...)thanks:
to the creators of the Qhull program (calculates voronoi, convex hull,...) http://www.qhull.org/
to this community and all people involved in sketchup/ruby/forums
licence: your only duty is to share any improvements and/or upgrades of this code under this same condition
this zip contains all the plugins
short description of features and few hints
-
nice cell structure in a few steps
1.create a box, delete one of the faces
2.draw a few lines inside the box connecting faces at various places
3.select this new line and run Plugins/Tooling/Pointify
4.now select these points and export them using Plugins/Tooling/Export cpoints
-allow the program to export the bounding box too
5.now to construct the voronoi mesh run Plugins/Tooling/Voronoi
6.now select all the lines and Didier's line 2 cylinder ruby, enter precision 6 (means the the profile of the line extrusion is 6 sided - is enough for the effect)
7.voila - finished
-
one more thing about the voronoi structure: it is great for experiments in architecture since it divides space in cells (remember the Beijing Aquatic Stadium?)
-i hope someone with spare times uses this plugin to model it, just to prove that sketchup is a powerful piece of an app -
recursive dent does this, when you need a nice point cloud, just apply the Plugins/Tooling/Pointify command to these dented lines
-
Hi,
Thanks for sharing. Extremely interresting, especially the convex hull. I don't know what to do with it for now, but it will surely be a good start for goodies develpment.
Regards, -
re: convex hull
Wonder if its of any use for SketchyPhysics? (Though I'm not sure whether it uses GJK searching.) Anyone?
-
the convex hull generation is pretty solid (works far more reliable than the voronoi solution) but the workflow is awkward for realtime generation - since the plugin exports vertices to a file and then calls qhull.exe which writes the results to a file, then these results are built in SU. i don't know much about the actual algorithm behind the calculation - please refer to http://www.qhull.org/html/qconvex.htm
-
Ah (so this doesn't work on Macs I guess). However, QHull does a great job - I've used it for many years. If SketchyPhysics doesn't use convex hulls it probably should rather than do full prim.prim collision wrt performance.
-
re: macs
no it's not gonna work, since i don't have any mac at hand there is no way to port it myself (i guess there is a qhull for mac http://qhull.darwinports.com/) -
@a4chitect said:
the convex hull generation is pretty solid (works far more reliable than the voronoi solution) but the workflow is awkward for realtime generation - since the plugin exports vertices to a file and then calls qhull.exe which writes the results to a file, then these results are built in SU. i don't know much about the actual algorithm behind the calculation - please refer to http://www.qhull.org/html/qconvex.htm
It may be awkward, but it's a valid technique which I didn't think to use before. The source code for qhull is available and a native plugin could possibly be compiled, and a sketchup-ruby interface made. I've heard it's not terribly difficult, but then I've not tried it.
-
Hello
I've tried it up but i am stuck when I've started voronoi. It made nothing just bumped out
the command line that it cant read point.txt dont you know what can be potential problem?
I hahve checked the file points.txt, it is there and it has been made up. It would superb
if it works, this is what i have been dreaming off.thanks for the answer
martin
-
hi a4chitect...
i've download the plugin but i cannot make it works.
I can export the points, it seems to work...
but when i try to launch voronoi or convex qhull seems to be launched without any problem but nothing appears in sketcuhp...i'm an architecture's student and i think i could be a powerful engine to design...
can you help me? -
i have already let a few of you down, sorry. i promise to look into it and hopefully fix all main issues asap. you are free to do the needed changes yourselves, i think that currently there are 2 possible problems>
- the script is unable to call the qhull program to compute the actual result, and/or is unable to read the exported points or unable to write the results to a file or unable to read the results
(all of this is probably due to incorrect paths in the script/or system incompatibility)
- the problem is due to a specific points placement and the nature of the qhull algorithm (is often unable to find the correct result and therefore end without any...)
so when you run point exporter first, check if the points.txt file gets created in the Plugins\Tooling
then when you run for example 'voronoi' - and nothing gets created, check if there is a file named qvoronoi.txt at the Plugins\Tooling location
if all of the above works, the problem lies probably with the geometry, try with fewer or different points
if you are desperate, please wait for a change by me..
-
thanks for your patience
http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=8116&p=47799#p47799
-
hello a4chitect
well, i have just download the update, i tried it but i have the same problem..
I can pointify, i can export (i have looked in the folder and the file with the coordonate of my point exist. But when i launch voronoi or convex hull, the program seems to launch but nothing is drawn.. and no other file (for instance voronoi.txt ) is created
i will retry of course but i don't understand..
is there anybody in the same case? or am i alone ?
i will search what the problem is..thank you for your work wich seems to be great !
-
please try exporting points with or without the bounding box (depending on which way you went before - choose the other way this time) and try to run voronoi.
or
download the attached skp and follow the instructions to test.
(maybe the qhull can't compute the results for your specific points alignment)or
please attach your points in a skp for me to try
-
dear a4chitect , thanks for your ruby ,but i had the same problem (voronoi doesnt work for me too ) maybe its because of operating system or something ( 32 or 64bit) dual prosseccoror... I dont know what! yours majid
-
please try this:
windows - open command prompt and navigate to your sketchup\plugins\qhull
(windows vista: it is easier to open qhull folder in windows explorer, press and hold shift and right-click anywhere inside empty space in qhull, choose 'Open Command Window Here')paste the following code 'qhull.exe TI points.txt v Qbb Qj o Fv' (without quotes) and press enter
(paste works by clicking in the top left corner on the small black icon, choose edit>paste)let me know your results
thanks
-
dear a4chitetct , i did and here is the result ( i paste all the result in a text file and zipped)
-
from the file you have attached, it is clear that the voronoi computation is all right, I have copied the following part
3 19 12 1 -10.101 -10.101 -10.101 69.50972188371688 213.9843863157402 423.5501981233883 ... ... ... 5 8 10 0 4 3 6 9 11 0 13 15 18
and pasted into an empty sketchup\plugins\qhull\qvoronoi.txt
then imported using a modified voronoi.rb (attached) which doesn't run the computation it only builds geometry from the qvoronoi.txtI am attaching the result as a .skp file
modified voronoi (replace your current but keep the original since this is for debugging)
Advertisement