frustum.h File Reference

View-frustum data types and related operations. More...

#include "generic/enumeration.h"
#include "math/matrix.h"
#include "math/plane.h"
#include "math/aabb.h"
#include "math/line.h"
Include dependency graph for frustum.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  Vector4ClipLT< Index >
class  Vector4ClipGT< Index >
class  Vector4ClipPolygon< ClipPlane >
struct  Frustum
struct  VolumeIntersection

Defines

#define INCLUDED_MATH_FRUSTUM_H
#define CLIP_X_LT_W(p)   (Vector4ClipLT< IntegralConstant<0> >::compare(p))
#define CLIP_X_GT_W(p)   (Vector4ClipGT< IntegralConstant<0> >::compare(p))
#define CLIP_Y_LT_W(p)   (Vector4ClipLT< IntegralConstant<1> >::compare(p))
#define CLIP_Y_GT_W(p)   (Vector4ClipGT< IntegralConstant<1> >::compare(p))
#define CLIP_Z_LT_W(p)   (Vector4ClipLT< IntegralConstant<2> >::compare(p))
#define CLIP_Z_GT_W(p)   (Vector4ClipGT< IntegralConstant<2> >::compare(p))

Typedefs

typedef unsigned char ClipResult
typedef EnumeratedValue
< VolumeIntersection
VolumeIntersectionValue

Functions

Matrix4 matrix4_frustum (float left, float right, float bottom, float top, float nearval, float farval)
ClipResult homogenous_clip_point (const Vector4 &clipped)
ClipResult matrix4_clip_point (const Matrix4 &self, const Vector3 &point, Vector4 &clipped)
 Clips point by canonical matrix self. Stores the result in clipped. Returns a bitmask indicating which clip-planes the point was outside.
std::size_t homogenous_clip_triangle (Vector4 clipped[9])
std::size_t matrix4_clip_triangle (const Matrix4 &self, const Vector3 &p0, const Vector3 &p1, const Vector3 &p2, Vector4 clipped[9])
 Transforms and clips the triangle formed by p0, p1, p2 by the canonical matrix self. Stores the resulting polygon in clipped. Returns the number of points in the resulting polygon.
std::size_t homogenous_clip_line (Vector4 clipped[2])
std::size_t matrix4_clip_line (const Matrix4 &self, const Vector3 &p0, const Vector3 &p1, Vector4 clipped[2])
 Transforms and clips the line formed by p0, p1 by the canonical matrix self. Stores the resulting line in clipped. Returns the number of points in the resulting line.
Frustum frustum_transformed (const Frustum &frustum, const Matrix4 &transform)
Frustum frustum_inverse_transformed (const Frustum &frustum, const Matrix4 &transform)
bool viewproj_test_point (const Matrix4 &viewproj, const Vector3 &point)
bool viewproj_test_transformed_point (const Matrix4 &viewproj, const Vector3 &point, const Matrix4 &localToWorld)
Frustum frustum_from_viewproj (const Matrix4 &viewproj)
const VolumeIntersectionValue c_volumeOutside (VolumeIntersectionValue::OUTSIDE)
const VolumeIntersectionValue c_volumeInside (VolumeIntersectionValue::INSIDE)
const VolumeIntersectionValue c_volumePartial (VolumeIntersectionValue::PARTIAL)
VolumeIntersectionValue frustum_test_aabb (const Frustum &frustum, const AABB &aabb)
double plane_distance_to_point (const Plane3 &plane, const Vector3 &point)
double plane_distance_to_oriented_extents (const Plane3 &plane, const Vector3 &extents, const Matrix4 &orientation)
bool plane_contains_oriented_aabb (const Plane3 &plane, const AABB &aabb, const Matrix4 &orientation)
 Return false if aabb with orientation is partially or completely outside plane.
