Rheotomic surfaces and flowline generation tool

Around 3 years ago I wrote an essay on my blog about what I called rheotomic surfaces - a type of surface I had developed related to fluid flow and electrostatics, and a technique for their generation using complex numbers.

Since then I have received a lot of questions from people interested in the details of exactly how these surfaces and their associated curvilinear orthogonal grids were generated.

Now I've packaged it up into a Grasshopper object with an easy interface, and am releasing it publicly so anyone can experiment with this tool.

(See this video for an example of it in action)

When the idea of using the streamlines of a flow to generate a surface first occurred to me, I thought the way to go about this would be to integrate a 2d vector field from various seed points and then move these lines vertically and loft between them - but after a lot of head scratching and experimentation, I was amazed to discover that it is actually possible to skip that step altogether.

In this technique, the surface is generated first, by moving the points of a mesh vertically from the complex plane according to the scalar values of their real and imaginary components, to generate 2 separate meshes. One of these meshes gives the rheotomic surfaces described in my essay, with helicoid shaped regions near the sources and sinks, and its contours are the streamlines of the flow (hence the name). The other mesh has sharp funnel shaped regions, and its contours give the equipotentials of the flow, orthogonal to the streamlines.

One of the advantages this technique has over vector field integration methods is that there is no problem of choosing seed points for streamline placement, and nice even spacing happens automatically. We also avoid the difficulties with cumulative error common to such methods.

By multiplying by other complex factors it is also possible to generate lines at specific angles to the streamline/equipotential directions and create various grid types.

Also because of the mesh contouring technique, these are actual vector curves being created, not just pixel based mappings.

Because the complex logarithm function is multivalued, dealing with the mesh in a way that avoids a sudden jump at the branch cuts does require a bit of special treatment, and it is not quite a straightforward height map, but I found that it is possible to avoid the usual techniques for contouring a 3d scalar field.

This definition outputs both the curves and the meshes. The meshes produced are singly periodic - you can make copies vertically shifted by 2*Pi to get a continuously spiralling surface, and if you also shift them by 1*Pi you get the other half of the helicoids, and it can all be joined into a complete and smooth surface.

So enjoy, I hope you find some interesting and original ways of using and developing this. Please do remember to attribute properly - a lot of effort has gone into this, but I'm freely sharing it in the hope that will be respected.

I've chosen not to compile or obfuscate anything, so you can easily pull it apart and see how it is all working. The original essay linked to at the start contains some suggestions of further reading if you want to learn more about complex numbers and flows.

The file: Rheotomic_Surfaces.gh

Released under the creative commons attribution share alike license 3.0

http://creativecommons.org/licenses/by-sa/3.0/

