POV-Ray : Newsgroups : povray.general : coordinate system? Server Time
25 Nov 2024 23:35:08 EST (-0500)
  coordinate system? (Message 1 to 5 of 5)  
From: bugbear
Subject: coordinate system?
Date: 4 Sep 2012 04:40:00
Message: <web.5045bdfe19e59066408aa4ce0@news.povray.org>
I know. Bear with me.

I started out on a small povray project.

It wasn't going at all well well, despite me being pretty familiar with
cartesiain geometry. I googled. I read. I looked at many tutorials.

I simplified what I was doing.

A lot.

In the end I realised my problem; despite all the documentation:

http://www.povray.org/documentation/view/3.6.0/15/

stating that +x is to the right, I'm getting it on the left.

My limiting case is attached (axes.pov)

#macro axes()
 cylinder{<0,0,0>,<100,0,0>, .05
  pigment { color rgbf  <0.0, 0.0, 1.0, 0.0>}  // bright blue is +X
        }
 cylinder{<0,0,0>,<-100,0,0>, .05
  pigment { color rgbf  <0.0, 0.0, 0.3, 0.0>}  // blue is X
        }
 cylinder{<0,0,0>,<0,100,0>, .05
  pigment { color rgbf  <0.0, 1.0, 0.0, 0.0>}  // bright green is +Y
        }
 cylinder{<0,0,0>,<0,-100,0>, .05
  pigment { color rgbf  <0.0, 0.3, 0.0, 0.0>}  // green is Y
        }
 cylinder{<0,0,0>,<0,0,100>, .05
  pigment { color rgbf  <1.0, 0.0, 0.0, 0.0>}  // bright red is +Z
        }
 cylinder{<0,0,0>,<0,0,-100>, .05
  pigment { color rgbf  <0.3, 0.0, 0.0, 0.0>}  // red is Z
        }
#end

camera {
 location <100, 100, -120>   // Where the Camera is located <x,y,z>
 look_at <0, 0, 0>    // Where is the camera is looking <x,y,z>
 direction <0, 400/25.4, 0> // 400mm lens
}

light_source {
 <10, 15, -20>  // Location of the light
 color rgbf <2.0, 2.0, 2.0, 0.0>   // The RGB Color of the light (White)
       // Including transparency factor (f)
}

axes()

I ran as:
povray -Iaxes.pov +V +D0 +P +X100 +FP16 +Oout.ppm -H600 -W800

Here's the result:

http://i48.photobucket.com/albums/f234/bugbear33/misc/out.png

Bright blue ON THE LEFT.

Version:

Persistence of Vision(tm) Ray Tracer Version 3.6.1 (g++ 4.6.0 @
 x86_64-unknown-linux-gnu)

I assume I'm doing something so inept and *unthinkable* it will be hard for you
all to guess.

Help gratefully accepted.

 BugBear


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: coordinate system?
Date: 4 Sep 2012 06:24:00
Message: <5045d6c0$1@news.povray.org>
On 04/09/12 10:38, bugbear wrote:
> direction <0, 400/25.4, 0>

   Just had a quick look without any testing, but I guess this has 
something to... should it be along z?

--
Jaime


Post a reply to this message

From: Thomas de Groot
Subject: Re: coordinate system?
Date: 4 Sep 2012 07:02:36
Message: <5045dfcc$1@news.povray.org>
On 4-9-2012 10:38, bugbear wrote:

> camera {
>   location <100, 100, -120>   // Where the Camera is located <x,y,z>
>   look_at <0, 0, 0>    // Where is the camera is looking <x,y,z>
>   direction <0, 400/25.4, 0> // 400mm lens
> }
>

direction should be along z not y.

direction <0, 0, 400/25.4> // 400mm lens


Thomas


Post a reply to this message

From: Le Forgeron
Subject: Re: coordinate system?
Date: 4 Sep 2012 07:19:37
Message: <5045e3c9$1@news.povray.org>
Le 04/09/2012 10:38, bugbear a écrit :
> camera {
>  location <100, 100, -120>   // Where the Camera is located <x,y,z>
>  look_at <0, 0, 0>    // Where is the camera is looking <x,y,z>
>  direction <0, 400/25.4, 0> // 400mm lens
> }

I'm afraid, by the comments, that you are in for some delusions (where
did you get that /25.4 ? there is no unit in povray (excepted now for
SSLT), so no inches/mm !).

You did not specify the right vector, yet you expect the ratio between
direction & right to set the viewing angle. (and the default for right
is +1.33*x )

x.y = z ... right . up = direction
z.x = y ... direction.right = up
y.z = x ... up.direction = right

You fixed direction as +y, which trigger a small part of the code
because up (undefined, default to +y), and right(undefined, default to
+1.33*x) must now be recomputed by look_at.

The handedness is first computed between direction, up & right.
 handedness = (Up cross Direction) dot Right

As you did not change the sky, it use the default +y, the cross product
of sky by normalised(look_at - location) provide the new right.

sky is +y, look_at - location is -100*x-100*y+120*z...

then Up is recomputed from cross of (look_at - location) by fresh right
and finally the handedness is restored with the length of right:

 if handedness > 0, right is scaled by a positive number
 else, by a negative number.

(Up is also restored to its length, but that's not a problem)

Your heresy: *handedness is 0* ( +y cross +y is null vector. )

How to fix it ?
===============
Define a Up vector too (and not parallel to Direction, nor right)


Post a reply to this message

From: bugbear
Subject: Re: coordinate system?
Date: 4 Sep 2012 07:20:01
Message: <web.5045e3dcfe9f8cc5408aa4ce0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 4-9-2012 10:38, bugbear wrote:
>
> > camera {
> >   location <100, 100, -120>   // Where the Camera is located <x,y,z>
> >   look_at <0, 0, 0>    // Where is the camera is looking <x,y,z>
> >   direction <0, 400/25.4, 0> // 400mm lens
> > }
> >
>
> direction should be along z not y.
>
> direction <0, 0, 400/25.4> // 400mm lens
>
>
> Thomas

Aah - I thought (wrongly) that only the magnitude of direction mattered.

Sanity is restored. Thank you.

 BugBear


Post a reply to this message

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