# Discretizations of vectorfield in equidistant curves / aligned stripe pattern

Hi,

I am a little out of depth and would appreciate any advice / high-level strategy to tackle this problem:

the goal is to create curves on a surface which fur fill 3 requerements;

1. They should be (more or less) equidistant. Basically when I âpipeâ them, the pipe should overlap with a little bit consistency. This doesnât have to be exact.

2. They should follow a given vector field / align themselves to it.

3. they should âwrapâ the hole surface while being as long as possible

the idea behind this is to cnc-mill the surface, and the generated curves are being used as toolpaths.

I have attaced a .gh to illustrate the problem.

vec_field-forum.gh (336.6 KB)

1 Like

You can use directional reaction diffusion.

thanks, I will try it. Probably the hardest part will be gettig clean middle curves from the meshâŚ

Maybe everything can also be done with Kangaroo: on mesh, sphere collide. I will have a look

I will try to have a look but as I am on vacation not always easy to find time!
One important part is to have a nice triangle mesh. Curves will be equidistant is all triangles are equilateral.
Vector field is the easy part. My script need one vector per mesh vertices

1 Like

first result with kagaroo: goals: anchor, direction( from vectorfield), on mesh, lenght, collider,
i will try to somehow lengthen each curve but also stick it to the surfaceâŚ

1 Like

I am there

looks promising!
i will call it a day and continue tomorrow- when I find a solution i will post it here

I am there now, I still have a problem with the welding of mesh !!! So I have to use Rhino.
In order to have thinner size, you need to have more triangles.

Here is my script, it uses directional reaction diffusion. You can play with the âparameter Bâ the lower the lower the size of the pattern. But lower than 0.15 will yield bad result. So if you want closer curves, make a denser mesh.

I use a @Petras_Vestartas script to weld the iso mesh because old components doesnât give good results (I donât know why). Then curves are extracted from the iso mesh, these curves are smoothened. The used with Dendro plugin to âcutâ the initial mesh.

If you donât want to offset mesh use a 0 offset.
For a better result lower the resolution of Dendro Voxel, 0.5 seems good but not fast. So I used 1 here.

Have fun
vec_field-forum_LD.gh (362.9 KB)

5 Likes

wow- iâm speechless. many thanks. i will check it tomorrow

Try mesh edits weld with distance tolerance. It is my go to welder lately.

Tanks, I will try this one but I have also to understand why it fails with rhinocommon!

not nearly as nice a the solution from laurent; done with kangaroo- the difficult part is to connect the unsorted curves in a nice way. this time I just look for the neareast neighbour with the lowest angle-difference.

unnamed2_forum.gh (512.3 KB)

2 Likes

I think because it uses angle rather than distance. Rhino seems to have lots of distance tolerance issues in defining closed meshes for some reason, especially away from the origin. Angle implies it is already in a way closed and if it is a part not closed then an angle test wonât work. By using distance you can force it to weld.

resulting milling pattern:

2 Likes

to clarify: kagaroo gives me a bunch of oriented, equidistant curves but there all too short. I tried to connect them by checking for each endpoint the 5 closeset curves , then choosing the one which has the lowest angle difference to the starting point. The Result is rather bad, iâm afraid

// nevermind; see post below

Michael was speaking of the way Rhinocommon handle mesh welding not your algorithm.
It was a side discussion on mesh welding

1 Like

It is not my algo, and I am also speaking on mesh welding. Rhinocommon uses an angle tolerance. Mesh edits weld and Petras weld use distance tolerance. That is point I was making The issue with angle is very often (depending how the mesh is made) mesh faces will have microscopic gaps larger than Rhino tolerance, even though it can join because meshes can join even when not touching as you know. The issue is if there is little gaps an angle calc between faces wonât work because it requires faces to truly share an edge, which they donât on a microscopic level. By using distance you essentially average the verts of the gap to become one, within defined distance. The draw back with distance is if you have a very dense mesh you might weld verts that are very close to each other but didnât want to weld, but I find it very less likely to have meaningful verts .001 units next to eachother so it is usually ok to weld by distance.

@Konrad thanks for sharing the method you have used.
There could be another way with Instant Meshes where you can define orientation of vector field.

The difficulties will be to define correctly the vectors and to link correctly the quad meshes.

With my method I made a more denser mesh with MeshMachine static with an edge length of 2.5 unit. It gives that. It could be better if I add a method to cope with shape of triangles in Reaction Diffusion script. I know the way but didnât implement it.