VolumeIntersectionValue frustum_intersects_transformed_aabb (const Frustum &frustum, const AABB &aabb, const Matrix4 &localToWorld)
bool plane3_test_point (const Plane3 &plane, const Vector3 &point)
bool plane3_test_line (const Plane3 &plane, const Segment &segment)
bool frustum_test_point (const Frustum &frustum, const Vector3 &point)
bool frustum_test_line (const Frustum &frustum, const Segment &segment)
bool viewer_test_plane (const Vector4 &viewer, const Plane3 &plane)
Vector3 triangle_cross (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
bool viewer_test_triangle (const Vector4 &viewer, const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
Vector4 viewer_from_transformed_viewer (const Vector4 &viewer, const Matrix4 &transform)
bool viewer_test_transformed_plane (const Vector4 &viewer, const Plane3 &plane, const Matrix4 &localToWorld)
Vector4 viewer_from_viewproj (const Matrix4 &viewproj)

Variables

const ClipResult c_CLIP_PASS = 0x00
const ClipResult c_CLIP_LT_X = 0x01
const ClipResult c_CLIP_GT_X = 0x02
const ClipResult c_CLIP_LT_Y = 0x04
const ClipResult c_CLIP_GT_Y = 0x08
const ClipResult c_CLIP_LT_Z = 0x10
const ClipResult c_CLIP_GT_Z = 0x20
const ClipResult c_CLIP_FAIL = 0x3F

Detailed Description

View-frustum data types and related operations.

Definition in file frustum.h.


Define Documentation

#define CLIP_X_GT_W (  )     (Vector4ClipGT< IntegralConstant<0> >::compare(p))

Definition at line 124 of file frustum.h.

Referenced by homogenous_clip_line(), and homogenous_clip_point().

#define CLIP_X_LT_W (  )     (Vector4ClipLT< IntegralConstant<0> >::compare(p))

Definition at line 123 of file frustum.h.

Referenced by homogenous_clip_line(), and homogenous_clip_point().

#define CLIP_Y_GT_W (  )     (Vector4ClipGT< IntegralConstant<1> >::compare(p))

Definition at line 126 of file frustum.h.

Referenced by homogenous_clip_line(), and homogenous_clip_point().

#define CLIP_Y_LT_W (  )     (Vector4ClipLT< IntegralConstant<1> >::compare(p))

Definition at line 125 of file frustum.h.

Referenced by homogenous_clip_line(), and homogenous_clip_point().

#define CLIP_Z_GT_W (  )     (Vector4ClipGT< IntegralConstant<2> >::compare(p))

Definition at line 128 of file frustum.h.

Referenced by homogenous_clip_line(), and homogenous_clip_point().

#define CLIP_Z_LT_W (  )     (Vector4ClipLT< IntegralConstant<2> >::compare(p))

Definition at line 127 of file frustum.h.

Referenced by homogenous_clip_line(), and homogenous_clip_point().

#define INCLUDED_MATH_FRUSTUM_H

Definition at line 28 of file frustum.h.


Typedef Documentation

typedef unsigned char ClipResult

Definition at line 44 of file frustum.h.

Definition at line 404 of file frustum.h.


Function Documentation

const VolumeIntersectionValue c_volumeInside ( VolumeIntersectionValue::INSIDE   ) 
const VolumeIntersectionValue c_volumeOutside ( VolumeIntersectionValue::OUTSIDE   ) 
const VolumeIntersectionValue c_volumePartial ( VolumeIntersectionValue::PARTIAL   ) 

Referenced by frustum_test_aabb().

Frustum frustum_from_viewproj ( const Matrix4 &  viewproj  )  [inline]

Definition at line 383 of file frustum.h.

References plane3_normalised().

VolumeIntersectionValue frustum_intersects_transformed_aabb ( const Frustum frustum,
const AABB &  aabb,
const Matrix4 &  localToWorld 
) [inline]
Frustum frustum_inverse_transformed ( const Frustum frustum,
const Matrix4 &  transform 
) [inline]
VolumeIntersectionValue frustum_test_aabb ( const Frustum frustum,
const AABB &  aabb 
) [inline]
bool frustum_test_line ( const Frustum frustum,
const Segment &  segment 
) [inline]
bool frustum_test_point ( const Frustum frustum,
const Vector3 point 
) [inline]
Frustum frustum_transformed ( const Frustum frustum,
const Matrix4 &  transform 
) [inline]
std::size_t homogenous_clip_line ( Vector4  clipped[2]  )  [inline]
ClipResult homogenous_clip_point ( const Vector4 clipped  )  [inline]
std::size_t homogenous_clip_triangle ( Vector4  clipped[9]  )  [inline]

Definition at line 161 of file frustum.h.

References count.

Referenced by matrix4_clip_triangle().

std::size_t matrix4_clip_line ( const Matrix4 &  self,
const Vector3 p0,
const Vector3 p1,
Vector4  clipped[2] 
) [inline]

Transforms and clips the line formed by p0, p1 by the canonical matrix self. Stores the resulting line in clipped. Returns the number of points in the resulting line.

Definition at line 324 of file frustum.h.

References homogenous_clip_line().

ClipResult matrix4_clip_point ( const Matrix4 &  self,
const Vector3 point,
Vector4 clipped 
) [inline]

Clips point by canonical matrix self. Stores the result in clipped. Returns a bitmask indicating which clip-planes the point was outside.

Definition at line 151 of file frustum.h.

References homogenous_clip_point().

std::size_t matrix4_clip_triangle ( const Matrix4 &  self,
const Vector3 p0,
const Vector3 p1,
const Vector3 p2,
Vector4  clipped[9] 
) [inline]

Transforms and clips the triangle formed by p0, p1, p2 by the canonical matrix self. Stores the resulting polygon in clipped. Returns the number of points in the resulting polygon.

Definition at line 176 of file frustum.h.

References homogenous_clip_triangle().

Matrix4 matrix4_frustum ( float  left,
float  right,
float  bottom,
float  top,
float  nearval,
float  farval 
) [inline]

Definition at line 36 of file frustum.h.

bool plane3_test_line ( const Plane3 plane,
const Segment &  segment 
) [inline]

Definition at line 498 of file frustum.h.

Referenced by frustum_test_line().

bool plane3_test_point ( const Plane3 plane,
const Vector3 point 
) [inline]

Definition at line 493 of file frustum.h.

References Plane3::dist(), BasicVector3< Element >::dot(), and Plane3::normal().

Referenced by frustum_test_point().

bool plane_contains_oriented_aabb ( const Plane3 plane,
const AABB &  aabb,
const Matrix4 &  orientation 
) [inline]

Return false if aabb with orientation is partially or completely outside plane.

Definition at line 472 of file frustum.h.

References plane_distance_to_oriented_extents(), and plane_distance_to_point().

Referenced by frustum_intersects_transformed_aabb().

double plane_distance_to_oriented_extents ( const Plane3 plane,
const Vector3 extents,
const Matrix4 &  orientation 
) [inline]

Definition at line 464 of file frustum.h.

References Plane3::normal().

Referenced by plane_contains_oriented_aabb().

double plane_distance_to_point ( const Plane3 plane,
const Vector3 point 
) [inline]

Definition at line 459 of file frustum.h.

References Plane3::d, and Plane3::normal().

Referenced by plane_contains_oriented_aabb().

Vector3 triangle_cross ( const Vector3 p0,
const Vector3 p1,
const Vector3 p2 
) [inline]

Definition at line 522 of file frustum.h.

References BasicVector3< Element >::crossProduct().

Referenced by triangles_same_winding(), and viewer_test_triangle().

Vector4 viewer_from_transformed_viewer ( const Vector4 viewer,
const Matrix4 &  transform 
) [inline]

Definition at line 533 of file frustum.h.

References BasicVector4< Element >::getVector3().

Referenced by viewer_test_transformed_plane().

Vector4 viewer_from_viewproj ( const Matrix4 &  viewproj  )  [inline]

Definition at line 551 of file frustum.h.

bool viewer_test_plane ( const Vector4 viewer,
const Plane3 plane 
) [inline]

Definition at line 517 of file frustum.h.

References Plane3::a, Plane3::b, Plane3::c, and Plane3::d.

Referenced by viewer_test_transformed_plane().

bool viewer_test_transformed_plane ( const Vector4 viewer,
const Plane3 plane,
const Matrix4 &  localToWorld 
) [inline]
bool viewer_test_triangle ( const Vector4 viewer,
const Vector3 p0,
const Vector3 p1,
const Vector3 p2 
) [inline]

Definition at line 527 of file frustum.h.

References triangle_cross().

bool viewproj_test_point ( const Matrix4 &  viewproj,
const Vector3 point 
) [inline]

Definition at line 370 of file frustum.h.

References f.

Referenced by viewproj_test_transformed_point().

bool viewproj_test_transformed_point ( const Matrix4 &  viewproj,
const Vector3 point,
const Matrix4 &  localToWorld 
) [inline]

Definition at line 378 of file frustum.h.

References viewproj_test_point().


Variable Documentation

const ClipResult c_CLIP_FAIL = 0x3F

Definition at line 52 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_GT_X = 0x02

Definition at line 47 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_GT_Y = 0x08

Definition at line 49 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_GT_Z = 0x20

Definition at line 51 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_LT_X = 0x01

Definition at line 46 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_LT_Y = 0x04

Definition at line 48 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_LT_Z = 0x10

Definition at line 50 of file frustum.h.

Referenced by homogenous_clip_point().

const ClipResult c_CLIP_PASS = 0x00

Definition at line 45 of file frustum.h.

Referenced by homogenous_clip_line().


Generated by  doxygen 1.6.2