Re: pfMakePerspFrust error?

New Message Reply Date view Thread view Subject view Author view

Michael Jones (mtj++at++babar)
Tue, 9 May 1995 08:05:00 -0700


On May 5, 2:55pm, ROY RUDDLE wrote:
> Subject: pfMakePerspFrust error?
:Ref. p153 in the 1.2 Performer Reference manual. I've tried doing this
:with just one frustrum, but the FOV I get is 45 (horiz) by 43.xxx (vert).
:
:Any suggestions anyone? Code is (C++):
:
:pfChannel *left = pfNewChan(pfGetPipe(0));
:float v_fov = 22.5f;
:float t = pfTan( v_fov );
:pfMakePerspFrust(left, -1.0f, 0.0f, -t, t);
:pfFrustNearFar(left, 1.0f, 1000.0f);
:float ffh, ffv;
:pfGetFrustFOV( left, &ffh, &ffv );
:cout << "frust FOV " << ffh << " " << ffv << endl;

This is indeed a bug. First report I've seen, although it seems to
have inspired several similar bug reports. I looked at the code
and there is indeed a problem. I fixed it, though, and the new
results are as expected:

babar!mtj% cat frust.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "Performer/pr.h"

main ()
{
    float t = 0.0f;
    float h = 0.0f;
    float v = 0.0f;
    pfFrustum *frust;

    t = pfTan(12.5f);

    frust = pfNewFrust(NULL);
    pfMakePerspFrust(frust, -1.0f, 0.0f, -t, t);
    pfFrustNearFar(frust, 1.0f, 1000.0f);

    pfGetFrustFOV(frust, &h, &v);

    printf("h = %f\n", h);
    printf("v = %f\n", v);
}
babar!mtj% make frust.dsocmd
babar!mtj% ./frust.dsocmd
h = 53.130104
v = 45.000004

The bug was that the center of projection was always mistakenly
computed to be at the "center" of the near plane, as is the case for
symmetric perspective frusta.

It's fixed now.

-- 

Be seeing you, Phone:415.390.1455 Fax:415.965.2658 M/S:8U-590 Michael T. Jones Silicon Graphics, Advanced Graphics Division mtj++at++sgi.com 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:29 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.