amin.khormaei Posted June 17, 2021 Share Posted June 17, 2021 (edited) what's the Geometry traversal's application in Houdini? best regards. Edited June 17, 2021 by amin.khormaei Quote Link to comment Share on other sites More sharing options...
acey195 Posted June 19, 2021 Share Posted June 19, 2021 (edited) Hey, you mean this? : https://www.sidefx.com/docs/houdini/vex/geometry.html it allows you to run your vex code over for example primitives, while retrieving(or changing) data on points or vertices among other things Edited June 19, 2021 by acey195 1 Quote Link to comment Share on other sites More sharing options...
amin.khormaei Posted June 19, 2021 Author Share Posted June 19, 2021 Could you show me a simple example? Quote Link to comment Share on other sites More sharing options...
acey195 Posted June 22, 2021 Share Posted June 22, 2021 why not you could do something like (creating a prim attribute from points data): //run this over primitives, to calculate the perimeter using the point data. //note that this is not the most efficient way to do this, but as an example to what options this gives you: int pts[] = primpoints(0, @primnum); float sumOfTheDistances = 0; for(int i=0; i < (@numvtx-1); i++){ vector pos0 = point(0, "P", pts[i]); vector pos1 = point(0, "P", pts[i+1]); sumOfTheDistances += distance(pos0, pos1); } f@perimeter = sumOfTheDistances; // create a primitive attribute or the other way (creating a vertex attribute while processing prims): //run this over primitives to calculate the same thing a polyframe would, but as a vertex attribute, so you do not have to make the points unique: int verts[] = primvertices(0, @primnum); vector forwardDir; for(i = 0; i < (@numvtx-1); i++){ vector pos0 = point(0, "P", vertexpoint(0, verts[i])); //get the point data, from the vertex (just to demo the conversion, vector pos1 = point(0, "P", vertexpoint(0, verts[i])); //the "P" data should also be fetchable here using vertex() instead of point() forwardDir = normalize(pos1 - pos0); setvertexattrib(0, "N", verts[i], -1, forwardDir); } setvertexattrib(0, "N", verts[-1], -1, forwardDir); //put the same data on the last vertex, as the second to last one note that I have coded this "blind" (did not test it) so hopefully the code runs, but there could be a typo somewhere 1 Quote Link to comment Share on other sites More sharing options...
amin.khormaei Posted June 22, 2021 Author Share Posted June 22, 2021 Thank you , you made my day Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted June 23, 2021 Share Posted June 23, 2021 My favorite "traversal" adds primitive objects to points. Unfortunately there is very little types to choose from. // Choose random primitive types from list string types[] = {'sphere', 'circle', 'tube'}; int index = int(rand(i@ptnum) * len(types)); int prim_add = addprim(0, types[index], i@ptnum); // apply point orientation from polyframe node matrix3 xform = set(v@tangentv, v@N, v@tangentu); scale(xform, 0.05); setprimintrinsic(geoself(), "transform", prim_add, xform); add_prims.hipnc 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.