This module contains general geometry primitives for use in 2D or 3D spaces. More...
Classes | |
struct | frustum_t |
Basic frustum object. More... | |
struct | point2d_t< T > |
Template for two-dimensional point. More... | |
struct | rect2d_t< T > |
templated 2D rectangle More... | |
struct | matrix4_t |
4x4 matrix object. More... | |
struct | placement_t |
struct | plane_t |
basic 2D plane in 3D space. More... | |
struct | prism_base_t< Size > |
a prism is a 3D object, basically a polygon in some plane with some extent in the plane normal direction. More... | |
struct | quaternion_t |
struct | xform_2d_t |
Functions | |
point2d_t::point2d_t (IN const point2d_t &pt) throw () | |
void | point2d_t::set (IN T in_x, IN T in_y) throw () |
void | point2d_t::clear (void) throw () |
void | point2d_t::dump (const char *title) const throw () |
dumps contents to stderr | |
point2d_t | point2d_t::operator- (IN const point2d_t &rhs) const throw () |
vector subtraction | |
point2d_t | point2d_t::operator+ (IN const point2d_t &rhs) const throw () |
vector addition | |
void | point2d_t::normalize (void) throw () |
static T | point2d_t::dotProduct (IN const point2d_t &u, IN const point2d_t &v) throw () |
rect2d_t::rect2d_t (void) throw () | |
rect2d_t::rect2d_t (IN T iLeft, IN T iTop, IN T iRight, IN T iBottom) throw () | |
void | rect2d_t::inflate (IN const rect2d_t &r) throw () |
expand rect to fully contain input rect | |
bool | rect2d_t::isValid (void) const throw () |
valid? | |
void | rect2d_t::expand (IN T s) throw () |
expand rect in all dimensions by provided amount | |
bool | rect2d_t::isEmpty (void) const throw () |
null size? | |
void | rect2d_t::shift (IN T dx, IN T dy) throw () |
move rect by specified dx,dy amount | |
bool | rect2d_t::contains (IN const point_t &pt) const throw () |
does this rect contain the specified point? | |
bool | rect2d_t::contains (IN float x, IN float y) const throw () |
does this rect contain the specified point? | |
bool | rect2d_t::contains (IN const rect2d_t &r) const throw () |
does this rect fully contain the specified rect? | |
bool | rect2d_t::intersects (IN const rect2d_t &r) const throw () |
does this rect intersect the specified rect? | |
void | rect2d_t::expandToInclude (IN const point_t &p) throw () |
expand to include the given point | |
void | rect2d_t::expandToInclude (IN T x, IN T y) throw () |
expand to include the given point | |
void | rect2d_t::set (IN T in_left, IN T in_top, IN T in_right, IN T in_bottom) throw () |
explicitly set the rect coordinates | |
void | rect2d_t::fromPoints (IN const point_t &p0, IN const point_t &p1) throw () |
minimum bounding rect containing the two points | |
void | rect2d_t::scale (IN float rX, IN float rY) throw () |
scale out in X and Y directions | |
void | rect2d_t::clear (void) throw () |
reset rect to be null rectangle at (0,0) | |
void | rect2d_t::dump (IN const char *title) const throw () |
debug helper to dump rectangle to std err | |
point_t | rect2d_t::getTopLeft (void) const throw () |
return top left coordinate | |
point_t | rect2d_t::getBottomRight (void) const throw () |
return top right coordinate | |
Variables | |
T | point2d_t::x |
T | point2d_t::y |
T | rect2d_t::left |
T | rect2d_t::top |
T | rect2d_t::right |
T | rect2d_t::bottom |
| |
enum | eContains { eContains_Fully = 0x01, eContains_Partial = 0x02, eContains_None = 0x10, eContains_HitMask = 0x03, eContains_Invalid = 0 } |
point3d_t | operator* (IN const point3d_t &p, IN float r) throw () |
point3d_t | operator* (IN float r, IN const point3d_t &p) throw () |
point3d_t | operator+ (IN const point3d_t &p, IN const point3d_t &q) throw () |
point3d_t | operator- (IN const point3d_t &p, IN const point3d_t &q) throw () |
float | dotProduct (IN const point3d_t &p, IN const point3d_t &q) throw () |
get dot product of two points/vectors | |
point3d_t | crossProduct (IN const point3d_t &p, IN const point3d_t &q) throw () |
const vector3d_t & | normalize (IO vector3d_t &v) throw () |
static float | getDistance2 (IN const point3d_t &p0, IN const point3d_t &p1) throw () |
point3d_t | readPoint (IN std::istream &stream) |
rect3d_t | readRect (IN std::istream &stream) |
void | parsePoint3d (IO std::istream &stream, OUT point3d_t &p) |
void | parseRect3d (IO std::istream &stream, OUT rect3d_t &r) |
void | parsePoint3d (IN const char *string, OUT point3d_t &p) |
void | parseRect3d (IN const char *string, OUT rect3d_t &r) |
typedef point3d_t | vector3d_t |
This module contains general geometry primitives for use in 2D or 3D spaces.
typedef point3d_t vector3d_t |
Definition at line 167 of file geometry_3d.h.
enum eContains |
this enum can be used for some intersection/containment tests
Definition at line 48 of file geometry_3d.h.
point2d_t< T >::point2d_t | ( | IN const point2d_t< T > & | pt | ) | throw () [inline, inherited] |
Definition at line 77 of file geometry_2d.h.
void point2d_t< T >::set | ( | IN T | in_x, | |
IN T | in_y | |||
) | throw () [inline, inherited] |
Definition at line 82 of file geometry_2d.h.
void point2d_t< T >::clear | ( | void | ) | throw () [inline, inherited] |
Definition at line 87 of file geometry_2d.h.
void point2d_t< T >::dump | ( | const char * | title | ) | const throw () [inline, inherited] |
dumps contents to stderr
Definition at line 94 of file geometry_2d.h.
point2d_t point2d_t< T >::operator- | ( | IN const point2d_t< T > & | rhs | ) | const throw () [inline, inherited] |
vector subtraction
Definition at line 101 of file geometry_2d.h.
point2d_t point2d_t< T >::operator+ | ( | IN const point2d_t< T > & | rhs | ) | const throw () [inline, inherited] |
vector addition
Definition at line 108 of file geometry_2d.h.
void point2d_t< T >::normalize | ( | void | ) | throw () [inline, inherited] |
Definition at line 112 of file geometry_2d.h.
static T point2d_t< T >::dotProduct | ( | IN const point2d_t< T > & | u, | |
IN const point2d_t< T > & | v | |||
) | throw () [inline, static, inherited] |
Definition at line 121 of file geometry_2d.h.
Definition at line 139 of file geometry_2d.h.
rect2d_t< T >::rect2d_t | ( | IN T | iLeft, | |
IN T | iTop, | |||
IN T | iRight, | |||
IN T | iBottom | |||
) | throw () [inline, inherited] |
Definition at line 140 of file geometry_2d.h.
void rect2d_t< T >::inflate | ( | IN const rect2d_t< T > & | r | ) | throw () [inline, inherited] |
expand rect to fully contain input rect
Definition at line 148 of file geometry_2d.h.
bool rect2d_t< T >::isValid | ( | void | ) | const throw () [inline, inherited] |
valid?
Definition at line 160 of file geometry_2d.h.
void rect2d_t< T >::expand | ( | IN T | s | ) | throw () [inline, inherited] |
expand rect in all dimensions by provided amount
Definition at line 165 of file geometry_2d.h.
bool rect2d_t< T >::isEmpty | ( | void | ) | const throw () [inline, inherited] |
null size?
Definition at line 173 of file geometry_2d.h.
void rect2d_t< T >::shift | ( | IN T | dx, | |
IN T | dy | |||
) | throw () [inline, inherited] |
move rect by specified dx,dy amount
Definition at line 181 of file geometry_2d.h.
bool rect2d_t< T >::contains | ( | IN const point_t & | pt | ) | const throw () [inline, inherited] |
does this rect contain the specified point?
Definition at line 189 of file geometry_2d.h.
bool rect2d_t< T >::contains | ( | IN float | x, | |
IN float | y | |||
) | const throw () [inline, inherited] |
does this rect contain the specified point?
Definition at line 197 of file geometry_2d.h.
bool rect2d_t< T >::contains | ( | IN const rect2d_t< T > & | r | ) | const throw () [inline, inherited] |
does this rect fully contain the specified rect?
Definition at line 202 of file geometry_2d.h.
bool rect2d_t< T >::intersects | ( | IN const rect2d_t< T > & | r | ) | const throw () [inline, inherited] |
does this rect intersect the specified rect?
Definition at line 210 of file geometry_2d.h.
void rect2d_t< T >::expandToInclude | ( | IN const point_t & | p | ) | throw () [inline, inherited] |
expand to include the given point
Definition at line 220 of file geometry_2d.h.
void rect2d_t< T >::expandToInclude | ( | IN T | x, | |
IN T | y | |||
) | throw () [inline, inherited] |
expand to include the given point
Definition at line 225 of file geometry_2d.h.
void rect2d_t< T >::set | ( | IN T | in_left, | |
IN T | in_top, | |||
IN T | in_right, | |||
IN T | in_bottom | |||
) | throw () [inline, inherited] |
explicitly set the rect coordinates
Definition at line 233 of file geometry_2d.h.
void rect2d_t< T >::fromPoints | ( | IN const point_t & | p0, | |
IN const point_t & | p1 | |||
) | throw () [inline, inherited] |
minimum bounding rect containing the two points
Definition at line 242 of file geometry_2d.h.
void rect2d_t< T >::scale | ( | IN float | rX, | |
IN float | rY | |||
) | throw () [inline, inherited] |
scale out in X and Y directions
Definition at line 250 of file geometry_2d.h.
void rect2d_t< T >::clear | ( | void | ) | throw () [inline, inherited] |
reset rect to be null rectangle at (0,0)
Definition at line 258 of file geometry_2d.h.
void rect2d_t< T >::dump | ( | IN const char * | title | ) | const throw () [inline, inherited] |
debug helper to dump rectangle to std err
Definition at line 261 of file geometry_2d.h.
point_t rect2d_t< T >::getTopLeft | ( | void | ) | const throw () [inline, inherited] |
return top left coordinate
Definition at line 268 of file geometry_2d.h.
point_t rect2d_t< T >::getBottomRight | ( | void | ) | const throw () [inline, inherited] |
return top right coordinate
Definition at line 273 of file geometry_2d.h.
Definition at line 224 of file geometry_3d.cpp.
Definition at line 134 of file geometry_3d.h.
Definition at line 138 of file geometry_3d.h.
Definition at line 143 of file geometry_3d.h.
get dot product of two points/vectors
Definition at line 149 of file geometry_3d.h.
Definition at line 156 of file geometry_3d.h.
const vector3d_t& normalize | ( | IO vector3d_t & | v | ) | throw () |
Definition at line 239 of file geometry_3d.cpp.
static float getDistance2 | ( | IN const point3d_t & | p0, | |
IN const point3d_t & | p1 | |||
) | throw () [inline, static] |
Definition at line 352 of file geometry_3d.h.
point3d_t readPoint | ( | IN std::istream & | stream | ) |
Definition at line 260 of file geometry_3d.cpp.
rect3d_t readRect | ( | IN std::istream & | stream | ) |
Definition at line 283 of file geometry_3d.cpp.
void parsePoint3d | ( | IO std::istream & | stream, | |
OUT point3d_t & | p | |||
) |
Definition at line 312 of file geometry_3d.cpp.
void parseRect3d | ( | IO std::istream & | stream, | |
OUT rect3d_t & | r | |||
) |
Definition at line 332 of file geometry_3d.cpp.
void parsePoint3d | ( | IN const char * | string, | |
OUT point3d_t & | p | |||
) |
Definition at line 348 of file geometry_3d.cpp.
void parseRect3d | ( | IN const char * | string, | |
OUT rect3d_t & | r | |||
) |
Definition at line 364 of file geometry_3d.cpp.
T point2d_t< T >::x [inherited] |
Definition at line 127 of file geometry_2d.h.
T point2d_t< T >::y [inherited] |
Definition at line 128 of file geometry_2d.h.
T rect2d_t< T >::left [inherited] |
Definition at line 278 of file geometry_2d.h.
T rect2d_t< T >::top [inherited] |
Definition at line 279 of file geometry_2d.h.
T rect2d_t< T >::right [inherited] |
Definition at line 280 of file geometry_2d.h.
T rect2d_t< T >::bottom [inherited] |
Definition at line 281 of file geometry_2d.h.