Welcome to odforum
Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.
Blacklisted_Guy
Members
Content count
21 
Joined

Last visited
Community Reputation
1 NeutralAbout Blacklisted_Guy

Rank
Peon
 Birthday March 22
Personal Information

Name
Jonne Geven

Location
Netherlands

Interests
Procedural modeling, vfx and modeling
Recent Profile Visitors
491 profile views

//Find the neighbours of the current point and add the to an array int neighs[] = neighbours(0, @ptnum); //Initialize values to be used in the loop float lowest = 0; int lowestI = 0; //Initialize the loop to loop as often as there are items in the "neighs" array (usually two as the point has two neighbours) for(int i = 0; i < len(neighs); i++) { //Get the position of the currently looped neighoburs vector pos = point(0, "P", neighs[i]); //Figure out the distance between the current and neighbour point float len = distance(@P, pos); //If this is the first iteration of the loop, set the lowest distance to be the current distance if(i == 0) { lowest = len; } //If this isnt the first loop and the current distance is smaller than the lowest distance, make the current distance the new lowest. else { if(lowest > len) { lowest = len; lowestI = i; } } } //set the point scale to be the lowest distance f@pscale = lowest; /* The pscale attribute is used by the bevel as a multiplier to make the bevel bigger or smaller. Because this value is equal to the lowest edge length it will never be too big for the edges it is on */ Commented out every line, hopefully this helps!

I think I might be a bit late to the party. This is how I'd solve it bevel_voronoi.hiplc

kernel void kernelName( int P_length, global float * P ) { int idx = get_global_id(0); if (idx >= P_length) return; } This is the code I'm running. As of now it's just the generated kernel.

Blacklisted_Guy started following OpenCL error

Hello there, I've been trying to learn openCL and use it in houdini. To start I imported the position attribute and generated a kernel, but it keeps spitting out this error (without editing or adding things to the code) OpenCL Exception: clSetKernelArg (51)

Ah, too bad. Python it is then.

Blacklisted_Guy started following Reading files from disk using vex

Hello there! For a current project I'm needing to read files from disk and apply operations per line. I know python offers a way to read files. But since vex can be multithreaded I wanted to see if there is a way to do it. Looking through some forums I found functions from houdini 14 that allowed for reading files, but these don't seem to be working anymore. Thank you for a reply, Jonne

thank you for the link, I'll be looking through it!

yes, the distanceToPoint function returns a vector with the 2D distance between the points and a 3D distance. So, what you'd suggest is running the script with a for loop in detail mode instead of in point mode? I'll try that one! Thank you for the advice!

Hello houdini wizards, I've been trying to make a script that makes a curve out of a bunch of points by finding the closest point. For some reason though, the points don't connect to their closest point File with the script in action as well as the script down below. //// // Find closest point V1 // // By Jonne Geven // //// //imported functions //returns: [0] = 2D distance. [1] = 3D distance vector2 distanceToPoint(int currentPoint; int targetPoint; int currentPointInput; int targetPointInput) { //importing user inputs int cp = currentPoint; int cpi = currentPointInput; int tp = targetPoint; int tpi = targetPointInput; //extracting point position vector cpp = point(cpi, "P", cp); vector tpp = point(tpi, "P", tp); //deltas float dx = tpp[0]  cpp[0]; float dy = tpp[1]  cpp[1]; float dz = tpp[2]  cpp[2]; //2d distance float DD2; DD2 = sqrt((dx * dx) + (dz * dz)); //3d distance float DD3; DD3 = sqrt((DD2 * DD2) + (dy * dy)); vector2 distances = set(DD2, DD3); return distances; } //closest point int closePoint(int currentPoint;int currentPointInput; int targetPointInput) { int tpc = npoints(targetPointInput); //this used to be user defined but that doesnt work since it needs to be the amount of points int cp = currentPoint; int cpi = currentPointInput; int tpi = targetPointInput; float C; float CP; int returnValue; for(int i = 0; i < tpc; i++) { //distance between points C = distanceToPoint(cp, i, cpi, tpi)[0]; //importing Z values vector zvalT = point(tpi, "P", i); vector zvalC = point(cpi, "P", cp); if(zvalT[2] < zvalC[2]) //comparing the target and current z position to make sure { //the curve has a direction //max search distance and making sure the processed point isn't selected. if(abs(C) < 19 && C != 0) { if(i != 0) { //comparing current distance to currently smallest distance if(C < CP) { CP = C; returnValue = i; } } //initializing CP value with first distance else if(i == 0) { CP = C; returnValue = 0; } } } } return returnValue; } //finding closestpoint i@target = closePoint(@ptnum, 0, 0); //This script is made with the general direction being Z //vector pp0 = point(geoself(), "P", @ptnum); //vector pp1 = point(geoself(), "P", target); int line = addprim(0, "polyline"); addvertex(0, line, @ptnum); addvertex(0, line, @target); //// // For questions // // odforce: Blacklisted_Guy // //// closestPointNotFound.hiplc

Hey there fellow scripters, I've run into an issue with the len function not returning the size but an error. For some reason it's expecting an identifier whilst I did input the right variables theProblem.hipnc

Hello everyone, I'm fairly new to vex and am currently working on adding normals to certain points. For this I'm using this script in a point wrangle node. int count = neighbourcount(0, @ptnum); float xpos = @P.x; if (count == 1){ setpointgroup(geoself(), "borderGroup", @ptnum, 1, "set"); if (xpos > 0){ addattrib(geoself(), "point", "N", {1,0,0}); } if (xpos < 0){ addattrib(geoself(), "point", "N", {1,0,0}); } } But, for some reason unless the X value is 10 or 10 it always chooses the xn = 1. Not sure why. (The "xpos < 0" used to be an "else" but I changed it to check it it would work). A big thank you in advance!

that worked! Thank you so much

I started working on some vex practice and decided to use it for a switch and a bunch of statements I've wrote this script but the second if statement (rot =1 && flip = 0) doesn't seem to be giving the right value. int rotatetion= ch("rot"); int flipvalue= ch("flip"); @switch = 0; if ( (rotatetion == 0) && (flipvalue == 0)) { @switch = 1; } if ( (rotatetion == 1) && (flipvalue == 0)) { @switch = 1; } if ( (rotatetion == 0) && (flipvalue == 1)) { @switch = 0; } if ( (rotatetion == 1) && (flipvalue = 1)) { @switch = 0; } rot and flip are integer sliders on the attribute wrangle node itself.

That worked! Thank you so much!

Here's the file I'm currently working on ptwrangleTest.hipnc