POV-Ray : Newsgroups : povray.general : normals function : Re: normals function Server Time
2 Nov 2024 17:18:22 EDT (-0400)
  Re: normals function  
From: Warp
Date: 10 Jan 2004 19:31:55
Message: <4000997b@news.povray.org>
m1j <mik### [at] hotmailcom> wrote:
> It has been over 12 years for me and this I do not remember in my math.
> Would have been nice. But thanks all for the help. I thought that vcross
> was for this but my brain just was not putting every thing together.

  The cross-product of two vectors is defined as a vector which is
perpendicular to both and which length is the product of the lengths
of the two vectors multiplied by the sine of the angle between them.
The direction of this perpendicular vector is defined by the handedness
rule (first vector is thumb, second vector is index, result is middle
finger).

  One could wonder why the definition has to be this complicated, but
the idea is that calculating the cross-product of two vectors is very
easy to do with only multiplications and additions (ie you don't need
trigonometry at all).
  If the first vector is <ux, uy, uz> and the second is <vx, vy, vz>
then their cross-product is <uy*vz-uz*vy, uz*vx-ux*vz, ux*vy-uy*vx>.
(This result vector has the properties described above.)

  The most useful property of the cross-product is its perpendicularity,
which is used a lot in computer graphics for calculating normal vectors.

  (Another useful operator is the dot-product, but that's another story.)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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