#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 |
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 () |
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.
n |
|
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.
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.
in | a point in [0,1]^2 |
out |
a point on radius 1 disk
|
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) |
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.
const GCLReal kEdgeFuzz = 0.0 |
Definition at line 82 of file VecUtil.cc.