May I get some advices on how to calculate the vertical distance of a point on a vertical surface to the top edge of that surface as shown in the image below?
I tried to do it via VOP but realizing that point on the surface will not be able to move along the surface…
Thanks!
Ji
[help] vertical distance of a pt on surface to edge of surf
3620 7 2- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
- asnowcappedromance
- Member
- 512 posts
- Joined: July 2009
- Offline
- Erik_JE
- Member
- 299 posts
- Joined: Jan. 2010
- Offline
asnowcappedromance
well you can just take the point in the upper left corner, take it's y position and subtract it by the red points y pos which will give you exactly what you want!
Manu
The problem is probably more figuring out which point that is and even then its not correct because there is no way to guarantee that the two top points are at same Y height and if it differs you can not just use one of the points.
Drive, monkey, drive!
- asnowcappedromance
- Member
- 512 posts
- Joined: July 2009
- Offline
- Erik_JE
- Member
- 299 posts
- Joined: Jan. 2010
- Offline
- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
- eetu
- Member
- 606 posts
- Joined: May 2007
- Offline
Yep, this is not an easy one. Some thinking-aloud-by-myself:
Do you need this info inside Houdini or during rendering?
You could perhaps do something with the raw polygon s and t coordinates, and especially with their derivatives. I think Mantra gives you derivative vectors for increasing s and t, in the plane of the polygon. (I don't have Houdini here at the moment).
You could calculate the ds+dt vector combination that's closest to (0,1,0), and calculate how far the current s,t is from the edge.
For non-quads it could get hairier, I guess you could do special cases at least for tris..
Do you need this info inside Houdini or during rendering?
You could perhaps do something with the raw polygon s and t coordinates, and especially with their derivatives. I think Mantra gives you derivative vectors for increasing s and t, in the plane of the polygon. (I don't have Houdini here at the moment).
You could calculate the ds+dt vector combination that's closest to (0,1,0), and calculate how far the current s,t is from the edge.
For non-quads it could get hairier, I guess you could do special cases at least for tris..
- asnowcappedromance
- Member
- 512 posts
- Joined: July 2009
- Offline
haha this is getting interesting.
Ok here's another approach:
You know the number of vertices of the face the vertex lies on and you have the face normal. Test which vertices are above the faces centroid or center of mass (vertices A). Copy this new selection and move it in the direction of the face's normal (vertices B). Then create a new face out of vertices A and B and be sure to offset them back a little bit so the ray that you are going to shoot now hits the new face.
And yes, you can do all of that procedurally
Edit: forgot to mention that you have to clamp the Y translation to 0 when moving the points along the normal!
Ok here's another approach:
You know the number of vertices of the face the vertex lies on and you have the face normal. Test which vertices are above the faces centroid or center of mass (vertices A). Copy this new selection and move it in the direction of the face's normal (vertices B). Then create a new face out of vertices A and B and be sure to offset them back a little bit so the ray that you are going to shoot now hits the new face.
And yes, you can do all of that procedurally
Edit: forgot to mention that you have to clamp the Y translation to 0 when moving the points along the normal!
-
- Quick Links