|
| AffPoint () |
|
| AffPoint (const AffPoint &P) |
|
| AffPoint (const AffVector &v) |
|
| AffPoint (double xx, double yy, double zz=0.0) |
|
| AffPoint (const double P[]) |
|
| AffPoint (const float P[]) |
|
virtual | ~AffPoint () |
|
AffPoint | operator= (const AffPoint &rhs) |
|
AffPoint | operator+= (const AffVector &rhs) |
|
AffPoint | operator+= (const AffPoint &rhs) |
|
AffPoint | operator-= (const AffVector &rhs) |
|
AffPoint | operator*= (double f) |
|
AffPoint | operator/= (double f) |
|
double | operator[] (int index) const |
|
AffPoint | operator+ (const AffPoint &p2) const |
|
AffPoint | operator* (double f) const |
|
AffPoint | operator/ (double f) const |
|
AffVector | operator- (const AffPoint &p2) const |
|
AffPoint | operator+ (const AffVector &v2) const |
|
AffPoint | operator- (const AffVector &v2) const |
|
double * | aCoords (double *coords, int offset=0) const |
|
double * | aCoords (double coords[][3], int offset=0) const |
|
float * | aCoords (float *coords, int offset=0) const |
|
float * | aCoords (float coords[][3], int offset=0) const |
|
void | assign (double xx, double yy, double zz) |
|
void | barycentricCoords (const AffPoint &P1, const AffPoint &P2, const AffPoint &P3, double &b1, double &b2, double &b3) const |
|
void | barycentricCoords (const AffPoint &P1, const AffPoint &P2, double &b1, double &b2) const |
|
bool | coincidentWith (const AffPoint &p) const |
|
double | distanceFromLine (const AffPoint &B, const AffVector &u) const |
|
double | distanceFromOrigin () const |
|
double | distanceSquaredFromLine (const AffPoint &B, const AffVector &u) const |
|
double | distanceSquaredFromOrigin () const |
|
double | distanceSquaredTo (const AffPoint &p) const |
|
double | distanceTo (const AffPoint &p) const |
|
double | normalize () |
|
double * | pCoords (double *coords, double w, int offset=0) const |
|
float * | pCoords (float *coords, float w, int offset=0) const |
|
void | swizzle (char xyz[3]) |
|
void | toCylindrical (double &r, double &theta, double &z) const |
|
void | toSpherical (double &rho, double &theta, double &phi) const |
|
|
static AffPoint | centroid (const AffPoint p[], int nPoints) |
|
static AffPoint | fromBarycentricCoords (const AffPoint &P1, const AffPoint &P2, const AffPoint &P3, double b1, double b2, double b3) |
|
static AffPoint | fromBarycentricCoords (const AffPoint &P1, const AffPoint &P2, double b1, double b2) |
|
static AffPoint | fromCylindrical (double r, double theta, double z) |
|
static AffPoint | fromSpherical (double rho, double theta, double phi) |
|
static double | getCoincidenceTolerance () |
|
static double | maxOffsetInDirection (const AffPoint &ref, const AffVector &dir, const AffPoint buf[], int bufSize, int &index1, int &index2) |
|
static double | ratio (const AffPoint &a, const AffPoint &b, const AffPoint &c) |
|
static void | setCoincidenceTolerance (double tol) |
|
double * cryph::AffPoint::aCoords |
( |
double * |
coords, |
|
|
int |
offset = 0 |
|
) |
| const |
Extract the coordinates of "this" point into an array of double, starting at the given offset. Among other things, this method is useful for interfacing with OpenGL, especially routines like glBufferData. For example, a caller can allocate an array of an appropriate size, then loop over an array of AffPoint instances, invoking the aCoords method as follows:
double* buf = new double[3*NUM_POINTS];
for (int i=0 ; i<NUM_POINTS ; i++)
affPointArray[i].aCoords(buf, 3*i);
glBufferData(GL_ARRAY_BUFFER, 3*NUM_POINTS*sizeof(double), buf, GL_STATIC_DRAW);
delete [] buf;
- Parameters
-
coords | [OUTPUT ONLY] the array into which the (x, y, z) coordinates of "this" point are to be copied. Must be at least (offset+3) positions long. |
offset | [INPUT ONLY] the starting location in coords where the coordinates are to be placed (defaults to 0) |
- Returns
- the given coords array pointer so that the method call can be used as a parameter to an OpenGL function expecting an array of double
- See also
- pCoords
double * cryph::AffPoint::aCoords |
( |
double |
coords[][3], |
|
|
int |
offset = 0 |
|
) |
| const |
Extract the coordinates of "this" point into an array of "dvec3" (a built-in GLSL data type essentially equivalent to "typedef double
dvec[3];"), starting at the given offset. Among other things, this method is useful for interfacing with OpenGL, especially routines like glBufferData. For example, a caller can allocate an array of an appropriate size, then loop over an array of AffPoint instances, invoking the aCoords method as follows:
dvec3* buf = new dvec3[NUM_POINTS]; // assuming the "typedef" above
for (int i=0 ; i<NUM_POINTS ; i++)
affPointArray[i].aCoords(buf, i);
glBufferData(GL_ARRAY_BUFFER, NUM_POINTS*sizeof(dvec3), buf, GL_STATIC_DRAW);
delete [] buf;
- Parameters
-
coords | [OUTPUT ONLY] the array into which the (x, y, z) coordinates of "this" point are to be copied. Must be at least (offset+1) positions long. |
offset | [INPUT ONLY] the starting location in coords where the coordinates are to be placed (defaults to 0) |
- Returns
- the given coords array pointer so that the method call can be used as a parameter to an OpenGL function expecting an array of double
- See also
- pCoords
float * cryph::AffPoint::aCoords |
( |
float * |
coords, |
|
|
int |
offset = 0 |
|
) |
| const |
Extract the coordinates of "this" point into an array of float, starting at the given offset. Among other things, this method is useful for interfacing with OpenGL, especially routines like glBufferData. For example, a caller can allocate an array of an appropriate size, then loop over an array of AffPoint instances, invoking the aCoords method as follows:
float* buf = new float[3*NUM_POINTS];
for (int i=0 ; i<NUM_POINTS ; i++)
affPointArray[i].aCoords(buf, 3*i);
glBufferData(GL_ARRAY_BUFFER, 3*NUM_POINTS*sizeof(float), buf, GL_STATIC_DRAW);
delete [] buf;
- Parameters
-
coords | [OUTPUT ONLY] the array into which the (x, y, z) coordinates of "this" point are to be copied. Must be at least (offset+3) positions long. |
offset | [INPUT ONLY] the starting location in coords where the coordinates are to be placed (defaults to 0) |
- Returns
- the given coords array pointer so that the method call can be used as a parameter to an OpenGL function expecting an array of float
- See also
- pCoords
float * cryph::AffPoint::aCoords |
( |
float |
coords[][3], |
|
|
int |
offset = 0 |
|
) |
| const |
Extract the coordinates of "this" point into an array of "vec3" (a built-in GLSL data type essentially equivalent to "typedef float vec[3];"), starting at the given offset. Among other things, this method is useful for interfacing with OpenGL, especially routines like glBufferData. For example, a caller can allocate an array of an appropriate size, then loop over an array of AffPoint instances, invoking the aCoords method as follows:
vec3* buf = new vec3[NUM_POINTS]; // assuming the "typedef" above
for (int i=0 ; i<NUM_POINTS ; i++)
affPointArray[i].aCoords(buf, i);
glBufferData(GL_ARRAY_BUFFER, NUM_POINTS*sizeof(vec3), buf, GL_STATIC_DRAW);
delete [] buf;
- Parameters
-
coords | [OUTPUT ONLY] the array into which the (x, y, z) coordinates of "this" point are to be copied. Must be at least (offset+1) positions long. |
offset | [INPUT ONLY] the starting location in coords where the coordinates are to be placed (defaults to 0) |
- Returns
- the given coords array pointer so that the method call can be used as a parameter to an OpenGL function expecting an array of float
- See also
- pCoords
void cryph::AffPoint::barycentricCoords |
( |
const AffPoint & |
P1, |
|
|
const AffPoint & |
P2, |
|
|
const AffPoint & |
P3, |
|
|
double & |
b1, |
|
|
double & |
b2, |
|
|
double & |
b3 |
|
) |
| const |
Compute the Barycentric coordinates (b1, b2, b3) of "this" point with respect to the three given reference points, P1, P2, and P3. We assume "this" point lies in the plane determined by the points P1, P2, and P3. On return, b1, b2, and b3 will have been computed such that: (i) b1 + b2 + b3 = 1, (ii) "this" point = b1*P1 + b2*P2 + b3*P3, and (iii) none of "this" point, P1, P2, or P3 will have been changed. Furthermore, if "this" point lies in the triangle P1-P2-P3, then b1>=0, b2>=0, and b3>=0.
- Parameters
-
P1 | [INPUT ONLY] the first reference point |
P2 | [INPUT ONLY] the second reference point |
P3 | [INPUT ONLY] the third reference point |
b1 | [OUTPUT ONLY] b1 the returned Barycentric coordinate (associated with P1) |
b2 | [OUTPUT ONLY] b2 the returned Barycentric coordinate (associated with P2) |
b3 | [OUTPUT ONLY] b3 the returned Barycentric coordinate (associated with P3) |
- See also
- fromBarycentricCoords
void cryph::AffPoint::barycentricCoords |
( |
const AffPoint & |
P1, |
|
|
const AffPoint & |
P2, |
|
|
double & |
b1, |
|
|
double & |
b2 |
|
) |
| const |
Compute the Barycentric coordinates (b1, b2) of "this" point with respect to the two given reference points, P1 and P2. We assume "this" point lies on the line determined by the points P1 and P2. On return, b1 and b2 will have been computed such that: (i) b1 + b2 = 1, (ii) "this" point = b1*P1 + b2*P2, and (iii) none of "this" point, P1, or P2 will have been changed. Furthermore, if ("this" point lies between P1 and P2 on the line, then b1>=0 and b2>=0.
- Parameters
-
P1 | [INPUT ONLY] the first reference point |
P2 | [INPUT ONLY] the second reference point |
b1 | [OUTPUT ONLY] the returned Barycentric coordinate (associated with P1) |
b2 | [OUTPUT ONLY] the returned Barycentric coordinate (associated with P2) |
- See also
- fromBarycentricCoords
double * cryph::AffPoint::pCoords |
( |
double * |
coords, |
|
|
double |
w, |
|
|
int |
offset = 0 |
|
) |
| const |
Extract the coordinates of "this" point into an array of double, starting at the given offset. While doing so, embed each point in projective space using the given w coordinate. Among other things, this method is useful for interfacing with OpenGL, especially routines like glBufferData. For example, a caller can allocate an array of an appropriate size, then loop over an array of AffPoint instances, invoking the pCoords method as follows:
double* buf = new double[4*NUM_POINTS];
for (int i=0 ; i<NUM_POINTS ; i++)
affPointArray[i].pCoords(buf, 4*i);
glBufferData(GL_ARRAY_BUFFER, 4*NUM_POINTS*sizeof(double), buf, GL_STATIC_DRAW);
delete [] buf;
- Parameters
-
coords | [OUTPUT ONLY] the array into which the (x, y, z, w) projective space coordinates of "this" point are to be copied. Must be at least (offset+4) positions long. |
offset | [INPUT ONLY] the starting location in coords where the coordinates are to be placed (defaults to 0) |
- Returns
- the given coords array pointer so that the method call can be used as a parameter to an OpenGL function expecting an array of double
- See also
- aCoords
float * cryph::AffPoint::pCoords |
( |
float * |
coords, |
|
|
float |
w, |
|
|
int |
offset = 0 |
|
) |
| const |
Extract the coordinates of "this" point into an array of float, starting at the given offset. While doing so, embed each point in projective space using the given w coordinate. Among other things, this method is useful for interfacing with OpenGL, especially routines like glBufferData. For example, a caller can allocate an array of an appropriate size, then loop over an array of AffPoint instances, invoking the pCoords method as follows:
float* buf = new float[4*NUM_POINTS];
for (int i=0 ; i<NUM_POINTS ; i++)
affPointArray[i].pCoords(buf, 4*i);
glBufferData(GL_ARRAY_BUFFER, 4*NUM_POINTS*sizeof(float), buf, GL_STATIC_DRAW);
delete [] buf;
- Parameters
-
coords | [OUTPUT ONLY] the array into which the (x, y, z, w) projective space coordinates of "this" point are to be copied. Must be at least (offset+4) positions long. |
offset | [INPUT ONLY] the starting location in coords where the coordinates are to be placed (defaults to 0) |
- Returns
- the given coords array pointer so that the method call can be used as a parameter to an OpenGL function expecting an array of float
- See also
- aCoords
void cryph::AffPoint::swizzle |
( |
char |
xyz[3] | ) |
|
A method inspired by OpenGL's GLSL's swizzle operation. If the i-th character of xyz is 'X', then the x coordinate of "this" point is placed into the i-th coordinate of "this" point. If instead it is 'x', then negative of the x coordinate of "this" point is placed into the i-th coordinate of "this" point. Characters 'y', 'Y', 'z', 'Z' behave similarly. Any other character is simply ignored. Some examples:
cryph::AffPoint ap(1.0, 2.0, 3.0);
ap.swizzle("Zxy"); // ap is now (3.0, -1.0, -2.0)
ap.swizzle("dzy"); // ap is now (3.0, 2.0, 1.0)
ap.swizzle("xxY"); // ap is now (3.0, 3.0, 2.0)
- Parameters
-
xyz | [INPUT ONLY] an array of char of length 3 interpreted as explained and illustrated above |