algorithmic modeling for Rhino
Hi All.
I have just started learning grasshopper and I find myself in need of 'steering' by someone who has some idea of what they are doing...
I am looking at using Rhino to draw the water table under the ground based on pressure monitoring data available over different dates.
In essence, I want to morph between two surfaces to show seasonal movements.
The picture below shows a hypothetical 'two surface' model - the red points in-between the two surfaces are where I have got to so far (the distance between surfaces is controlled by a slider):
Having got this far I was feeling quite proud for half a days work having never before used grasshopper ... HOWEVER - I am now stuck.
To get to this point I:
A) Divided each surface into 100x100 intervals.
B) Drew a line between each corresponding point in each surface.
C) Extracted a point from each line using a percentage of length (0-100% being from surface no. 1 to surface no. 2)
I have since tried:
1) Creating polylines with each row of data then lofting = failed
2) Creating a mesh from the points using a plugin = failed
3) Directly merging between the two surfaces using an algorithm put together by someone smarter than me (credit of this site) = failed because the number of vertices were different between the two surfaces.
I am really hoping someone can guide me on this as I am really at a loss about where to go from here.
Thanks in advance.
Lyndon J
Tags:
If you're keen to find the bottlenecks in your solution, then the profiler widget is super helpful. You'll find it under display->canvas widgets, and what it does is tell you how long each component takes to execute. My guess is that your patch is the holdup. It is generally a very heavy command, for sure. It's great if you have an un-ordered set of points and/or curves because it resolves them well, but it does have to do a lot of work.
All that said, surface from points will run super fast, simply because you're supplying pretty much all of the information as an ordered grid. So if your initial data is well organized, then this will work well. However, it does require that you have all of your points lined up in rows of identical number counts.
There are always alternatives too...if you have quite a few points and they're fairly well distributed, then making a delaunay mesh should produce good results as well, and this will solve very quickly.
What does your input data look like?
Dave,
Appreciate your assistance.
Thanks for pointing me to the profiler widget, I had seen that elsewhere and searched long and hard for it but couldn’t find the name.
My excel read and data sort functions are taking 77% and 17% respectively, however these should only run on program initiation. Only thing is, they then stack the other components making it more difficult to identify which items are slowing things down. Looks like the patch (x2 at ~ 60ms) are the slowest items which need to be redrawn as the program is operated.
Am I correct in assuming, grasshopper will not re-calculate items unless their input data changes (I.e. if I change a slider position, it will only recompute those items down-circuit of that slider?)
My data is quite haphazardly organised as it corresponds with the instruments. I basically have 4 rows of data points (non-parallel) with differing numbers of points in each row. I will experiment with the Delaunay mesh and see how that goes.
I cant upload my model or definition for privacy reasons, but was wondering - If I packaged up my model could i send it to you for comment?
The forums are a great place to learn, but there are always tricks you miss that make life that little bit easier!
Cheers
Lyndon
Of course!
UPDATE(2):
..please disregard question 1) how to convert my decon or constructed point output to this indices = columns format..?,
ANSWER = Graft Tree, Merge,.
So, only questions left are for if/when you've time, are:
2) how to trim off excess Patch surface?, ..Patch > Trim is set to True but surface remains untrimmed,.
B)
INTERPOLATION:
Screenshot 1 previews baked, Mesh deconstructed points,
screenshot 3&4 shows results of Interpolation when mesh points are Set in Point component AND Set as one file path in ReadXL using "6b-RnGH_Simpdatainter-TTTWriteXL_J gh.xlsx", which contains the same "Streamed" X,Y,Z mesh points.
It interpolates INcorrectly: moving vertically with the top left corner as high point, and does not change shape as your interpolated points\surface does.
3) how to correct my mesh points interpolation to same as yours?,.
4) how to alter your def. so it interpolates between 2 excel .xlsx containing surface xyz points?,
thanks again,
Jeff
UPDATE:
A)
WRITEXL:
please disregard these former questions as i've successfully used:
- Right-click panel > Stream Contents to.txt format, then on Excel sheet, click empty cell Data tab > Get External Data > From Text,. OR..
- deconstruct points, link x,y,z coord's to WriteXL&WriteOption pairs and set C\O's=false, Column Start Positions to 1,2 and 3 respectively,.
UPDATE(3):
A)
..please disregard question 2) "..trim off excess Patch surface?",
ANSWER = Untrim, Copy Trim.
..and disregard question of simultaneous WriteXL xyz columns
ANSWER = Graft Tree etc.,
Also, since successful conversion of meshes to surfaces, i'm now able to "assign" equal uv point numbers using sDivide and finally Blend source and target surfaces created with different amounts of points. I may still have to employ point data matching, but at least the surf's should blend properly.
B)
Thought i should also confirm
1) will your powerful Simpledatainterpolation def. interpolate between Excel surface coordinates with different "cell" amounts?,
..i assume both culling and data matching are required, but when time please mention any known requirements\procedures?
..which is also former last question:
4) how to alter your def. so it interpolates between 2 excel .xlsx containing surface xyz points?,
Really! appreciate it all,
Jeff
Thanks much Lyndon,
your definition taught much of multiple subjects, so after day or so i understood enough to output Polysurface points to XL then to Patch them into a single surface. But as seen on left surfaces in attached zip screenshot "A" and proj. "6b-RnGH_Simpdatainter-TTTWriteXL_J gh.3dm", i spent more time attempting correction of the patched polysurf many errors, artifacts and lack of original surface topology, all regardless of uv count or "flexibility".
Fortunately, as seen on upper right surf of screenshot A & proj., a Quad polygon Mesh patches to an accurate surface and texture (even with backside "spike" artifacts) so long as patch Spans and Flexibility are sufficient. Also, Grasshoppers patch reproduces surf's far more accurate than Rhinos (possibly due to Rhinos patch, 100 unit uv count limitation? or my ill use).
Would like to send the polysurface for you as well Dave(Hello &feel free to chime in), but even zipped the .3dm is 25 mb over GH3D site 5mg limit, so i had to remove it.
- is there another way, perhaps Pm, email etc. i could send this to you both?,
A)
WRITEXL:
As seen in screenshot "2.jpg", my WriteXL output is not in the same "Set1-5" format as yours, so perhaps won't be read properly by your Simpledatainterpolation def.
1) how to fill each XL cell with single x,y,z coordinate or corresponding row name and column group numbers?, ..same as your XL format. Once answered i can finally blend my surfaces in your Awesome! def.,.
...i've used: Right-click panel > Stream Contents to.txt format, then on Excel sheet, click empty cell Data tab > Get External Data > From Text. This imports x coordinates into a column, then y and z coord's one at a time. But please show any method to import all coord's simultaneously if possible?, and possibly how to use .xyz export format?,
2) how to trim off excess Patch surface?, ..Patch > Trim is set to True but surface remains untrimmed,.
B)
INTERPOLATION:
Screenshot 1 previews baked, Mesh deconstructed points,
screenshot 3&4 shows results of Interpolation when mesh points are Set in Point component AND Set as one file path in ReadXL using "6b-RnGH_Simpdatainter-TTTWriteXL_J gh.xlsx", which contains the same "Streamed" X,Y,Z mesh points.
It interpolates INcorrectly: moving vertically with the top left corner as high point, and does not change shape as your interpolated points\surface does.
3) how to correct my mesh points interpolation to same as yours?,.
4) how to alter your def. so it interpolates between 2 excel .xlsx containing surface xyz points?,
Really impressed and appreciate your example instruction and powerful def's,
hope to talk soon and learn more.
Big fan, Jeff
Hello David, your def. is a succinct and very efficient one. if time could you please explain a little more details on how it (and components) works?
And to you as well, thanks for sharing so generously :)
Jeff
Hi Jeff-
This def relies on having good clean surfaces, so it may not be appropriate for the problem you have described above. If you'd like some help with that def you could post it and I could have a look.
The one I posted above works with two surfaces that are organized and aligned in the same way, so it has to start with clean inputs, then it:
1) takes each surface and divides them into equal numbers of points
2) draws lines between corresponding points on each surface
3) interpolates a point along each of those lines to create the basis for the morph surface
4) builds a new surface from points
5) the last part converts it into a mesh, then colorizes the mesh according to each vertex's "Z" value in comparison to all of the others.
best,
Dave
Hi Dave,
thanks for elaborating your def. and esp. its algorithm.
a) what does the Path Mapper do in your def.?
My surfaces are very preliminary tests quickly prepped just for this Blending issue. I'll prevent much unnecessary cleanup within their originating program.(an extremely quick/accurate 3D! relief modeler) But to assure surfaces compatible with your def.,
b) what constitutes or how to produce a "clean surface" please?
c) does your def. work with surfaces of differing vertex numbers?, with or without Data Matching?,
if i can clean mine sufficiently then i'll try them in SurfaceMorph.gh.
and thank much, i'll prep then upload my def. for you with the next post.
Really! appreciate it all,
Jeff
Jeff – regarding your last post.
A) The path mapper changes the way the data tree is structured. The data is arranged in a tree with 30 branches, each with 30 points per branch (so 0:0, 0:1, 0:2… to 0:30 are branches for the upper surface each with 30 points per branch, 1:0, 1:1, 1:2… to 1:30 are the branches on the lower surface again with 30 points per branch (You can change the number of branches and the points per branch using the V-Count slider).
The path mapper changes this so that each branch has two corresponding points which you can connect by a polyline (I.e. branch 0:0 point 1, and branch 1:0 point 1 – get merged into one branch.
Example using Dave’s definition – I have just coloured branches so you can get a better visual picture if what it does.
Surface 1, Branch 0 in dark green, branch 1 in dark blue.
Surface 2, Branch 0 in light green branch 1 in light blue.
The path mapper changes it to:
You can see now, how it puts corresponding points in each branch – which you can then connect via Poly-lines to undertake your merge.
b) I am going to take a stab, and suggest a ‘clean surface’ is one that is well organised with no discontinuities, that can be easily gridded with points in a succinct order.
C) No, because of the nature of the solution it requires equal vertices in order to draw lines between corresponding vertices and evaluate the lines at some position, thus giving you the points to create the morph surface. If you have un-equal numbers you would need to exclude some vertices and it gets difficult then matching your vertices up between each surface.
Hope that helps.
Dave, feel free to elaborate on – or correct me if I have anything wrong here.
..much appreciated Lyndon. Just reading over your descriptions, helping me much and saving Dave time, nice mate,..
Jeff
Thanks Lyndon! Nailed it!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by