POV-Ray : Newsgroups : povray.advanced-users : opposite direction of a surface. Server Time
29 Jul 2024 00:23:20 EDT (-0400)
  opposite direction of a surface. (Message 1 to 8 of 8)  
From: Matthew Pace
Subject: opposite direction of a surface.
Date: 12 Nov 2003 21:33:03
Message: <matt-pace-117401.18330112112003@netplex.aussie.org>
Hello, the name is Matt, and this is my first post in the advanced user 
area.  Normally I am found asking annoying questions in the newuers 
area, but I feel that this question may be enough to bump me up a level, 
at least temporarily.

So here is the question(s):

How would one get the directional vector of an object so that the vector 
would lead an object directly away from the surface of the first one.  
This probably sounds confusing, so here is an example.  We have a torus, 
and a point on the torus, which well call v1.  How would I get a 
vector(v2) that if added to the vector(v1) of the point on the torus, 
and used for a cylinder would create a spikey torus with cylinders 
alawys pointing away from the surface.  I know that for this example I 
could just use a bigger torus and find the size ratio to locate certain 
points on the fatter, larger torus and use those, but I actually have 
something more complex on mind, so I was hoping you could help with that.

A second, similar question has been plaguing me.  This should perhaps go 
into the programming section, so if no one answers me, or anyone 
repremands me, I will repost it there.  I am working on my own 
raytracer, currently just pseudo-code.  How would I find, using 
mathmatical terms here, the angle that a ray reflects off a surface?  It 
is somewhat similar, but the ray may be coming off an angle, so theres 
gotta be some difference.  Any help with this would be great, I did 
check the source code, and found it to be rather sloppy and poorly 
documented for semi-professional software (no offence to anyone, my code  
is usually worse).

Thanks to all who help out here!
~matt


Post a reply to this message

From:
Subject: Re: opposite direction of a surface.
Date: 12 Nov 2003 22:12:32
Message: <3fb2f6a0$1@news.povray.org>
Hi Matt,

because you asked in the advanced-users group,
I assume short answers will suffice ;-)

First question:
   You are actually asking for the normal of an object at v1: use trace()
   to shoot a ray at v1 and get the normal (your v2) at this point.
   (look for trace at "6.1.4.6 Vector Functions")

Second question:
   The Advanced Tutorial ("4.2 POV-Ray SDL tutorial: A raytracer")
   should give you some hints, esp. "4.2.3 Short introduction to
   raytracing" and "4.2.7 Ray-sphere intersection"


Sputnik


Post a reply to this message

From: Matthew Pace
Subject: Re: opposite direction of a surface.
Date: 12 Nov 2003 23:06:31
Message: <matt-pace-47FB46.20062812112003@netplex.aussie.org>
In article <3fb2f6a0$1@news.povray.org>,


> Hi Matt,
> 
> because you asked in the advanced-users group,
> I assume short answers will suffice ;-)

as long as its more than 3 words ;-)

> First question:
>    You are actually asking for the normal of an object at v1: use trace()
>    to shoot a ray at v1 and get the normal (your v2) at this point.
>    (look for trace at "6.1.4.6 Vector Functions")

Ah, I have heard of good reviews of trace(), I shall check it out and 
see what it can do for me.  I did not know, however, that a normal was 
simply the way the reflection, although I guess it makes sense.

> 
> Second question:
>    The Advanced Tutorial ("4.2 POV-Ray SDL tutorial: A raytracer")
>    should give you some hints, esp. "4.2.3 Short introduction to
>    raytracing" and "4.2.7 Ray-sphere intersection"

Thanks, I shall check that out as well.  I had skimmed over the SDL 
tutorial, but left when I realized it was over my head at the time.


> Sputnik


Thanks Sputnik


Post a reply to this message

From: Matthew Pace
Subject: Re: opposite direction of a surface.
Date: 12 Nov 2003 23:41:06
Message: <matt-pace-07444E.20410512112003@netplex.aussie.org>
Is there another way to do question 1?  I am asking becuase I am 
creating my own fur macros  (for the experience and bragging rights), 
and using trace() seems like a hassle because of all the times I would 
have to adjust the start vector.  Any other suggestions would be greatly 
appreciated.

Thanks! 
~matt


Post a reply to this message

From: Christopher James Huff
Subject: Re: opposite direction of a surface.
Date: 12 Nov 2003 23:53:21
Message: <cjameshuff-8E5901.23503612112003@netplex.aussie.org>
In article <mat### [at] netplexaussieorg>,
 Matthew Pace <mat### [at] lycoscom> wrote:

> > First question:
> >    You are actually asking for the normal of an object at v1: use trace()
> >    to shoot a ray at v1 and get the normal (your v2) at this point.
> >    (look for trace at "6.1.4.6 Vector Functions")
> 
> Ah, I have heard of good reviews of trace(), I shall check it out and 
> see what it can do for me.  I did not know, however, that a normal was 
> simply the way the reflection, although I guess it makes sense.

The normal is perpendicular to the surface, which is what I suppose you 
meant by "opposite" to the surface. It isn't the direction of a 
reflection, though it bisects the direction the incoming ray comes from 
and the direction the reflected ray goes.

-- 
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: opposite direction of a surface.
Date: 12 Nov 2003 23:59:19
Message: <cjameshuff-ED4698.23563512112003@netplex.aussie.org>
In article <mat### [at] netplexaussieorg>,
 Matthew Pace <mat### [at] lycoscom> wrote:

> Is there another way to do question 1?  I am asking becuase I am 
> creating my own fur macros  (for the experience and bragging rights), 
> and using trace() seems like a hassle because of all the times I would 
> have to adjust the start vector.  Any other suggestions would be greatly 
> appreciated.

Your objection doesn't really make any sense. You have to sample 
multiple points anyway. There's no way to get the normal at a point 
without that point.
Or do you already have a point on the surface of the object? In that 
case, if the object is simple enough, you can just figure it out from 
the type of object and the point. For example, the normal at a point on 
the surface of a sphere is that point minus the center of the sphere. 
This is a far less general solution, since you have to figure it out for 
the specific object you're using, and that can sometimes be very 
difficult. It also requires you to already have a point on the surface 
of the object.

-- 
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: Warp
Subject: Re: opposite direction of a surface.
Date: 13 Nov 2003 06:51:57
Message: <3fb3705d@news.povray.org>
Matthew Pace <mat### [at] lycoscom> wrote:
> I did not know, however, that a normal was 
> simply the way the reflection, although I guess it makes sense.

  Nope, it doesn't make sense because the reflected vector and the normal
vector are two completely different vectors.
  The reflected vector leaves the surface with the same angle as the
incoming ray. That is, if the incoming ray hit the surface at an angle
of 10 degrees, the reflected vector leaves the surface at an angle of 10
degrees.
  A normal vector is perpendicular (ie. at 90 degrees) to the surface and
completely independent of any incoming ray.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Matthew Pace
Subject: Re: opposite direction of a surface.
Date: 13 Nov 2003 18:22:42
Message: <matt-pace-04E040.15223813112003@netplex.aussie.org>
Ok, I think I understand it now.  The terminology tricked me at first, 
but yes, a normal was what I am looking for, given the point on the 
surface.  I should be able to handle it now, although I think that this 
may be a bit too advanced for my skill level right now.  Thanks a lot 
for the help and patience.
~matt


Post a reply to this message

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