Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

VecUtil.cc File Reference

#include "gcl/VecUtil.h"

Include dependency graph for VecUtil.cc:

Go to the source code of this file.


Functions

Bool Refract ( GCLReal fromIndex, GCLReal toIndex, const Vector &v, const Vector &n, GCLReal cosNV, Vector &refractDir )
Calculates the refraction vector for the given parameters. More...

Void CalcTriAreaNormal ( const Point &a, const Point &b, const Point &c, Vector &n )
Find triangle normal. More...

Void UpdateBounds (const Point& pt, Point& min, Point& max)
update min/max according to pt.

Double xCross (const Vector &a, const Vector &b, const Vector &c)
Double yCross (const Vector &a, const Vector &b, const Vector &c)
Double zCross (const Vector &a, const Vector &b, const Vector &c)
Bool PointIsInsideTriangle ( const Point &p0, const Point &p1, const Point &p2, const Point &point, Vector *coords )
Test if the point is inside the given triangle. More...

VecTrans ZViewMatrix3 (Vector &dir)
returns a view matrix for a view in the direction of dir, assuming v_up = z axis.

Void UnitSquareToUnitDisc (Coord in, Coord &out)
Unit square to unit disk transform from Shirley & Chiu. More...

Void UnitDiskToUnitSquare (Coord in, Coord &out)
Unit disk to unit square transform from Shirley & Chiu. More...

GCLReal ProjectToBox (Point &min, Point &max, Point &p, Vector &r)
Project p in direction r on to bounding box min/max. More...

Vector RandomVector ()
Return random vector with components in [0, 1].


Variables

const GCLReal kEdgeFuzz = 0.0


Function Documentation

Void CalcTriAreaNormal (const Point & a, const Point & b, const Point & c, Vector & n)

Find triangle normal.

Sets n to the (unnormalised) normal of the triangle defined by points a, b and c. Effectively returns the sum of the three possible edge cross-products, for stability. The length of this vector is 2 x the area of the triangle.

Definition at line 35 of file VecUtil.cc.

Bool PointIsInsideTriangle (const Point & v0, const Point & v1, const Point & v2, const Point & point, Vector * coords = 0)

Test if the point is inside the given triangle.

Given a point lying in the plane of the triangle, we return false if it lies outside the triangle, and its barycentric coordinates if it lies inside.

Definition at line 84 of file VecUtil.cc.

GCLReal ProjectToBox (Point & min, Point & max, Point & p, Vector & r)

Project p in direction r on to bounding box min/max.

Returns t such that this projected point = p + t * r.

Definition at line 291 of file VecUtil.cc.

Vector RandomVector ()

Return random vector with components in [0, 1].

Definition at line 309 of file VecUtil.cc.

Bool Refract (GCLReal fromIndex, GCLReal toIndex, const Vector & v, const Vector & n, GCLReal cosNV, Vector & refractDir)

Calculates the refraction vector for the given parameters.

Returns true if total internal reflection occurs.

Parameters:
n  
  • I
cosNV   N
refractDir   -I.N

Definition at line 13 of file VecUtil.cc.

Void UnitDiskToUnitSquare (Coord in, Coord & out)

Unit disk to unit square transform from Shirley & Chiu.

Parameters:
in   a point on radius 1 disk
out   a point in [0,1]^2

Definition at line 248 of file VecUtil.cc.

Void UnitSquareToUnitDisc (Coord in, Coord & out)

Unit square to unit disk transform from Shirley & Chiu.

Parameters:
in   a point in [0,1]^2
out   a point on radius 1 disk

This transforms points on [0,1]^2 to points on unit disk centered at origin. Each "pie-slice" quadrant of square is handled as a seperate case. The bad floating point cases are all handled appropriately. The regions for (a,b) are:

                    phi = pi/2
                   -----*-----
                   |\       /|
                   |  \ 2 /  |
                   |   \ /   |
             phi=pi* 3  *  1 *phi = 0
                   |   / \   |
                   |  / 4 \  |
                   |/       \|
                   -----*-----
                    phi = 3pi/2
    

Definition at line 179 of file VecUtil.cc.

Void UpdateBounds (const Point & pt, Point & min, Point & max)

update min/max according to pt.

Definition at line 54 of file VecUtil.cc.

VecTrans ZViewMatrix3 (Vector & dir)

returns a view matrix for a view in the direction of dir, assuming v_up = z axis.

Definition at line 161 of file VecUtil.cc.

Double xCross (const Vector & a, const Vector & b, const Vector & c) [inline]

Definition at line 72 of file VecUtil.cc.

Double yCross (const Vector & a, const Vector & b, const Vector & c) [inline]

Definition at line 75 of file VecUtil.cc.

Double zCross (const Vector & a, const Vector & b, const Vector & c) [inline]

Definition at line 78 of file VecUtil.cc.


Variable Documentation

const GCLReal kEdgeFuzz = 0.0

Definition at line 82 of file VecUtil.cc.


Generated at Sat Aug 5 00:17:04 2000 for Graphics Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000