Jump to content
Marcomeeuwse

From shapes to curves

Recommended Posts

Hi,

Im desperately looking for a way to convert several shapes to curves. As shown in the picture.

I have tried using the convert node but it gives me not the wanted result. These shapes are not

with curves. They come from a picture.

Does someone have some smart ideas to try out?

Thanks in advance :)

post-7207-0-78378700-1457973618_thumb.jp

Share this post


Link to post
Share on other sites

You could group all points, subdivide the geometry and invert the selection to get the middle row of points and then delete or connect those middle row points. Upload your scene, makes it easier to answer your question.

Share this post


Link to post
Share on other sites

You should lock the node, without it there's nothing in the scene.

Share this post


Link to post
Share on other sites

Hi Yadar,

I tried to follow your advice, and used the subdivide node on openSubdiv Loop. This gives me points in the centre on a line that I need.

Right now I'm having trouble to select these points. Also not all points that are created in the centre, are not positioned fortunately. I guess it just the shape.

M

Shape to curve02.hipnc

Share this post


Link to post
Share on other sites

okay I managed to get centre points for each shape by using the poly-expand node.

I used the groupnode to select these and used the add node for a line.

the add node only works for 1 primitive with these points. so I need to fine a way to

do this separately for the others. As well as to sort the points in a correct order

to create a proper curved line.

Here is the file again

Shape to curve03.hipnc

Share this post


Link to post
Share on other sites

Hi Konstantin,

Good to see you again.Thank for helping.

I like your approach on how you sort the points but I don't understand it completely. You're using the bbox max and min

to check if the shape is in x or z orientated, and add the result to its colour. So the sort will sort the points by colour and therefore follow the

shape. But I don't understand how the 'relative to point bbox' works in the switch. And why colour

Also you use an attribute wrangle with i@prnum to define the primitive and write = @primnum to create an attribute. But why do you use an

attributepromote and set the attribute from primitive to point?

Also if i increase the resample segments i get some zigzag lines even when i have the SOP node active. Perhaps this is just because of my

shapes. I will experiment with other ones.

Thanks again Konstantin

Share this post


Link to post
Share on other sites

it does not need to be the color attribute. its just useful for debugging. the way of checking the orientation is very basic i have to admit: it wont work on heavily bent shapes, three-dimensional ones and 45° oriented shapes.

the relpointbbox just puts gradients across your shapes. the switch then decides which gradient is going to be used. is that what you mean?

i think i had to use the attribpromote because the add node works on points. maybe i initially used it to overcome the subdivide node also and left it in there unintentionally.

 

its just a quick shot, there are probably more efficient and gripping ways to solve this..  :unsure:

Share this post


Link to post
Share on other sites

well i didnt know how to work on any orientation so you gave me a good basic start :) working with semi straight shapes might work just fine.

Ah so that's how the relpointbbox works. i had trouble picturing what the result would be.

Anyways, Thanks for giving me some new tools to work with!! will post an update if i got the result I need.

Share this post


Link to post
Share on other sites

You can use more general approach that will work even with 'tube like" geometries or shapes randomly oriented in 3D space. If your input is 3D geometry, then just mute EXTRUDE node in foreach loop.

 

This method extrude shapes, and convert them into VDBs, smooth SDF and convert back to point cloud. Then, using math, it calculates probability that point is start point in cloud and finally by using "two distances" mechanism it reconstruct curves. This is my approach to general "shortest path problem" where you are looking for shortest possible path through a point cloud where path has to pass through every point only once and start end end points are unknown. They have to be found so path has shortest length. To apply this algorithm to solve shape conversion to curves problem, VDBs conversion to point cloud has to be adjusted so it could works for any shape. It is related to heavily curved shapes like letter "U" . In such cases, distances in point cloud  between points along curve has to be smaller than distance of those two segments on "U" shape otherwise you'll get zig-zag curve.    

 

Calculation is done this way:

Each point finds two closest points to itself and creates two vectors pointing to them. Then calculate dot product of those two. If that value is less than 0 point is 100% in the middle of cloud if value is close to 1 it is voted as potential first point from which generation of curve starts. Generation starts from point which have largest probability "to become start point". Then it uses closer of those two nearest points and tests if it is already connected, if not then connects it, otherwise connects other. ID of just connected point is put in an exclusion ID array so next iteration "knows" from it which points are already connected and skips them.  Then some adjustment are made for curvature matching and end points fine tuning.

 

This will work on any sized scene but you have to adjust brickering size on divide node, voxel size, max sphere counts, iso offset and some other parameters.

 

Here is the link

 

https://mega.nz/#!CE5imYJT!TMmnRiI82W3JX73yJ0FkNT01QutlPLV9mWmlk-0NheY

Share this post


Link to post
Share on other sites

Back from the weekend,

Wauw Djiki. This is awesome. There are so many new things that Im learning form your file and I others might too! But for me, this will take me a while to fully understand.

I will have to change some workflow for creating these shapes to match it to this method of creating curves. Thanks !!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×