hoknamahn Posted July 4, 2005 Author Share Posted July 4, 2005 Hey, guys! How to compute the point normals? I try to calculate the point normals thus nml_index = holder_gdp->addPointAttrib("N", Quote Link to comment Share on other sites More sharing options...
George Posted July 4, 2005 Share Posted July 4, 2005 Try just calling "holder_gpd->normal();" George. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 5, 2005 Author Share Posted July 5, 2005 Thanks, George, it works. But I can't understand why I get two different results in this case holder_gdp->normal(); gdp->merge(*holder_gdp); and gdp->merge(*holder_gdp); gdp->normal(); In the first case I give an incorrect result. But in second I see what I want to see. Any ideas? Quote Link to comment Share on other sites More sharing options...
George Posted July 5, 2005 Share Posted July 5, 2005 Well in the first case you're computing the normals on the geometry that doesn't include anything in gdp, so the normals in gdp will be set to a default (I think (0, 0, 0)) -- which will result is ugly blackness. In the second case you're computing the normals on the entire gdp. George. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 5, 2005 Author Share Posted July 5, 2005 No, in the first case holder_gdp contains the polygonal geometry and in the second case too (first and second holder_gdp are same). And all normals in the first case have values approximately {1, -1, 0.15}. Strange... Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 6, 2005 Author Share Posted July 6, 2005 I try to add "Cd" point attribute illum_index = gdp->addPointAttrib("Cd", sizeof(UT_Vector3), GB_ATTRIB_VECTOR, &result); Shader sees this attribute, but I don't see it in viewport. How to visualise Cd in viewport? Quote Link to comment Share on other sites More sharing options...
George Posted July 6, 2005 Share Posted July 6, 2005 illum_index = gdp->addPointAttrib("Cd", sizeof(UT_Vector3), GB_ATTRIB_VECTOR, &result); 19313[/snapback] Try changing GB_ATTRIB_VECTOR to GB_ATTRIB_FLOAT. George. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 6, 2005 Author Share Posted July 6, 2005 Thanks! Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 11, 2005 Author Share Posted July 11, 2005 I need to find a group of the polygons for which the current point is the common (or to find the neighbour points). Whether there is a ready function or it is necessary to create my own algorithm? The first that occurs - search of all polygons and check of concurrence of the points with current point. But it's a slow way. And if to look at the structure of geo-detail it is possible to see, that between a point and a primitive there is a link (suspect, that is not bidirectional link), that is primitive contains indexes on points which enter into it. But not vice versa. Right? Whereas to be? Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 11, 2005 Share Posted July 11, 2005 I need to find a group of the polygons for which the current point is the common (or to find the neighbour points). Whether there is a ready function or it is necessary to create my own algorithm? The first that occurs - search of all polygons and check of concurrence of the points with current point. But it's a slow way.And if to look at the structure of geo-detail it is possible to see, that between a point and a primitive there is a link (suspect, that is not bidirectional link), that is primitive contains indexes on points which enter into it. But not vice versa. Right? Whereas to be? 19414[/snapback] try GU_PrimGroupClosure.h and GEO_Closure.h Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 11, 2005 Author Share Posted July 11, 2005 Thanks, Simon! Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 11, 2005 Share Posted July 11, 2005 Let me know if you have any luck with them I can't get findPolysUsingEdge to return anything other than an empty list. Quote Link to comment Share on other sites More sharing options...
George Posted July 12, 2005 Share Posted July 12, 2005 Let me know if you have any luck with them I can't get findPolysUsingEdge to return anything other than an empty list. 19435[/snapback] That's odd. findPolysUsingEdge() needs a valid GB_PointRefArray (or a GEO_PointRefArray) in order to figure out the connections. (Of course the polys must be fused also). Are you specifying a particular group when building the point-ref array? or maybe not specifying a gdp? George. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 12, 2005 Share Posted July 12, 2005 That's odd. findPolysUsingEdge() needs a valid GB_PointRefArray (or a GEO_PointRefArray) in order to figure out the connections. (Of course the polys must be fused also). Are you specifying a particular group when building the point-ref array? or maybe not specifying a gdp?George. 19439[/snapback] Ah maybe that's the problem I thought all you needed to supply was the two points pt0 and pt1 which represent the edge and then primlist got returned by the function. If prefarr was empty I thought it would consider everything. So are you saying the prefarr needs to be filled with a group of points to consider when looking for the polys, even if you are searrching the whole gdp? That was the next thing I was going to try. I'm specifying a gdp when initialising my GEO_Closure object, I assume that's correct, since it worked for the edgeDelete method. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 12, 2005 Author Share Posted July 12, 2005 Let me know if you have any luck with them I can't get findPolysUsingEdge to return anything other than an empty list. I use findPolysUsingPoint() but I have a same problem. Constructor of GB_PointRefArray expects the GEO_Detail and GB_Group. So, what is it GB_Group? And how to initialize it? My brain boils Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 12, 2005 Share Posted July 12, 2005 I got this working in the end. It's a bit of a hack at the moment as I'm still figuring it out, but maybe it will help a little const GEO_Point *pt0,*pt1; const GB_PointGroup *pointGroup = parsePointGroups("*",gdp); GB_PointRefArray prefarr(gdp,pointGroup); UT_IntArray primlist(2); GEO_Closure connectedPrims(*gdp); connectedPrims.findPolysUsingEdge(*pt0, *pt1, primlist, prefarr); obviously you need to set pt0 and pt1 but then primlist comes back with useful things in it. Still looking at this though so I sure there are far better ways to do this. Quote Link to comment Share on other sites More sharing options...
George Posted July 13, 2005 Share Posted July 13, 2005 That's looking great -- very close! The first thing is to get rid of the pointGroup, if you supply the gdp to the prefarr with a NULL for the GB_Group, then you get everything anyway. The reason GB_PointRefArray takes a GB_Group and not a GB_PointGroup is because it can accept either a primitive group or a point group. If one or the other is supplied, only those are considered in the ref array -- if NULL is supplied, then it uses the entire geometry. Building a point-ref array is pretty expensive, so the groups give you a way to only build for a subsection of the geometry that you're interested in. A lot of GB/GEO/GU methods behave in a similar way. The other thing to note is that GEO_Closure gives you two options for findPolysUsingEdge(), one gives you back an integer list of prim ids, the other gives you a primitive group. If you don't need a group (to pass to other parts of the code), it's probably quicker to use an int array. Creating and destroying groups can be wasteful. Hope that helps. George. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 13, 2005 Author Share Posted July 13, 2005 Thanks for explanation, guys! Whether I can trust result which returns prim->calcArea() or it is better to write my own function? Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 13, 2005 Share Posted July 13, 2005 That's looking great -- very close! The first thing is to get rid of the pointGroup, if you supply the gdp to the prefarr with a NULL for the GB_Group, then you get everything anyway. 19455[/snapback] When you say a NULL do you mean, like this, where you don't specify it or that you give it a null pointer. GB_PointRefArray prefarr(gdp); I tried it this way and it didn't work, which was why I ended up trying to create a point group, didn't try giving it a null pointer cos I thought that was *bad* . I think ultimately I'll need one anyway since the user will probably need to supply a group to work on. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 13, 2005 Share Posted July 13, 2005 When you say a NULL do you mean, like this, where you don't specify it or that you give it a null pointer. GB_PointRefArray prefarr(gdp); As far as I know, a null pointer is simply the value 0 (zero). So I'm thinking he means something like this: prefarr(gdp,0); 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.