POV-Ray : Newsgroups : povray.windows : Computing normals for use in smooth_triangle : Re: Computing normals for use in smooth_triangle Server Time
28 Jul 2024 16:26:06 EDT (-0400)
  Re: Computing normals for use in smooth_triangle  
From: yang444
Date: 10 May 1998 03:48:02
Message: <35555BB2.D4147A37@pacbell.net>
Jim Kress wrote:

> I have an object that isdescribed by a large number of triangles.  I
> have the x,y,z coordinates for each vertex of every triangle.  Can
> anyone explain how to calculate the normal vectors for me to use with
> the smooth_triangle function in POVray?
>
> Thanks for the help.
>
> Jim
>

------------- Given the 3 points: (x[i], y[i], z[i]),   i=0,1 2

Each of the points satisfies the eq. for a plane:

  A(x-x[i]) + B(y-y[i]) + C(z-z[i]) = 0    (1)

Substituting each point in the equation,
you have 3 eqs. in 3 unknowns, A, B and C.

Once you have solved for A, B and C,
the vector normal to the plane is:

  N = Ai + Bj + Ck

where i, j and k are the usual unit vectors.

To see this, pick any pt, P1(x[0], y[0], z[0]), on the plane.
and pick another arbitrary pt, P(x, y, z), on the plane.

The vector from the origin to P1 is

  r0 =  x[0]i + y[0]j + z[0]k

The vector from the origin to P is

  r = xi + yj + zk

So the vector r - r0, which must lie on the plane, is:

  M = (x - x[0])i + (y - y[0])j + (z - z[0])k

Now dot N with M, and you get the left side of eq. (1),
which is equal to the left side, which is zero.

But if the dot product of 2 vectors is zero,
they must be perpendicular to each other.

So N is perpendicular to all vectors on the plane
and so is the normal to the plane.




--
Alan

 Spam Bait:
root@localhost
admin@localhost
current board of the Federal Communications Commission:
Chairman Reed Hundt: rhu### [at] fccgov
Commissioner James Quello: jqu### [at] fccgov
Commissioner Susan Ness: sne### [at] fccgov
Commissioner Rachelle Chong: rch### [at] fccgov


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.