|
|
Shay wrote:
>
> This question didn't make much sense the first time I wrote it. Let me try
> again.
>
> How can I calculate the normal of a vertex which lies on the side of a
> triangle. but not at the corner?
> ___________
> |\ /|
> | \ B / |
> | \ / |
> | \ / |
> | C X |
> | / |
> | / A |
> | / |
> |/________|
>
> How would I calculate the normal at point X given the normals of triangles
> A, B, & C?
Shay, there are several possible ways to calculate
such a normal. It all depends on the application.
But assuming that you are going to use it in
a mesh2{}, then I would recommend the following:
If vN_A, vN_B and vN_C are normals with unknown
length, then I would suggest this for the normal
vector at X:
#declare vNormalX =
vnormalize(
vnormalize(vN_A)*AreaA
+vnormalize(vN_B)*AreaB
+vnormalize(vN_C)*AreaC
)
If you know the coordinates of the corners p00,
p10, p11 and p01, then I would suggest the
following:
p01_______p11
|\ /|
| \ / |
| \ / |
| \ / |
| pXX |
| / |
| / |
| / |
p00_______p10
#declare vNormalX =
vnormalize(vcross(p01 - p10, p11 - p00))
I would also recommend the same formula even
if the triangles were arranged like this:
p01_______p11
|\ /|
| \ / |
| \ / |
| \ / |
| pXX |
| / \ |
| / \ |
| / \ |
p00_______p10
The argument for this involves some vector
cross product calculations (which I can try to
show and explain if you're interested).
Note that I have not tested my suggestions
above yet, so there may be defects in my
reasoning.
Tor Olav
Post a reply to this message
|
|