Entropy Posted February 22, 2018 Share Posted February 22, 2018 Hello is there a more efficient way to calculate the world space tangent on a surface ? the method i use in the attached file seems limited as it uses boolean sections and polyframe to transfer the tangent to the surface any ideas on how to improve thanks in advance perpenticular_tangent.hipnc Quote Link to comment Share on other sites More sharing options...
Entropy Posted February 22, 2018 Author Share Posted February 22, 2018 Also i just noticed that there are problems with the initial direction of the tangents after the boolean operation some curves have their tangent direction reversed is there some easy way to clockwise all the curves ? thanks Quote Link to comment Share on other sites More sharing options...
petz Posted February 22, 2018 Share Posted February 22, 2018 here's a simple one ... hth. petz perpenticular_tangent_1.hipnc Quote Link to comment Share on other sites More sharing options...
Entropy Posted February 22, 2018 Author Share Posted February 22, 2018 (edited) that is ridiculously simple thanks a lot @petz any idea why the boolean operation reverses randomly the curve direction even when the same object copy is used to intersect ? i use various meshes not just planes to cut - intersect surfaces with the boolean operation and create the surface tangents perpendicular to the curves but there are inconsistency with the extracted curves is there any easy way to find those problematic curves and reverse them ? thanks in advance Edited February 22, 2018 by Entropy Quote Link to comment Share on other sites More sharing options...
petz Posted February 24, 2018 Share Posted February 24, 2018 due to the use of "remove shared edges" in the divideSop you got always two coincident polygons for every section. you need to delete duplicates and then make sure the normals of remaining prims are pointing into the same direction. instead, you could also set the output of the booleanSop to "seam" and check the curve direction based on point neighbours ... hth. petz Quote Link to comment Share on other sites More sharing options...
Entropy Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) i had no success determining whether or not a curve has its points ordered clockwise or anticlockwise float sum = 0.0; for (int i = 0; i < i@numpt; i++) { vector v1 = point(0,"P",i); vector v2 = point(0,"P",i+1) % i@numpt; sum += (v2.x - v1.x) * (v2.y + v1.y);// * (v2.z - v1.z); } setprimgroup (0, "reverse", @primnum, 0, "set"); if(sum > 0){ setprimgroup (0, "reverse", @primnum, 1, "set"); } obviously it is not right the above solution is for a 2d curve any idea for the 3d equivalent ? Edited February 28, 2018 by Entropy Quote Link to comment Share on other sites More sharing options...
satoru Posted March 2, 2018 Share Posted March 2, 2018 (edited) It is another way. However, this method does not work unless it has a structure that can be converted to a mesh. perpenticular_tangent_sy_2.hipnc Edited March 2, 2018 by satoru Quote Link to comment Share on other sites More sharing options...
Entropy Posted March 2, 2018 Author Share Posted March 2, 2018 (edited) Hi satoru thanks for your reply but unfortunately this is not working for my case i uploaded a new file to illustrate the issue i use polycut the result is the same as with boolean operations the unshared edges always produse two coincident polygons as petz said perpenticular_tangent_polycut.hipnc Edited March 2, 2018 by Entropy Quote Link to comment Share on other sites More sharing options...
satoru Posted March 2, 2018 Share Posted March 2, 2018 If it is a curve extracted from the surface, you can determine the direction with the inner product of the original N and the new N. I am sorry if it is a misunderstanding. perpenticular_tangent_polycut_sy.hipnc Quote Link to comment Share on other sites More sharing options...
Entropy Posted March 2, 2018 Author Share Posted March 2, 2018 Thank you very much @satoru Doumo arigatou gozaimasu Quote Link to comment Share on other sites More sharing options...
vinyvince Posted September 3, 2021 Share Posted September 3, 2021 On 02/03/2018 at 2:17 PM, satoru said: If it is a curve extracted from the surface, you can determine the direction with the inner product of the original N and the new N. I am sorry if it is a misunderstanding. perpenticular_tangent_polycut_sy.hipnc Trying to have all complex curves network i have to deal with be oriented properly to be able to use a signed distance to cut my mesh precisely without having to increase the mesh density, for this is need to orient my curves properllu. To what i could see in your simple example, while the orientation of the close curves are not correct, the tangent vector are oriently not uniformly in the same consistent direction, like for the mouth . I try to sort but didn't solve , any idea? @petz Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 3, 2021 Share Posted September 3, 2021 @vinyvince Math- 2016/-Sarajevo /Jaroslav Cerni/Berlin/Math/ How you cut your Geo? Can you Share some simple ex on Your exampel If its not for Rocket Science project that you do int he = pointhedge(0,@ptnum); vector nextP = attrib(0,'point','P',hedge_dstpoint(0,he)); vector edgeVector = nextP-@P; if (he==-1){edgeVector={0,0,0};} // in case this is an end point f@pscale = length(edgeVector); v@tangent = normalize(edgeVector); p@orient; ------------------------------------------------- #include "math.h" int n = npoints(0); // first point orientation vector xaxis = {1,0,0}; vector tangent = attrib(0,"point","tangent",0); vector rotaxis = normalize(cross(xaxis,tangent)); float rotangle = acos(dot(xaxis,tangent)); vector4 Q = quaternion(rotangle,rotaxis); setpointattrib(geoself(),"orient",0,Q); // parallel transport int currPoint = 0; vector4 cumQ=Q; do{ int he = pointhedge(0,currPoint); int nextPoint = hedge_dstpoint(0,he); if (nextPoint==-1){break;}// in case this is the end point vector currTan = attrib(0,"point","tangent",currPoint); vector nextTan = attrib(0,"point","tangent",nextPoint); rotaxis = normalize(cross(currTan,nextTan)); rotangle = acos(dot(currTan,nextTan)); Q = quaternion(rotangle,rotaxis); cumQ = qmultiply(Q,cumQ); // optional: additional twist by PI/2 for interlocking rings vector4 R = quaternion(PI/1,nextTan); cumQ = qmultiply(R,cumQ); setpointattrib(geoself(),"orient",nextPoint,cumQ); currPoint = nextPoint; }while(currPoint!=0); Quote Link to comment Share on other sites More sharing options...
vinyvince Posted September 3, 2021 Share Posted September 3, 2021 Oh my task for this studio is completed Tesan, i refused a couple of jobs, las t one yesterday as i need to rest a bit or i didn't feel exited The example im using is the one used in this forum , just noticing the tangent orientation could go CW or CCW for the curves where the winding have been solved, after on some complex case, i have a bunch of 3d curves in space which will like to orient all in the same direction. in 2d space , you could use a circle or cyl mapping to order then and polyframe, but in 3d space, i haven't found out. Just looking at the I don't have the math.library, What's this line is supposed to do? p@orient; Quote Link to comment Share on other sites More sharing options...
vinyvince Posted September 3, 2021 Share Posted September 3, 2021 (edited) This is an example of what i haven't fun with personally... Looks like mostly everyone is only considering Houdini for FX or scene assembly, a pity no? sorry for the Opengl capture, no power or time to make a beautiful render here No uv , only input is this glorious female mesh ________________________________________________________________ Vincent Thomas (VFX and Art since 1998) Senior Env and Lighting artist & Houdini generalist & Creative Concepts http://fr.linkedin.com/in/vincentthomas Edited September 3, 2021 by vinyvince Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 3, 2021 Share Posted September 3, 2021 56 minutes ago, vinyvince said: What's this line is supposed to do? part of something that just having Fun on The Sun . Nice example there you have .. "post final prim count " ...on that mesh ..Just wonder 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.