Noobini Posted July 6, 2017 Author Share Posted July 6, 2017 (edited) Ground Zero: pretty obvious what this does....ie. no more bothering with getting the box's height then half it and move it up blah blah blah...just do this 'one' liner.... attribexpression/snippet Ground Zero @P;@P.y -= getbbox_min(0).y Edited January 3, 2018 by Noobini Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 13, 2017 Author Share Posted July 13, 2017 (edited) (Dirty) LookAt: attribexpression/snippet Lookat 2nd Input (@P - getbbox_center(0)) * lookat(getbbox_center(1),getbbox_center(0)) + getbbox_center(0) Why dirty ? coz it's manipulating points....not actually transforming the object I used the Pighead as an easy object for illustration. By default, the pig is looking down on its Z axis...so if you are using a pointy object (ie. cone)...point your object down its Z axis first... Edited January 3, 2018 by Noobini 2 Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 13, 2017 Author Share Posted July 13, 2017 (edited) Align: (to bbox extremities) (sorry for breaking the 'one line' rule...) attribexpression/snippet Align @P; int alignaxis = chi("axis"); float offset = ch("offset"); if(alignaxis == 0){ @P.y -= getbbox_min(0).y - offset; } else if(alignaxis == 1){ @P.y -= getbbox_max(0).y - offset; } else if(alignaxis == 2){ @P.x -= getbbox_min(0).x - offset; } else if(alignaxis == 3){ @P.x -= getbbox_max(0).x - offset; } else if(alignaxis == 4){ @P.z -= getbbox_min(0).z - offset; } else { @P.z -= getbbox_max(0).z - offset; } Edited January 3, 2018 by Noobini Quote Link to comment Share on other sites More sharing options...
Noobini Posted July 14, 2017 Author Share Posted July 14, 2017 (edited) Stack: attribexpression/snippet Stack @P; int stackaxis=chi("axis"); float stackoffset=ch("offset"); @P+=getbbox_center(1); if(stackaxis==0){ @P.x+=getbbox_max(1).x-getbbox_center(1).x-getbbox_min(0).x+stackoffset; } else if(stackaxis==1){ @P.y+=getbbox_max(1).y-getbbox_center(1).y-getbbox_min(0).y+stackoffset; } else{ @P.z+=getbbox_max(1).z-getbbox_center(1).z-getbbox_min(0).z+stackoffset; } Edited January 3, 2018 by Noobini 2 Quote Link to comment Share on other sites More sharing options...
PalTopin Posted July 17, 2017 Share Posted July 17, 2017 On 29/6/2017 at 0:06 AM, Noobini said: Collision Deform: - 1st input - Geo to deform - 2nd input - Collider attribexpression/snippet Collision Deform length(@P-point(1,"P",nearpoint(1, @P)))<ch("dist")?lerp(@P,@P+@N,ch("deform")*chramp("lip",fit(length(@P-point(1,"P",nearpoint(1,@P))),0,1,0,1))*(1-length(@P-point(1,"P",nearpoint(1,@P))))):@P CheapAssCollisionDeform.hipnc DUDE YOU'RE AWESOME!!! Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 13, 2017 Author Share Posted October 13, 2017 (edited) Planar Symmetrical Taper: unlike a 'normal' Taper that tapers from one end to the other, this taper starts from centre and symmetrically tapers out to the 2 ends. EDIT: orig version has hardcode of '- 0.5', now I've used 'cent' instead so you can slide the centre to where ever you want, but normal usage is when you first apply the Point SOP, create the params then assign Centre = 0.5 as default. attribexpression/snippet PlanarSymTaper @P; int plane = chi("TaperPlane"); float tap = 10*ch("Taper"); float cent = ch("Centre"); if(plane==0) { @P.x *= cos(tap*abs(relbbox(0,@P).y - cent)); } else if(plane==1) { @P.y *= cos(tap*abs(relbbox(0,@P).x - cent)); } else if(plane==2) { @P.x *= cos(tap*abs(relbbox(0,@P).z - cent)); } else if(plane==3) { @P.z *= cos(tap*abs(relbbox(0,@P).x - cent)); } else if(plane==4) { @P.y *= cos(tap*abs(relbbox(0,@P).z - cent)); } else { @P.z *= cos(tap*abs(relbbox(0,@P).y - cent)); } Edited October 13, 2017 by Noobini Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 15, 2017 Author Share Posted October 15, 2017 so I watched this intro video:https://www.thegnomonworkshop.com/tutorials/houdini-fast-track-vol-1-fundamentals and saw the barrel, basically after you bend the staves, they have to be tapered to fit at the ends, so as you can see in the video, a Linear taper (in the Bend) was used....nah....doesn't look right, using the Smooth option got close..but still not quite right...plus you can see the thickness of the stave is compromised...hence I thought, stuff it...I'll do my own Taper...and so PlanarSymTaper was conceived. Then did me own barrel of fun HDA too...ahoy me zombie... Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 16, 2017 Author Share Posted October 16, 2017 PlanarSymTaper: ok, this version is improved. Previously, your geo needs to be properly centred around the world origin, so if you transform your 'box' somewhere...you'd notice the Taper effect goes wonky... Now it does not matter where your geo is in the world, the Taper effect is always relative to the 'local' bbox. attribexpression/snippet PlanarSymTaper @P; int plane = chi("TaperPlane"); float tap = 10*ch("Taper"); float cent = ch("Centre"); vector c = getbbox_center(0); vector relbbox = relbbox(0,@P); @P -= c; if(plane==0) { @P.x *= cos(tap*abs(relbbox.y - cent)); } else if(plane==1) { @P.y *= cos(tap*abs(relbbox.x - cent)); } else if(plane==2) { @P.x *= cos(tap*abs(relbbox.z - cent)); } else if(plane==3) { @P.z *= cos(tap*abs(relbbox.x - cent)); } else if(plane==4) { @P.y *= cos(tap*abs(relbbox.z - cent)); } else { @P.z *= cos(tap*abs(relbbox.y - cent)); } @P += c; 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted November 8, 2017 Author Share Posted November 8, 2017 is it just me or has SESI put some of the snippets here into their H16.5 ?: C:\Program Files\Side Effects Software\Houdini 16.5.268\houdini\VEXpressions.txt (yes...my head is swelling at an alarming rate...) 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 14, 2017 Author Share Posted December 14, 2017 (edited) Radar Selection: (why separate expressions ? coz the GroupVEXpressions doesn't allow multiple statements, strictly 1 liner) groupexpression/snippet Radar X chi("X_Axis")==0 ? degrees(acos(normalize(set(@P.x,0,@P.z)).x))<ch("angle") : degrees(acos(-normalize(set(@P.x,0,@P.z)).x))<ch("angle") groupexpression/snippet Radar Y chi("Y_Axis")==0 ? degrees(acos(normalize(set(@P.x,@P.y,0)).y))<ch("angle") : degrees(acos(-normalize(set(@P.x,@P.y,0)).y))<ch("angle") groupexpression/snippet Radar Z chi("Z_Axis")==0 ? degrees(acos(normalize(set(@P.x,0,@P.z)).z))<ch("angle") : degrees(acos(-normalize(set(@P.x,0,@P.z)).z))<ch("angle") Please note: from 16.5 on, the VEXpressions.txt file is found in C:\Program Files\Side Effects Software\Houdini 16.5.xxx\houdini (just edited to make it work for 3D object as well, ie. a box, not just flat objects) Edited December 14, 2017 by Noobini 2 Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 15, 2017 Author Share Posted December 15, 2017 while fiddling about with the Radar...I couldn't find vangle()...does anyone know where it's gone ? I then followed the 'help' to try and get the signed angle...seems a bit convoluted so ended up doing my own basic trig... Quote Link to comment Share on other sites More sharing options...
f1480187 Posted December 16, 2017 Share Posted December 16, 2017 @Noobini, you mean expression function vangle? No such function in VEX, afaik. You can see it is quite trivial to implement. Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 16, 2017 Author Share Posted December 16, 2017 (edited) hillbillies aren't very good at maths, they can count to only 20 or 21...so how trivial does this vangle look ? I tried to do what the help told me to: vangle(a, b ) will return the same result as acos ( dot (normalize(a), normalize(b)) ). It will not produce a negative result because the dot product is symmetric, and does not take the order of a and b into consideration. You can define a turning order with the left hand rule or something similar. Tip Try the following expression to get a signed result: sign(dot(cross(cross(a,b),b),a)) * vangle(a,b) but for whatever reason couldn't get it to work...so did my own thing in the end... esp. the signed thing, so imagine 12oclock, I want to know the angle between the vector {0,0,-1} and some vector, assuming also flat on the ground...so I was hoping to get results from 0 - 360 degrees...but with my current setup, if you want 45degs selection, you'd actually get 45deg on either side of 12oclock Edited December 16, 2017 by Noobini Quote Link to comment Share on other sites More sharing options...
f1480187 Posted December 16, 2017 Share Posted December 16, 2017 (edited) /0 Edited December 16, 2017 by f1480187 duplicate post Quote Link to comment Share on other sites More sharing options...
f1480187 Posted December 16, 2017 Share Posted December 16, 2017 I meant it's easy to copy "acos (dot(normalize(a), normalize(b)))" from the docs. My last best result in counting was "potato" before I run away. Here is what I typically use to get 0-360 degrees: 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 16, 2017 Author Share Posted December 16, 2017 Radar: (all in one) groupexpression/snippet Radar chi("Axis")==0 ? degrees(acos(normalize(set(@P.x,0,@P.z)).x))<ch("angle") : chi("Axis")==1 ? degrees(acos(-normalize(set(@P.x,0,@P.z)).x))<ch("angle") : chi("Axis")==2 ? degrees(acos(normalize(set(@P.x,@P.y,0)).y))<ch("angle") : chi("Axis")==3 ? degrees(acos(-normalize(set(@P.x,@P.y,0)).y))<ch("angle") : chi("Axis")==4 ? degrees(acos(normalize(set(@P.x,0,@P.z)).z))<ch("angle") : degrees(acos(-normalize(set(@P.x,0,@P.z)).z))<ch("angle") Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 11, 2019 Author Share Posted December 11, 2019 been awhile...in H18 the presets are in: C:\Program Files\Side Effects Software\Houdini 18.x.xxx\houdini\VEXpression.txt top points: groupexpression/snippet top points relbbox(0,@P).y==1 bottom points: groupexpression/snippet bottom points relbbox(0,@P).y==0 obviously it wouldn't work if your geo is uneven like a tube with mountain applied to it. Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 11, 2019 Author Share Posted December 11, 2019 (edited) midsection points: groupexpression/snippet midsection points abs((relbbox(0,@P).y)-0.5)<ch("spread") hmmm...interesting...if I change to prims, it still works !!! might revise the snippets soon. Edited December 11, 2019 by Noobini Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 11, 2019 Author Share Posted December 11, 2019 (edited) revised snippets: work for both prims/points. Since absolute 1 or 0 are no longer there, just enter 0.001 for points in spread, slightly more for prims. top: groupexpression/snippet top relbbox(0,@P).y> (1-ch("spread")) bottom: groupexpression/snippet bottom relbbox(0,@P).y < ch("spread") Edited December 11, 2019 by Noobini Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 18, 2019 Author Share Posted December 18, 2019 (edited) Corner Points: groupexpression/snippet Corner Points chf("concav_vexity")==0?@curvature<-1:chf("concav_vexity")==1?@curvature>1:abs(@curvature)>chf("concav_vexity") 0 - concave only 1- convex only other - both concave/convex depending on magnitude, note magnitude can exceed 1. works best on 2D objects, ie. if you extrude some flat object, I'm not sure how the measure curvature algo works for this. EDIT: ahh got it, I thought it didn't work properly but it did, I just forgot to enable Output Back in the extrude, so once Output Back is enabled, it will select the corners correctly on both top and bottom level of the extruded object. I will not select 'inline' points tho. Edited December 19, 2019 by Noobini 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.