Load Previous Comments
  • panhao

    I have saw one example in OpenProcessing website.The author use every 600*600 Pixel to draw the lines.

  • Daniel Piker

    Hi Panhao - I guess you mean this one:

    http://www.openprocessing.org/visuals/?visualID=17344

    or this:

    http://www.openprocessing.org/visuals/?visualID=34033

    There is also some nice pixel based visualization of complex functions (and good explanations) on Hans Lundmarks page: http://www.mai.liu.se/~halun/complex/domain_coloring-unicode.html

  • panhao

    I am amazed U use so many component to build these curves. I translated some processing code and produced something similar to Ur work:

  • panhao

    The difference is that I use iso web to generate the polylines.As a result the lines can't get too close to the source point where I put some big,heavy circles.  

  • Daniel Piker

    Hi Panhao,

    Yes, in this definition you will see that most of the components are there to give the user control of all the different options. Sure, the surface generation part is mathematical and can be done in just a few lines of code, but the point here was to make something lots of people can easily engage with.

    But if you've found a nicer way of generating this, then I'd certainly be interested to see what you've done differently. You say you translated some processing code - was it the one from bitcraft I linked to below ?

  • panhao

    Of course the algorithm come from the website U mentioned below.I use 300*300 iso box to simulate the pixel.The process is similar to 2D metaballs.

    I fond a 3D type of  flowline in Ur blog many months ago.(http://spacesymmetrystructure.wordpress.com/page/2/

    where my friends and I click every week.)

    It seems possible to use 100*100*100 iso box to generate the 3D version.But the equation of the z axis makes me confused.

     

  • panhao

    Sorry, I fond our algorithm might be the same.We choose the same way to solve the 'jump' of mesh vertex where the image shows. And this method has a bug. If the position of the points where the lines come from are too close to the mesh vertex.The mesh component wound not work. In short if Ur mesh size was  40*40 the mesh  component would be red.


    I'd like to pass my script(*.ghx file) to you.Could you leave a email or MSN.Mine is 4812ph@163.com

  • panhao

    The bug I mentioned below:

  • Daniel Piker

    Hi Panhao, thanks for pointing this out. The problem arises if a source/sink lies exactly on a mesh vertex, because complex Log(0) is undefined (it's like asking the longitude of the North Pole), and returns NaN. It should be reasonably simple to put in a check to avoid this.

    There are probably a few other minor bugs too. A couple I've noticed and should fix:

    - not working if 2 charges of the same sign lie in the same horizontal row of the mesh (this causes a sort of double jump in the surface, which would need an extra condition to allow for)

    - not working in the actual mesh square containing a source/sink - ie the part on the axis of the helicoid.

    As for the equivalent in 3d - it's a really interesting question and one I've often considered. I'll write a full post about it soon. In 3d it makes more sense to look at singularities which are lines (vortex filaments) instead of points. As Hamilton found though - there is no nice equivalent of complex numbers in 3d. However, if you jump to 4 dimensions... (to be continued)

  • Michael Pryor

    Very nice, I wonder why not just toss it in with kangaroo as a bonus? Thanks for it. 

  • Daniel Piker

    Good idea Michael - I could also throw in a few of the other bits and pieces I've done over the last few years - DLA, 4Drotations, inversion... Expect a 'bonus' tab in the next Kangaroo release!

  • Michael Pryor

    Excellent!

  • richie hawtin

    hey daniel!

    great work!

    I tried to download the file  but somehow i canot open the file in grasshopper. I curently have version 080066, would you have any idea why this is happening?

     

    thanx alot!

  • Daniel Piker

    richie - what error message do you get ?

  • richie hawtin

    hey daniel!

    well the error message is the following:

    This document contains the messages that were recorded during the most recent Grasshopper® file read/write. Whenever a read/write operation fails or behaves unexpectedly, this summary will be compiled and put on display. If you experience problems saving or opening files, please include this log with any bug-report you file. You can use the Send... button to mail this report directly, or you can save the log and attach it to a personal email message. This log contains no personal information beyond what you supply, nor any other information that is not directly related to Grasshopper.

    Developer contact



    Message log start (chronological):


    Data at the root level is invalid. Line 1, position 1.

     

     

    and then i click ok and it doesnt open the definition, where in other similar situations i can usually see the definition....

     

    if you could help me open it somehow would be great, since i would really like to explore it...

     

    thanx again!

     

     

  • richie hawtin

    hey guys anyone would now why i cant open it?

    thanx again

     

  • castroecosta

    ♥ rheotomic

  • Eli Meltzer

    Hi Daniel, is there a way to control the size of the sample mesh, and to give the component multiple lists of points?  For example, to create a taxonomy like the attached:

  • Eli Meltzer

    I've solved my previous questions by looking in to the cluster and playing around a bit, however, I see that the C# component that you've written to post process the mesh obliterates any list structure one might have and only outputs one mesh, causing me a problem if I want to generate anything beyond equipotential lines.  Is there a work around for this?

    Thanks!

  • witness

    awesome!!thks daniel.

  • the status Kuo

    this is great!

  • Nicky

    I am amazed U use so many component to build these curves. I translated some processing code and produced something similar to Ur work:

    hey guy..can you share me this difination..i love it..thank you..

    email: bosua000@yahoo.com

  • Nicky

    hi panhao..i like your photos..can you share me this defination.thank you

  • Anna B

    I've also been trying to achieve a surface similar (or exactly...) to panhao, using the rheotomic surfaces definition as a starting point to work. But I can't seem to figure out how to do it! I've been thinking of it as trying to project the flattened lines of flow onto a shaped surface, but so far I can't even generate the appropriate surface to project onto (which would be based off of the sources/sinks as attractor points for distorting the surface). help?

  • Daniel Piker

    Hi Anna,

    I think perhaps I didn't illustrate enough in my post above that the definition actually already generates the rheotomic surfaces, as well as the curves. In fact the surfaces are generated first, and the curves are the sections of these surfaces.

    So one family of the curves always exists as the sections of the surface, and the other curve families can easily be projected onto it like this:

  • Daniel Piker

    also, maybe these videos make it clearer:

  • Anna B

    Thanks for the reply Daniel. I've tried reproducing your screencapture but not with the same result...

    As you can see, the surface that I have is a "broken up" kind as opposed to the continuous one you showed in your first reply. You mention shifting by 1*Pi to get a continuous surface... is that what I'm missing? In that case, where would I apply this shift?

    Also, what expression are you using for the Ucount of the surface grid?

  • Daniel Piker

    sorry - forgot to show all the inputs:

  • Anna B

    I did try both the indices that represent the two different meshes, but both of the meshes have branch cuts in this case, and I still get the error "The Ucount is not valid for this amount of points". Is it possible that you could upload the exact gh file you're working off of?

  • Anna B

    Oh wait! it works, but only with the "square" setting. This is great! Out of curiousity, could you describe why the square one works as opposed to the others? This is really fun algorithm to explore.

  • Daniel Piker

    Glad you like it.

    As it is a cluster rather than a compiled component, you can open it up by right-clicking, and see how it is working.

    The different options (streamlines, equipotentials, square, triangle etc) get converted into a complex number or a list of complex numbers which are then used to multiply the whole solution.

    So multiplying by (1,0i) creates a surface of which the sections are streamlines, whereas multiplying by (0,1i) causes the lines to rotate by 90° to give equipotentials

    (Geometrically, multiplying by complex numbers results in scaling and rotation. Remember that by definition i*i gives -1. This can be seen as a rotation by 180°, so it makes sense that rotating by i rotates us 90° away from the real number line)

    The square input just uses a list of complex numbers ((1,0i),(0,1i)), so it outputs both surfaces, and both sets of lines.

  • DIMITRIS VENIZELOS

    Hello, I am very fascinated by this tool . I woul dlike to learn more about the mathematics of this topology, any suggestions ?

    Also I am experimenting with the flowline generation tool and I have a question. Can I use this tool in a boundary shape that is not a rectangle?  

    thanx!

  • Daniel Piker

    Hi Dimitris,

    I've just answered a similar question here:

    http://www.grasshopper3d.com/forum/topics/set-boundary-in-rheotomic...

  • Tiziano Derme

    hi Guys, I'have downloaded the Rheotomic surface.gh but in the definition the rheotomic component didn't appear.

    Could you upload another time, that component please..?

    Thanks

  • Anna B

    Tiziano, just to ask the obvious question: maybe you don't have the correct version of grasshopper to open it? Do you get an error message when opening the file? At first I had the same problem so I had to install the last build of grasshopper for Rhino 4. Whichever number that was... Trying to continue opening the file after getting the error will not work.

  • Guy Gardner

    Hi, I would like to use this component, I'm not getting errors on opening, but I'm not getting any ouputs and I'm getting the following error from the C# component 1. Solution exception:Could not load file or assembly '0e62753f-604d-4f70-8b8f-6da90af8fe5f, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied. 

    Any suggestions?

  • Daniel Piker

    Hi Guy,

    I don't follow when this error occurs - the file opens, and the 'Rheotomic' cluster is there, but orange with no outputs ?

    and then you opened the cluster? which C# component throws the error?

    It's odd, as it doesn't use any non-standard grasshopper components, and the scripts don't reference any extra libraries.

  • Guy Gardner

    Hi Daniel,

    The file opens, and the Rheotomic cluster is grey, but the curve and mesh components attached to it are orange. If I open the cluster, the two c# components are red and they both give the error I mentioned.

  • posfan12

    I notice the curve is not centered on the origin. It's off by 1/2 unit in the X and Y directions. Can this be fixed? I know I can move the curve, but then the sources and sinks don't match it.

  • posfan12

    One more thing. Why can't I edit the cluster? Is it because it is from an old version of Grasshopper? I am running 0.9.0061.

  • Daniel Piker

    Hi - I think old clusters don't open just from double clicking, but you can still edit them by right-clicking and choosing "open cluster".

  • posfan12

    Yes, but when you try to save the cluster it does so as a separate file. I.e. the original cluster does not get updated AFAIK.

  • peyman

    Thank you for sharing this awesome definition Daniel , 

    the problem for me is , how i can change the frame size for the field as now it is an allocated square 

  • peyman

    i really appreciate if some body help me with that 

  • Tobias Power

    Hi 

    Firstly I'd just like to say this definition is amazing and great fun to play with and thanks for sharing, I have been trying to understand the maths behind how it has has been put together with my aim is to see if it is possible to have an arrangement of sinks and sources at one level, smoothly transitioning into a different arrangement at the level below. If we were to say 'one level' constitutes the combination of the final mesh combined with it's equivalent shifted vertically by 2*pi then is it possible to smoothly shift to a different arrangement at the level below to avoid repetition of the same helicoid regions at all levels. I believe this could produce some really beautiful and interesting landscapes but not really sure where to start as there is some very complicated maths that I don't really understand, I have posted my broken down the definition with what I believe each area is doing and would be extremely grateful if anyone could point me in the right direction of achieving something as the result said above and also confirm I have understood the script correctly,  many thanks

  • shima sn

    Hi Daniel,

    Thanks for sharing the amazing component. I wonder if there a new version to this component?

    I'm trying to get to the circle packing pattern for the base grid for CA based agents. The problem is since the lines start from a square shape center they create redundant intersections. Is there a way to have circles in the center like Phyllotaxis?

    Thanks

  • etsim

    hi daniel,

    thanks for sharing your ideas!

    Just by opening the def I get the result on the picture.

    So I feed a mesh, from which I move certain points (z-axis) according to some fields. 

    What I would really wanted to know is whether I could feed 3 or 4 slabs (surfaces) for example one on top of the other and then define some points (including Z coordinate) that would start creating connections between the slabs. For example a point between the first 2 slabs would make a bridging between them, another point between the second 2 slabs etc but not so much in a surface bridging technique but rather in a rheotomic surface technique.

  • Maxwell Sheffield

    Hi daniel,

    sorry for bothering. maybe i got the wrong impression, which is that the entire number of flowlines could become a continuous surface. however, i figured that depending on the number of sets of flowlines (input mode / Vectors) you create a branch each and rut it into the flat set of srf points, which creates a surface for each branch. how would they connect into a single surface? 

    Thanks, Fabian

  • David Di Giuseppe

    I'm trying to use this definition but alot of the components are flagged as OLD and I'm not getting any results for the flowline curves or mesh objects. Does anyone have a version that works with newer releases of grasshopper that they could share?

    Thanks!

  • Alexandra Foster

    Sorry-- dumb question here- how did you create the animation at the bottom?

    :P