|
|
On Sat, 17 Apr 1999 02:08:20 +0200, Peter Pfahl <ppf### [at] rz-onlinede>
wrote:
>Yeah, I'll try that...have to think of a way to calculate the normals of the
>corners....
Suppose that you want to calculate the normal at point a, which is
connected to points b, c, d and e thus:
b____________c
|\ / |
| \ / |
| \ / |
| \ / |
| \ / |
| \ / |
| a |
| / \ |
| / \ |
| / \ |
| / \ |
| / \ |
|/ \ |
d___________e
Where X stands for the (vector) cross product, calculate:
N = ((b-a) X (c-a)) + ((c-a) X (e-a)) + ((e-a) X (d-a)) + ((d-a) X
(b-a))
Then calculate the (scalar) length of N where n.x means the
x-component of N, etc.:
L = sqrt(N.x * N.x +N.y * N.y + N.z * N.z)
Then normalize N (set it's length to 1) thus
N = <N.x / L, N.y / L, N.Z / L>
assuming, of course, that L != 0
The cross product is a simple calculation that I am omitting for
reasons of laziness. You can find it in any vector algebra text or
mail me and I'll send it. Be sure to keep the direction of
calculation around points (that is clockwise or counterclockwise)
consistent.
Jerry Anning
clem "at" dhol "dot" com
Post a reply to this message
|
|