transform matrix VEX question

   3001   6   0
User Avatar
Member
6 posts
Joined: 3月 2018
Offline
Hi,

I'm studying transform matrices these days.
wanna achieve a bend effect on some randomly transformed curve.
Instead of using the bend sop , I want to use matrix to do the trick just for VEX exercise.
(just like a curve version of poly folding effect which entagma did. Here is the link: https://vimeo.com/317927360).

Unlike the entagma way : building a matrix system and putting a bunch of matrices attribute in some parents array(I mean it's pretty brilliant and straightforward).I tried to write some VEX code in my own way. But it didn't work very well. And I can't figure out why.

I will attach the hip file down here.

Even I set the angle to 0, there is apparently some differences between the original curve and newly ‘bended’ curve.
Did I think wrong in the fist place?

Somebody please help me with may VEX.
wanna write some cool VEX to achieve some cool Houdini effects just like the other Houdini users.
any advise would help!
Tanks!

Attachments:
bend_curve.hipnc (105.7 KB)
vex.png (211.4 KB)

User Avatar
Member
2038 posts
Joined: 9月 2015
Offline
If you look at your normals that are being used for direction you can see the final result is as should be - meaning your code is good.

However, your ‘input’ information, in this case the Normals need to be changed.

In your ‘reverse_N’ wrangle if you remove what you have and put in the following you will get the desired output:

@N = point(geoself(), "P", @ptnum + 1) - @P;

if(@ptnum == (npoints(geoself()) - 1)) @N = @P - point(geoself(), "P", @ptnum - 1);

@N = normalize(@N);
User Avatar
Member
475 posts
Joined: 7月 2005
Offline
Hi,

you can define rotation matrices for each point of the curve.

You can rotate the normal around the tangent and rotate the tangent around the new normal for example.

The amount of these rotation angles can be set independently for each point.

Using a ramp is an option.

Here is a modification of your example.

Attachments:
bend_curve_mod.hipnc (106.2 KB)

User Avatar
Member
6 posts
Joined: 3月 2018
Offline
BabaJ
If you look at your normals that are being used for direction you can see the final result is as should be - meaning your code is good.

However, your ‘input’ information, in this case the Normals need to be changed.

In your ‘reverse_N’ wrangle if you remove what you have and put in the following you will get the desired output:

@N = point(geoself(), "P", @ptnum + 1) - @P;

if(@ptnum == (npoints(geoself()) - 1)) @N = @P - point(geoself(), "P", @ptnum - 1);

@N = normalize(@N);


That works!Thank you so much!!

but I have another problem here.
The curve is just rotating which is respect to the root point rotation. It's not actually unfolding.
I did reset the pivot point at the end of the for loop, but I can not find any rotation of other points.
Did I miss something?
User Avatar
Member
6 posts
Joined: 3月 2018
Offline
Aizatulin
Hi,

you can define rotation matrices for each point of the curve.

You can rotate the normal around the tangent and rotate the tangent around the new normal for example.

The amount of these rotation angles can be set independently for each point.

Using a ramp is an option.

Here is a modification of your example.

Thanks!
the ramp idea is brilliant!
but I don't want to get the tangent rotated, just the normals.
I mean it worked well when the input is a straight line with no tangent space.
like this:

Attachments:
band_curve_01.hipnc (90.1 KB)

User Avatar
Member
475 posts
Joined: 7月 2005
Offline
Yes in your second example you are accumulating over the dir.

To avoid confusion, imho it is better to use “tangent” for the tangents of the curve and N for the normals. Sometimes the polyframe gives strange results for straight lines, but you will find some examples with ptf (parallel transport frames), which gives you stable frames for curves.

According to my first file, here is another modification, where you can perform a bend just using the first ramp (or second aswell for torsion). After this you can apply the node again to use just the second ramp to rotate the normals.

Attachments:
bend_curve_mod_X.hipnc (124.3 KB)

User Avatar
Member
6 posts
Joined: 3月 2018
Offline
Aizatulin
Yes in your second example you are accumulating over the dir.

To avoid confusion, imho it is better to use “tangent” for the tangents of the curve and N for the normals. Sometimes the polyframe gives strange results for straight lines, but you will find some examples with ptf (parallel transport frames), which gives you stable frames for curves.

According to my first file, here is another modification, where you can perform a bend just using the first ramp (or second aswell for torsion). After this you can apply the node again to use just the second ramp to rotate the normals.


That's exactly what I want to do!!!
Tanks for help!!
cheers!
  • Quick Links