POV-Ray : Newsgroups : povray.binaries.images : Visualizing camera view frustum : Re: Visualizing camera view frustum Server Time
27 Apr 2024 00:58:54 EDT (-0400)
  Re: Visualizing camera view frustum  
From: Bald Eagle
Date: 19 Jan 2017 08:00:01
Message: <web.5880b8311652a4dcc437ac910@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:


> Are you using a perspective camera or orthographic?


I had hoped that the diagram would clearly show the perspective camera's frustum
- an orthographic view frustum would appear as a rectangular solid instead of a
[truncated] square-base pyramid.

I found a good an very fast method of determining the p-vertex,
http://www.txutxi.com/?p=584
but I'm currently struggling with understanding _exactly_ how planes and their
normals get calculated.

I'm using equations from Paul Bourke's site to calculate the A, B, C and (-)D
coefficients in the plane equation,

#declare Point1 = <-1, 0.5, 1>;
#declare Point2 = <1, -0.25, 1>;
#declare Point3 = <0, -1, -1>;

cylinder {Point1, Point2 0.005 texture {pigment {Black}} }
cylinder {Point2, Point3 0.005 texture {pigment {Black}} }
cylinder {Point3, Point1 0.005 texture {pigment {Black}} }


// derive the plane equation
#declare A1 = Point1.y*(Point2.z-Point3.z) + Point2.y*(Point3.z-Point1.z) +
Point3.y*(Point1.z-Point2.z);
#declare B1 = Point1.z*(Point2.x-Point3.x) + Point2.z*(Point3.x-Point1.x) +
Point3.z*(Point1.x-Point2.x);
#declare C1 = Point1.x*(Point2.y-Point3.y) + Point2.x*(Point3.y-Point1.y) +
Point3.x*(Point1.y-Point2.y);
#declare D1 = -1*(Point1.x*(Point2.y*Point3.z-Point3.y*Point2.z) +
Point2.x*(Point3.y*Point1.z-Point1.y*Point3.z) +
Point3.x*(Point1.y*Point2.z-Point2.y*Point1.z));
#declare L = vlength (<A1, B1, C1>);

and after much fiddling, got the plane to pass through the three points, and the
p-vertex to be where I think it ought to be.

I'd like to figure out the length and direction of the normal vector of the
plane, and how to calculate the position of a point in the plane that is closest
to a point not in the plane (in this case, the p-vertex).

Likely there's a way to use POV-Ray's vector functions, and macros, with
rotations and translations, but I'd like to use a direct calculation - something
that would be straight out of analytical geometry.
(I looked through Friedrich Lohmueller's site and his analytical_g.inc file, but
I didn't find exactly what I was looking for - maybe I missed it)

[I am, admittedly, probably not thinking about this in the right way, and am
thus overcomplicating it for myself as usual]


Post a reply to this message

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