|
|
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
|
|