-
For 2 vectors A=(xa, ya, za), B =(xb,
yb, zb), by definition, their scalar product is:
-
AB = xaxb+ yayb+ zazb
=|A| |B| cos (A, B)
-
If |A|=1, |B|=1, we can compute the cosine of the angle between the 2 vectors
as:
-
cos (A, B) = AB = xaxb+ yayb+
zazb.
The Normal Vector
Computing the Normal Vector
For a triangle defined by P1(x1, y1,
z1), P2(x2, y2, z2),
and P3(x3, y3, z3), and i=(1,0,0),
j=(0,1,0), k=(0,0,1):
Normals for a Triangle Strip
-
The orientation of N depends on the order in which we multiply the
vectors.
-
For a triangle strip, we must insure that the normals are consistently
oriented.
-
If P1, P2, P3, and P4 are 4
points of the triangle strip in sequence, then we compute
-
N1 = P1P2 x P1P3
-
N2 = P2P4 x P2P3
= P1+1P3+1 x P1+1P2+1
Examples of the Normal Vector
-
For a sphere centered in O, the normal to the surface in the point Q is
OQ.
-
For a cylinder around the z axis, the normal in the point Q=(x, y, z) is
N=(x, y, 0).
-
For any parameteric curve C(x(s), y(s), z(s)),
-
T = (x'(s), y'(s), z'(s)) is tangent to the curve, and
-
N = (x''(s), y''(s), z''(s)) is perpendicular to the curve.
Normal for a Parametric Surface
-
For a parameteric surface S(x(s, t), y(s, t), z(s, t)),
-
Ts = (delta s x(s, t), delta s y(s,
t), deltas z(s, t)) is tangent to the surface,
-
Tt = (deltat x(s, t), deltat y(s, t),
deltat z(s, t)) is another tangent to the surface,
Normal for an Implicit Surface
For any surface defined implicitly by F(x, y, z) = c (constant), we
can compute the normal to this surface using the gradient of the function
F:
For a sphere: F(x, y, z) = x2 + y2 + z2
= 1
The gradient of the function is (2x, 2y, 2z). If we normalize it, we
obtain (x, y, z).