Taper with expression ?

   11802   25   1
User Avatar
Member
767 posts
Joined: April 2014
Offline
I want to create this;
on a cylindrical type shape for it's Z axis.


The following expression is applied on a point sop > standard > positionZ parameter.
ch("./width")*sin($BBZ)*4
When adjusting the parameter, the shape deforms but in a uniform way as if you're simply scaling the cylindrical along it's X ?
Edited by _Christopher_ - May 23, 2017 09:41:08
【T】【C】【S】
User Avatar
Member
2627 posts
Joined: June 2008
Offline
You can use a ramp to generate a @width attribute which you can supply to a polywire radius. Then you can create the shape as needed by tweaking the ramp.
Edited by Enivob - May 23, 2017 11:31:59

Attachments:
ap_ramp_based_taper.hiplc (61.8 KB)
Untitled-1.jpg (215.8 KB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
767 posts
Joined: April 2014
Offline
I need to use a regular expression. After the skin sop I have a point sop, to which I'm applying the expression from my first post on the positionZ of the point sop.

I know there is a way to which I can adjust a parameter (slider) and it will taper the skinned surface from bottom to top; what am I doing wrong in terms of the expression ?
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
here is a quick and dirty solution for a Taper using the ramp. It scales the geometry in X and Y direction (only) with the amount of the Z-Value, which is defined by the ramp using the bounding box.

Attachments:
Taper.hipnc (86.4 KB)

User Avatar
Member
767 posts
Joined: April 2014
Offline
@Aizatulin - I never used the Inline Vop node. What is going on with the P and the $Q=P etc ?

I saw an example a long time ago whereas using regular expression within a point sop one was able to adjust a parameter(slider) and control the taper and only sin() expression and the bbox variable were used ?
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
you can use the inline vop to do some quick vex. There always many ways to do the same thing. For example $Q = P is just a copy (maybe not necessary anyway).
But if I understand you correctly you want to use an expression (a function) instead of using a ramp. For example you want to write sin() –> scale along Z-Axis follows sin curve etc…?
User Avatar
Member
87 posts
Joined: May 2011
Offline
http://www.sidefx.com/docs/houdini/ref/expression_cookbook [www.sidefx.com]
— dedeks 3000 —
User Avatar
Member
767 posts
Joined: April 2014
Offline
What I was after was that in the expression cookbook which dedeks3000 posted. Except two things, how do I inverse the expression. @Aizatulin I want to use an expression with a ramp to taper a shape along the X & Z ? Stupid me forgot to keep the current point position with @P.x & @P.z followed parameter

What other node can be used instead of the point sop out of curiosity, to do what I want to do ?

How can I append this expression with another parameter so I can control the thickness of the width independently of the other parameter, yet keep it condensed into one expression ?

@P.z*(ch("width")^-$BBY)*+4.4*(ch("widthtaper")^$BBY)
Expression did exactly what I wanted FYI

I must remember to put what I want evaluated first in brackets

From the top view, I want to append the above expression to control the thickness warp for the postionZ ?

Edited by _Christopher_ - May 24, 2017 11:08:05
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
I am a bit confused sry. You want to use the ramp and the expression at the same time as combination?
But let me try to explain, what I understand under the “Taper”-Operator. A Taper is a local scale of a geometry (or whatever contains points) along an axis or a curve, where every point of the geometry has an unique projection on the axis/curve, which is local transformation center of the point. These projected points have properties like z-value of an axis or the u-value of a curve, which can be used to push this value into a function (like a ramp, like an expression) to calculate a modified value, which can be used as scale-amount for the point of the geometry from which the projection came from.
The thing is, that if you want to use an expression to have control on the taper amount, you have to know on which value the expression must evaluated, in other cases it can be everything.
If you look on my example. Go into the TaperVop –> inline1 –> you see an expression like “$scaleRamp = abs(sin(12*s));”. “s” in my case is the middleline of the bbox (should be). You can write any function here you want, which modifies s.
If you go into TaperVop –> inline2 –> you see “$ramp = $ramp*scaleRamp;”, the ramp value is scaled by the scaleRamp value. Of course this is only an example (you can do alot more here just try out if you want).
Try out my example and check out, if this suffice your needs after all. But I will be not available for a few days for questions or feedback.

Attachments:
Taper_mod.hipnc (93.5 KB)

User Avatar
Member
767 posts
Joined: April 2014
Offline
It's not to say your solution was wrong, it's that my approach created a linear transition taper, while you're solution allows more flexibility because of the spline ramp. Although I don't quite understand the use of the Inline vop node ?
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
don't be afraid of using the inline vop. I like it, because you can write quickly vex code. You can use the attribute wrangle aswell. Here is another solution, which is even more general but slower, but here you can use any curve as second input. For example, if you want to taper a torus along its inner circle, you can do it this way. You can use it also for a linear spline to any direction. The next step can be substituting the scale by whatever you want like rotation for twist or translate for shear etc… but here it would also be useful to have local x-y-z axis (x~tangent, y~bitangent,z~cross(x,y) for example).

Attachments:
Taper_Curve_simple.hipnc (93.6 KB)

User Avatar
Member
767 posts
Joined: April 2014
Offline
The inline vop is similar to the wrangler. What is the difference between snippet and inline vop ?
You must declare the variable within the output tabs of the Inline vops ?

$Q = P - CurvePos;

Is P point position ? You don't need to declare the @ ?
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
Yes P is the point position, CurvePos is the nearest curve point to P and you don't have to use the @ Operator in the inline vop. This is one difference to the wrangle, where you write @P = … or something. But these are only notations, the formulas or calculations will stay the same anyway.
User Avatar
Member
767 posts
Joined: April 2014
Offline
@Aizatulin I meant to ask, what is P<bracket>2<bracket> I couldn't type the brackets in this post, as it wouldn't get shown ?
Edited by _Christopher_ - June 10, 2017 10:38:08
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
Yes you are right, I can't see the square brackets in the preview aswell, so I will use round brackets.
P(0) is the x-component, P(1) the y-component and P(2) the z-component of P. This equals to
P.x, P.y and P.z, so that P(0) ~ P.x, P(1) ~ P.y, P(2) ~ P.z.
The advantage of the number-notation in my opinion is, that you can write shorter functions like
P(i) = f(i) in a loop (f is int –> float function), where you have to write for the letter-notations
P.x = f(0), P.y = f(1), P.z = f(2), but this is no big deal anyway, just use whatever you like more.
User Avatar
Member
767 posts
Joined: April 2014
Offline
@Aizatulin This maybe a little difficult to describe. How can I create a shape which is seen in this screen capture.



The back where the red line is placed warps out; while the inside of the shape, bulges at the bottom and stops at the top. How do you control different sides of the geometry but the same piece of geometry ?
Edited by _Christopher_ - July 1, 2017 23:17:43
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
if you construct your geometry by shapes, you can blend between (in my example two) different profile curves. In the ramp VOP you can use the “blend_value” to do this.

Attachments:
ta_sweepscale_blending_X.hipnc (216.9 KB)

User Avatar
Member
767 posts
Joined: April 2014
Offline
@Aizatulin The outside of the shape warps out ? Also how do you taper the inside shape ?

The polyframe node creates a tangentu attribute, why did you create another ?

$Q = primuv(OpInput2, "P", prim, $ramp);
$ramp is how to call the ramp parameter within inline vops ? As well, what is the origin of the int prim ?
Edited by _Christopher_ - July 2, 2017 23:11:12
【T】【C】【S】
User Avatar
Member
495 posts
Joined: July 2005
Offline
Hi,
The example, which I've posted is very old and it is experimental aswell. The relevant part according to your problem (what I thought) is the blending part.
Christopher_R
$Q = primuv(OpInput2, “P”, prim, $ramp);

$ramp is how to call the ramp parameter within inline vops ? As well, what is the origin of the int prim ?


Ignore the “attribvop1” please, because I've tried some parameterisation stuff with ramps and I just recognized, that this was the inefficient version with xyzdist…, better to use something like float(ptnum) / float(numpt) instead.
prim can be set to 0 and $ramp is the variable output name of the float ramp used in “attribvop1”.

Christopher_R
The polyframe node creates a tangentu attribute, why did you create another ?

Yes ignore this as well, because it isn't used and I can't remember why. It should be used for the up vector.

Christopher_R
@Aizatulin The outside of the shape warps out ? Also how do you taper the inside shape ?

Please try to describe your problem in another way.
Are you able to use splines to construct your geometry or do you have the geometry already and want to modify it. What do mean with warp out? What is the outside/inside shape?

Attachments:
ta_sweepscale_blending_Y.hipnc (211.0 KB)

User Avatar
Member
767 posts
Joined: April 2014
Offline
Christopher_R
The polyframe node creates a tangentu attribute, why did you create another ?

Yes ignore this as well, because it isn't used and I can't remember why. It should be used for the up vector.

If I bypass these nodes, the result is completely wrong, keeping these nodes is close to the result I want.

Please try to describe your problem in another way.
Are you able to use splines to construct your geometry or do you have the geometry already and want to modify it. What do mean with warp out? What is the outside/inside shape?
The shape in both your sample scenes are as mentioned heading in the right direction. What I mean't by warp out is;



The inside shape, being the scenes you posted, I want to have control over the taper but keep the bulge; I hope you understand ?

【T】【C】【S】
  • Quick Links