![]() May want to use frozen geometry for speed-crucial operations. Since Houdini does not need to look up the SOP node for each access, so you Accessing frozen Geometry is slightly faster, freeze returns another Geometry object that will If you do not want the geometry to update when the SOP recooks, you can call When the node errors are resolved, until then your code should handle thisĮxception to avoid getting further errors. ![]() Read-only reference is still 'live' and so methods on it will be accessible Variable then any calls to methods on that variable will throw a Read-only references to geometry on a SOP node, if the SOP in questionįails to cook after the read-only reference has been assigned to a Int near_pts = pcfind_radius(0, "group_name","P", "pscale", 1.Whenever you call a method on a hou.Geometry object, Houdini will firstĪttempt to acquire a handle to the underlying geometry. Int near_pts = pcfind_radius(0, "P", "pscale", 1.0, max_dist, max_pts) ![]() The cool thing about this is that we can easily use the pscale as radius for the search and search just in a specific group of //points The cool thing is that it returns directly an array and not a //point cloud. Int neighbour_points = you are a fan of point clouds there is also a function called pcfind_radius. Int nearpoint = (0, There is also the neighbours function which gives us a list of points connected to the point through some sort of primitives. But as before if we run it in the same //geometry, we are not going to get the real closest point There is also the nearpoint function which returns just an integer with the closest point. Int closest_point = near_pts //take the second element of the list, so index number 1 Int near_pts = max_dist, max_points) // create a list of all points in the radius until reaches max_points the first, but the second element in the list (which has index number 1). If we need the real closest point, we have to take not For Houdini the closest point in the same geometry is going to be itself. If we look at the closest point in the same geometry coming from the first input ( so input number 0) there is another thing to keep in // mind. Pay attention that this function returns a list of all the points, so returns an array (that's why I added to the attribute name). We can specify how far we search and the maximum amount of points Nearpoints function returns the closest points to the current. Int inst = uniqueval(0,"point","sourcept", i) //the unique value at index inst) //put all the unique values in an array called There are several ways to find the closest points and there are a couple of things to keep in mind Int n = numiqueval(0, "point", "sourcept") //the amount of unique values in the attribute "sourcept" For some reasons we don't know the number of source //particles, but we need to know their values and put all of them in an array. Each //sourced particle is storing the point number of the particle it's sourced from. Let's say in this case let's say we have a certain number of particles sourcing 100+ particles each. For example if the unique values are 9 and in the function you put 9 as index, is // going to return the 9th and last unique value uniqueval returns the unique value at a certain index. numiqueval is going to return the integer number of unique values stored in an attribute I haven't used this a lot but I've found "numiqueval" and "uniqueval" useful a couple of times, especially for loops.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |