src/engine/eRectangle.cpp File Reference

#include "eRectangle.h"
#include "tError.h"

Include dependency graph for eRectangle.cpp:

Go to the source code of this file.

Functions

static void se_Clamp (REAL &toClamp, REAL reference, REAL direction, REAL &max)
static REAL se_Clip (eCoord const &start, eCoord &stop, eCoord const &reference, eCoord const &normal)


Function Documentation

static void se_Clamp ( REAL toClamp,
REAL  reference,
REAL  direction,
REAL max 
) [inline, static]

Definition at line 120 of file eRectangle.cpp.

References REAL.

Referenced by eRectangle::Clamp().

00121 {
00122     REAL move = (toClamp - reference)*direction;
00123     if (move > max)
00124         max = move;
00125     if (move > 0)
00126         toClamp = reference;
00127 }

Here is the caller graph for this function:

static REAL se_Clip ( eCoord const &  start,
eCoord &  stop,
eCoord const &  reference,
eCoord const &  normal 
) [inline, static]

Definition at line 152 of file eRectangle.cpp.

References in, and REAL.

Referenced by eRectangle::Clip().

00154 {
00155     // calculate how far out on the other side of the reference point the stop point is
00156     REAL out = eCoord::F( normal, stop-reference );
00157     if ( out <= 0 )
00158         return 1; // nothing to clamp
00159 
00160     // calculate how far inside the startpoint lies
00161     REAL in = eCoord::F( normal, reference-start );
00162     if ( in < 0 )
00163         in = 0;
00164 
00165     // clip
00166     if ( out+in > 0 )
00167     {
00168         stop = (start * out + stop * in)*(1/(in+out));
00169         return in/(in+out);
00170     }
00171 
00172     return 1;
00173 }

Here is the caller graph for this function:


Generated on Sat Mar 15 22:58:40 2008 for Armagetron Advanced by  doxygen 1.5.4