davedjohnson Posted August 5, 2005 Share Posted August 5, 2005 I have a poly triangle. I also have another point, planar with the triangle, but outside the triangle. If I use pointInFace(), shouldn't it return 0? I'm asking because it seems to return 1 no matter where the point is. // rough bit of example code // I'm pretty sure I've got the right point and face setup in my real code GEO_Face *face; GEO_Point *point; // code to get address of correct face and point UT_Vector3 nml = face->computeNormal(); int inside; inside = face->pointInFace( (const UT_Vector3)point.getPos(), &nml); Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 5, 2005 Share Posted August 5, 2005 Just guessing, but could it be that when you pass it a normal it tests for "point in plane" (else I don't see why it would need a normal unless it's used to describe a plane). Try not passing it a normal (ommit the second parameter altogether) and see what happens... Quote Link to comment Share on other sites More sharing options...
davedjohnson Posted August 5, 2005 Author Share Posted August 5, 2005 Just guessing, but could it be that when you pass it a normal it tests for "point in plane" (else I don't see why it would need a normal unless it's used to describe a plane). Try not passing it a normal (ommit the second parameter altogether) and see what happens... 20214[/snapback] I was creating the GEO_Face in the wrong scope. It's working fine now. Dave Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 5, 2005 Share Posted August 5, 2005 So, out of curiosity, what is the optional normal used for? Quote Link to comment Share on other sites More sharing options...
edward Posted August 9, 2005 Share Posted August 9, 2005 It's used to decide which plane to project to in order to do the in/out test. You can't give it a NULL pointer or it'll likely segfault. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 9, 2005 Share Posted August 9, 2005 It's used to decide which plane to project to in order to do the in/out test. You can't give it a NULL pointer or it'll likely segfault. 20332[/snapback] Oh. OK. I'm not sure I understand the need for it yet, but I'll definitely take your word for it. Thanks The only problem I see then, is that not being able to pass it a null makes that default pretty dangerous, no? Just in case, I'm talking about this method in GEO_Face: // This method determines whether the point is inside or outside the // polygon. The point is assumed to be on the plane of the polygon virtual int pointInFace(const UT_Vector3 &pos, const UT_Vector3 *myNormal = 0) const; Quote Link to comment Share on other sites More sharing options...
davedjohnson Posted August 9, 2005 Author Share Posted August 9, 2005 ...The only problem I see then, is that not being able to pass it a null makes that default pretty dangerous, no? That's what got me in the first place. I just started trying to fill in a value when the default wasn't working. But I agree. I think SESI should change that behaviour. Dave Quote Link to comment Share on other sites More sharing options...
edward Posted August 9, 2005 Share Posted August 9, 2005 Oh. OK.I'm not sure I understand the need for it yet, but I'll definitely take your word for it. Thanks The only problem I see then, is that not being able to pass it a null makes that default pretty dangerous, no? Just in case, I'm talking about this method in GEO_Face: // This method determines whether the point is inside or outside the // polygon. The point is assumed to be on the plane of the polygon virtual int pointInFace(const UT_Vector3 &pos, const UT_Vector3 *myNormal = 0) const; 20335[/snapback] Hmm ... that's an interesting point. ... So I checked it out and no one is calling it with the default argument used. Go figure. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 9, 2005 Share Posted August 9, 2005 Hmm ... that's an interesting point. ... So I checked it out and no one is calling it with the default argument used. Go figure. Hehe... Cool. Time to get started on that notebook of "HDK Gotchas" that I've been thinking about Quote Link to comment Share on other sites More sharing options...
davedjohnson Posted August 9, 2005 Author Share Posted August 9, 2005 Hehe... Cool.Time to get started on that notebook of "HDK Gotchas" that I've been thinking about 20339[/snapback] odwiki? I don't know how to edit it, but that seems like a likely place. Quote Link to comment Share on other sites More sharing options...
Jason Posted August 9, 2005 Share Posted August 9, 2005 The OdWiki is a good place for it, I agree. Editing it is easy - at the top of each page there is an "edit" link. The main page is protected from editing so you won't see it there, but all other pages should have it. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 9, 2005 Share Posted August 9, 2005 The OdWiki is a good place for it, I agree. Editing it is easy - at the top of each page there is an "edit" link. The main page is protected from editing so you won't see it there, but all other pages should have it. 20353[/snapback] Done. Add your tips, tricks, and gotchas here. Quote Link to comment Share on other sites More sharing options...
edward Posted August 9, 2005 Share Posted August 9, 2005 I've fixed this in H8. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 9, 2005 Share Posted August 9, 2005 I've fixed this in H8. You just *had* to wait until I put it up on the wiki, didn'tchya!? Thanks Quote Link to comment Share on other sites More sharing options...
edward Posted August 10, 2005 Share Posted August 10, 2005 I'm not sure I understand the need for it yet, but I'll definitely take your word for it. 20335[/snapback] Ah right. I probably didn't explain that properly. It projects the points to the world-aligned 2D plane which contains the largest projection of the normal vector. This reduces the 3D problem into a 2D one which then makes it easier to solve. All pretty standard stuff. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 10, 2005 Share Posted August 10, 2005 Ah right. I probably didn't explain that properly. It projects the points to the world-aligned 2D plane which contains the largest projection of the normal vector. This reduces the 3D problem into a 2D one which then makes it easier to solve. All pretty standard stuff. 20393[/snapback] Yup. That makes perfect sense. For some reason, I was thinking of these faces as triangles when I wrote that post... don't ask. :whistling: Thanks Ed. Quote Link to comment Share on other sites More sharing options...
edward Posted August 10, 2005 Share Posted August 10, 2005 Yeah, I know what you mean. Things would be a lot simpler if everything was convex in the world ... 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.