#include "gcl/Geometry.h"
#include "gcl/Colour.h"
Include dependency graph for VecUtil.h:
Go to the source code of this file.
Functions | |||
GCLReal | MaxElt (const Vector &v) | ||
return max elt of v. | |||
GCLReal | MinElt (const Vector &v) | ||
return min elt of v. | |||
Int | MaxEltIndex (const Vector &v) | ||
return index of max elt of v. | |||
Int | MinEltIndex (const Vector &v) | ||
return index of min elt of v. | |||
Void | FindMaxElts (const Vector &a, const Vector &b, Vector &c) | ||
place max elts of a and b in c. | |||
Void | FindMinElts (const Vector &a, const Vector &b, Vector &c) | ||
place min elts of a and b in c. | |||
ClrReal | MaxCmpt (const Colour &c) | ||
equivalents of Elts routines for Colours. | |||
ClrReal | MinCmpt (const Colour &c) | ||
Int | MaxCmptIndex (const Colour &c) | ||
Int | MinCmptIndex (const Colour &c) | ||
Void | FindMaxCmpts (const Colour &a, const Colour &b, Colour &c) | ||
Void | FindMinCmpts (const Colour &a, const Colour &b, Colour &c) | ||
GCLReal | BoxVol (const Vector &min, const Vector &max) | ||
return volume of box defined by min/max. | |||
GCLReal | BoxArea (const Vector &min, const Vector &max) | ||
return surface area of box defined by min/max. | |||
Void | UpdateBounds (const Point& pt, Point& min, Point& max) | ||
update min/max according to pt. | |||
Void | CalcTriAreaNormal ( const Point &a, const Point &b, const Point &c, Vector &n ) | ||
Find triangle normal. More... | |||
Bool | PlaneIntersection ( const Point &start, const Vector &direction, GCLReal d, const Vector &normal, GCLReal &t ) | ||
Intersect plane with ray. More... | |||
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. More... | |||
Vector | FindOrthoVector (const Vector &v) | ||
Find a vector that is orthogonal to v. More... | |||
Vector | RandomVector () | ||
Return random vector with components in [0, 1]. | |||
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 | 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... |
GCLReal BoxArea (const Vector & min, const Vector & max) [inline]
|
GCLReal BoxVol (const Vector & min, const Vector & max) [inline]
|
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.
Void FindMaxCmpts (const Colour & a, const Colour & b, Colour & c) [inline]
|
Void FindMaxElts (const Vector & a, const Vector & b, Vector & c) [inline]
|
Void FindMinCmpts (const Colour & a, const Colour & b, Colour & c) [inline]
|
Void FindMinElts (const Vector & a, const Vector & b, Vector & c) [inline]
|
Vector FindOrthoVector (const Vector & v) [inline]
|
Find a vector that is orthogonal to v.
Warning: the vector this routine returns is *not* normalised. (Though the length will be close to 1.)
ClrReal MaxCmpt (const Colour & c) [inline]
|
Int MaxCmptIndex (const Colour & c) [inline]
|
GCLReal MaxElt (const Vector & v) [inline]
|
Int MaxEltIndex (const Vector & v) [inline]
|
ClrReal MinCmpt (const Colour & c) [inline]
|
Int MinCmptIndex (const Colour & c) [inline]
|
GCLReal MinElt (const Vector & v) [inline]
|
Int MinEltIndex (const Vector & v) [inline]
|
Bool PlaneIntersection (const Point & start, const Vector & direction, GCLReal d, const Vector & normal, GCLReal & t) [inline]
|
Intersect plane with ray.
Returns true if given ray intersects the plane specified by d and normal. (The plane equation is .) If there is an intersection, t is set, and the intersection point will be .
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.
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) |