POV-Ray : Newsgroups : povray.newusers : camera angle Server Time
2 Nov 2024 15:24:48 EDT (-0400)
  camera angle (Message 1 to 4 of 4)  
From: Bill Hails
Subject: camera angle
Date: 12 Oct 2003 11:01:19
Message: <3f896cbf@news.povray.org>
hmm, 2 questions in a row, at least you know I'm keen :-)

From the description of the camera angle in section 6.4.1,
and referring to the figure in that section.

I thought it should be easy to determine a line parallel
to the "right" vector, but passing through the look_at point.

I should then be able to interpolate the dotted lines delimiting
the angle to this line, and placing an object at each of these
points they should appear precisely at the edges of the image.

Here's my code. I can't see what's wrong with it, but the
spheres are definately not at the edges of the screen.

#include "math.inc"
#include "colors.inc"

#local Location = <0, 0, -10>;
#local LookAt = <0, 0, 0>;
#local Angle = 50;

#local Direction = LookAt - Location;
#local Distance = vlength(Direction);
#local PerpDirection = vcross(Direction, y);
#local PerpDistance = sind(Angle/2) * Distance;
#local MaxLeft = LookAt + PerpDistance * vnormalize(PerpDirection);
#local MaxRight = LookAt - PerpDistance * vnormalize(PerpDirection);

camera {
    location Location
    angle Angle
    look_at LookAt
}

sphere { MaxLeft, 0.2 pigment { Red } }
sphere { LookAt, 0.2 pigment { Green } }
sphere { MaxRight, 0.2 pigment { Blue } }

light_source { <1, 10, -10> White }

-- 
Bill Hails


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: camera angle
Date: 12 Oct 2003 17:05:41
Message: <3f89c225@news.povray.org>
Take a look at my Glare-Macros. They calculate the size and positions for
proper alignment of a textured rectangle, so somewhere in that code you
should find what you're looking for. If you actually want it explained and
then do it yourself, ask again, I'll make sense of my code and explain it...
;-)

(Aside of the above mentioned, I find looking through someone's code and
understanding it is much like them having explain it, after all, my own code
is written by myself, no copy-paste-work done...)

Regards,
Tim

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: tim.nikias (@) gmx.de


> hmm, 2 questions in a row, at least you know I'm keen :-)
>
> From the description of the camera angle in section 6.4.1,
> and referring to the figure in that section.
>
> I thought it should be easy to determine a line parallel
> to the "right" vector, but passing through the look_at point.
>
> I should then be able to interpolate the dotted lines delimiting
> the angle to this line, and placing an object at each of these
> points they should appear precisely at the edges of the image.
>
> Here's my code. I can't see what's wrong with it, but the
> spheres are definately not at the edges of the screen.
>
> #include "math.inc"
> #include "colors.inc"
>
> #local Location = <0, 0, -10>;
> #local LookAt = <0, 0, 0>;
> #local Angle = 50;
>
> #local Direction = LookAt - Location;
> #local Distance = vlength(Direction);
> #local PerpDirection = vcross(Direction, y);
> #local PerpDistance = sind(Angle/2) * Distance;
> #local MaxLeft = LookAt + PerpDistance * vnormalize(PerpDirection);
> #local MaxRight = LookAt - PerpDistance * vnormalize(PerpDirection);
>
> camera {
>     location Location
>     angle Angle
>     look_at LookAt
> }
>
> sphere { MaxLeft, 0.2 pigment { Red } }
> sphere { LookAt, 0.2 pigment { Green } }
> sphere { MaxRight, 0.2 pigment { Blue } }
>
> light_source { <1, 10, -10> White }
>
> -- 
> Bill Hails


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 24.09.2003


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: camera angle
Date: 12 Oct 2003 17:20:54
Message: <Xns9412ED63761D0torolavkhotmailcom@204.213.191.226>
Bill Hails <bil### [at] europeyahoo-inccom> wrote in 
news:3f896cbf@news.povray.org:

> hmm, 2 questions in a row, at least you know I'm keen :-)
...
> #local Direction = LookAt - Location;
> #local Distance = vlength(Direction);
> #local PerpDirection = vcross(Direction, y);
> #local PerpDistance = sind(Angle/2) * Distance;
...


Try tand() instead of sind()


Tor Olav


Post a reply to this message

From: Bill Hails
Subject: Re: camera angle
Date: 13 Oct 2003 15:51:54
Message: <3f8b0259@news.povray.org>
Tor Olav Kristensen <tor_olav_kCURLYAhotmail.com> wrote:

> Bill Hails <bil### [at] europeyahoo-inccom> wrote in
> news:3f896cbf@news.povray.org:
> 
>> hmm, 2 questions in a row, at least you know I'm keen :-)
> ...
>> #local Direction = LookAt - Location;
>> #local Distance = vlength(Direction);
>> #local PerpDirection = vcross(Direction, y);
>> #local PerpDistance = sind(Angle/2) * Distance;
> ...
> 
> 
> Try tand() instead of sind()

Doh!  Thanks.
That's embarrassing. I'm fiddling around with half-remembered
school trig, and there are real mathematicians out there.

fyi what I'm trying to achieve is a macro that will calculate the angle
given the location, look_at and the distance from the look_at along that
line to the edge of the screen. That way I can move the camera backwards and 
forwards and keep the subject of the picture occupying the right amount of
the screen.

> 
> Tor Olav

-- 
Bill Hails


Post a reply to this message

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