POV-Ray : Newsgroups : povray.general : normals function Server Time
3 Aug 2024 20:14:46 EDT (-0400)
  normals function (Message 11 to 14 of 14)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mikael Pohjola
Subject: Re: normals function
Date: 13 Jan 2004 10:27:12
Message: <opr1pzvldo0x9foi@news.povray.org>
On 11 Jan 2004 10:56:24 -0500, Warp <war### [at] tagpovrayorg> wrote:
>   The result of the dot-product of two vectors is a scalar which is the
> product of the lengths of the two vectors multiplied with the cosine of
> the angle between them.
>   The good thing about the dot-product is that it's very easy to 
> calculate
> with multiplications and additions only. The dot-product of <ux, uy, uz>
> and <vx, vy, vz> is ux*vx+uy*vy+uz*vz.

I think you left out the most useful thing: the dot-product is 0 when the 
two vectors are perpendicular to each other (since the cosine of 90 
degrees is 0)

-- 
light_source{20*y,1}#macro _(M,X,Y,P)#macro L(N,D)#if(N)#declare 
P=P+D;box{-
0.5,0.5translate z*mod(9*P.gray,4)pigment{rgb P}rotate 45*x+clock*y 
translate
P}L(N-1,D)#end#end#if(M)L(mod(M,8)<mod(X,3)mod(Y,3)1>-1)_(div(M,8)div(X,3)div
(Y,3)P)#end#end _(2301603551,12850,60365,20*z-5*x)plane{y,-9pigment{rgb 1}}


Post a reply to this message

From: Warp
Subject: Re: normals function
Date: 13 Jan 2004 15:19:58
Message: <400452ee@news.povray.org>
Mikael Pohjola <emp### [at] cchutfi> wrote:
> I think you left out the most useful thing: the dot-product is 0 when the 
> two vectors are perpendicular to each other (since the cosine of 90 
> degrees is 0)

  It certainly is useful, but why is it *the most* useful feature?-)

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: normals function
Date: 14 Jan 2004 16:23:07
Message: <cjameshuff-4E69DA.16232414012004@netplex.aussie.org>
In article <opr1pzvldo0x9foi@news.povray.org>,
 Mikael Pohjola <emp### [at] cchutfi> wrote:

> I think you left out the most useful thing: the dot-product is 0 when the 
> two vectors are perpendicular to each other (since the cosine of 90 
> degrees is 0)

I'd say this is even more useful: if the dot product is > 0, the vectors 
point in roughly the same direction (less than 90 degree angle), if it 
is < 0, they point in opposite directions (greater than 90 degree 
angle). And there are many other uses...finding intersections with 
various objects, for example. (the plane intersection equation is little 
more than two dot products)

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: normals function
Date: 14 Jan 2004 16:27:17
Message: <cjameshuff-375047.16273514012004@netplex.aussie.org>
In article <4001f8e5@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

> Christopher James Huff <cja### [at] earthlinknet> wrote:
> > Anyway, that means acos(A.x) means the same thing as acos(vdot(A, x)): 
> > the angle in radians between the vector and the x axis.
> 
>   Only if A is a unit vector. (If it isn't, you need to normalize
> it first.)

Right...I always forget to say that. And to clarify, it's only the part 
about the angle that's wrong: acos(A.x) only means the angle in radians 
if A is unit-length, it does mean the same thing as acos(vdot(A, x)). 
You need acos(A.x/vlength(A)) or acos(vdot(A, x)/vlength(A)). Or, given 
two arbitrary vectors, acos(vdot(A, B)/(vlength(A)*vlength(B)))

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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