File: Frustum.cpp

package info (click to toggle)
imath 3.1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,468 kB
  • sloc: cpp: 44,687; ansic: 171; sh: 153; python: 60; makefile: 32
file content (22 lines) | stat: -rw-r--r-- 518 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <Imath/ImathFrustum.h>
#include <cassert>

void
frustum_example()
{
    float near = 1.7f;
    float far = 567.0f;
    float left = -3.5f;
    float right = 2.0f;
    float top = 0.9f;
    float bottom = -1.3f;

    Imath::Frustumf frustum (near, far, left, right, top, bottom, false);

    Imath::M44f m = frustum.projectionMatrix();

    Imath::V3f p (1.0f, 1.0f, 1.0f);
    Imath::V2f s = frustum.projectPointToScreen (p);

    assert (s.equalWithAbsError (Imath::V2f (-0.345455f, -1.36364f), 0.0001f));
}