POV-Ray : Newsgroups : povray.general : Finding exact position after translating and rotating... Server Time
15 Nov 2024 17:12:32 EST (-0500)
  Finding exact position after translating and rotating... (Message 1 to 6 of 6)  
From:
Subject: Finding exact position after translating and rotating...
Date: 18 Dec 1998 10:40:15
Message: <367a775f.0@news.povray.org>
I use sunpos.inc for lighting. The position of the sun is calculated in one
direction and then translated and rotated by an equation. How can I find the
exact position of the sun for effect_location variable, which is used by the
popular lnsefcts.inc?

Istvan


Post a reply to this message

From: Mike
Subject: Re: Finding exact position after translating and rotating...
Date: 18 Dec 1998 17:36:31
Message: <367B737F.1F700759@aol.com>
You could #declare the variables you use for the sun postition and then
use that anywhere you want.

-Mike


> 
> I use sunpos.inc for lighting. The position of the sun is calculated in one
> direction and then translated and rotated by an equation. How can I find the
> exact position of the sun for effect_location variable, which is used by the
> popular lnsefcts.inc?
> 
> Istvan


Post a reply to this message

From: ingo
Subject: Re: Finding exact position after translating and rotating...
Date: 18 Dec 1998 18:11:30
Message: <367ae122.0@news.povray.org>
Mike heeft geschreven in bericht <367B737F.1F700759@aol.com>...
>You could #declare the variables you use for the sun postition and then
>use that anywhere you want.

I don't think that is what Istvan is looking for. The problem, as I
understand it, is how to go from

light_source {
    <0,0,0>
    translate <0, 0, SunDistance>
    rotate <-Al, Az, 0>
}

to an exact position: light_source {<x,y,z>}.

Although I've put together the sunpos.inc (I needed it badly) my math is not
as good as it has never been before

Sorry I cant help you on this, maybe someone else?

ingo


Post a reply to this message

From: Margus Ramst
Subject: Re: Finding exact position after translating and rotating...
Date: 18 Dec 1998 19:04:09
Message: <367AEC17.CE0504EF@peak.edu.ee>
I haven't used sunpos.inc, but if you need the position vector of a
translated/rotated point, you can get it with vector functions. For example,
vrotate(<XTrans,YTrans,ZTrans>,<XRot,YRot,ZRot>) returns the new coordinates
of a point <XTrans,YTrans,ZTrans> rotated around the origin by
<XRot,YRot,ZRot>.
Just apply the same translation/rotation as the ones in sunpos and you get the
point you need.

Margus


> 
> I use sunpos.inc for lighting. The position of the sun is calculated in one
> direction and then translated and rotated by an equation. How can I find the
> exact position of the sun for effect_location variable, which is used by the
> popular lnsefcts.inc?
> 
> Istvan


Post a reply to this message

From: Jerry Anning
Subject: Re: Finding exact position after translating and rotating...
Date: 18 Dec 1998 22:53:52
Message: <367B235D.3A7E8FA3@dhol.com>

> 
> I use sunpos.inc for lighting. The position of the sun is calculated in one
> direction and then translated and rotated by an equation. How can I find the
> exact position of the sun for effect_location variable, which is used by the
> popular lnsefcts.inc?
> 
> Istvan

Add the following line to sunpos.inc immediately before the #end:

#declare Sunloc = vrotate(<0, 0, 1000000000>, <-Al, Az, 0>;

This will cause the macro to put the Sun's location into the global
variable Sunloc, enabling you to use it as you wish (e.g. #declare
effect_location = Sunloc;)  It will not change the function of
sunpos.inc in any other way.


Post a reply to this message

From: Mike
Subject: Re: Finding exact position after translating and rotating...
Date: 18 Dec 1998 23:33:40
Message: <367BC732.B45C2276@aol.com>
What I meant was, to go with your example:

#declare SunDistance = <0, 0, 5> //arbitrary units of course :)

#declare SunPosition = vrotate (Sundistance, <-Al, Az, 0>)

light_source {SunPosition color something}

#declare effect_location = SunPosition

-Mike


ingo wrote:
> 
> Mike heeft geschreven in bericht <367B737F.1F700759@aol.com>...
> >You could #declare the variables you use for the sun postition and then
> >use that anywhere you want.
> 
> I don't think that is what Istvan is looking for. The problem, as I
> understand it, is how to go from
> 
> light_source {
>     <0,0,0>
>     translate <0, 0, SunDistance>
>     rotate <-Al, Az, 0>
> }
> 
> to an exact position: light_source {<x,y,z>}.
> 
> Although I've put together the sunpos.inc (I needed it badly) my math is not
> as good as it has never been before
> 
> Sorry I cant help you on this, maybe someone else?
> 
> ingo


Post a reply to this message

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