# Deforming curve with vex (sin)

## Recommended Posts

Im trying to deform a curve with vex. I want to deform it with a sin function.

Kinda rookie on vex but i thought this would work.

I create a curve with just a start and end point.

Resample it to say 50 points.

Add a attributeWrangle and add this vex code: @P.y = sin(@P.y * 500) * 0.1;

I get no errors in the code but i dont get any result at all either.

Anyone got any clue?

I tested alot of different numbers just to make sure it wasnt the size of the sin curve but i get nothing.

##### Share on other sites
19 minutes ago, ekan de said:

Add a attributeWrangle and add this vex code: @P.y = sin(@P.y * 500) * 0.1;

assuming your line is by default in Y direction, straight up...(and why bother with resampling, in Line just say 50 points)

then it would make better sense if you perturb the X direction

@P.x = sin(@P.y * 2) * 0.1;

and 500 in houdini is huge, innit ? ahh, sorry that's freq...doesn't matter..

Still, nothing wrong with you moving in Y direction...now you're just adjusting the point distribution along Y axis that's all..

Edited by Noobini

##### Share on other sites

Sorry. the curve is in x axis on the grid. i made a typo here on the forum. This is what i write in vex: @P.y = sin(@P.y * 2) * 0.1;

500 was just an example. i have tried everything from 0.1 to much much higher than 500.

Im using H16.0.5.

So it should work?

Took a glance at the link Sepu posted but need a bit more time to dig deeper and read more.

curveSine.hipnc

##### Share on other sites

then use @P.y = sin(@P.x * 2) * 0.1;

because your variable, the thing that changes incrementally...is in X.....not Y

Edited by Noobini

##### Share on other sites

If you read "matt wiki" you will understand why it isn't working. its maybe 10 min. Go ahead and read and understand what is going on.

## Create an account

Register a new account