CrystalSpace

Public API Reference

csDMath3 Class Reference
[Geometry utilities]

Various assorted 3D mathematical functions. More...

#include <csgeom/math3d_d.h>

List of all members.

Static Public Member Functions

static void Between (const csDVector3 &v1, const csDVector3 &v2, csDVector3 &v, double pct, double wid)
 Calculates a vector lying a specified distance between two other vectors.
static void CalcNormal (csDVector3 &norm, const csDVector3 &v, const csDVector3 &u)
 Compute the normal given two (u,v) vectors.
static void CalcNormal (csDVector3 &norm, const csDVector3 &v1, const csDVector3 &v2, const csDVector3 &v3)
 Calculate a plane normal given three vectors.
static void CalcPlane (const csDVector3 &v1, const csDVector3 &v2, const csDVector3 &v3, csDVector3 &normal, double &D)
 Calculate the plane equation given three vectors.
static double DoubleArea3 (const csDVector3 &a, const csDVector3 &b, const csDVector3 &c)
 Compute twice the area of triangle composed by three points.
static bool PlanesClose (const csDPlane &p1, const csDPlane &p2)
 Check if two planes are close together.
static bool PlanesEqual (const csDPlane &p1, const csDPlane &p2)
 Check if two planes are almost equal.
static void SetMinMax (const csDVector3 &v, csDVector3 &min, csDVector3 &max)
 Set the min and max vector if this vector exceeds their current limits.
static bool Visible (const csDVector3 &p, const csDPlane &pl)
 Check if the plane is visible from the given point.
static bool Visible (const csDVector3 &p, const csDVector3 &t1, const csDVector3 &t2, const csDVector3 &t3)
 Tests if the front face of a triangle is visible from the given point.
static int WhichSide3D (const csDVector3 &p, const csDVector3 &v1, const csDVector3 &v2)
 Tests which side of a plane the given 3D point is on.

Detailed Description

Various assorted 3D mathematical functions.

This is a static class and contains only static member functions.

Definition at line 436 of file math3d_d.h.


Member Function Documentation

static void csDMath3::Between ( const csDVector3 v1,
const csDVector3 v2,
csDVector3 v,
double  pct,
double  wid 
) [static]

Calculates a vector lying a specified distance between two other vectors.

Given vectors v1 and v2, this function will calculate and return vector v lying between them. If pct != -1, vector v will be the point which is pct % of the way from v1 to v2. Otherwise, if pct equals -1, v will be the point along 'v1-v2' which is distance wid from v1.

static void csDMath3::CalcNormal ( csDVector3 norm,
const csDVector3 v,
const csDVector3 u 
) [inline, static]

Compute the normal given two (u,v) vectors.

This function will calculat the normal to a polygon with two edges represented by v and u. The result is stored in norm.

Definition at line 528 of file math3d_d.h.

static void csDMath3::CalcNormal ( csDVector3 norm,
const csDVector3 v1,
const csDVector3 v2,
const csDVector3 v3 
) [inline, static]

Calculate a plane normal given three vectors.

This function will calculate the normal to the plane formed by vectors v1, v2, and v3, and store the result in norm.

Definition at line 517 of file math3d_d.h.

static void csDMath3::CalcPlane ( const csDVector3 v1,
const csDVector3 v2,
const csDVector3 v3,
csDVector3 normal,
double &  D 
) [inline, static]

Calculate the plane equation given three vectors.

Given three vectors v1, v2, and v3, forming a plane, this function will calculate the plane equation and return the result in 'normal' and 'D'.

Definition at line 538 of file math3d_d.h.

static double csDMath3::DoubleArea3 ( const csDVector3 a,
const csDVector3 b,
const csDVector3 c 
) [inline, static]

Compute twice the area of triangle composed by three points.

This function returns 2 x the area of the triangle formed by the points a, b, and c.

Definition at line 504 of file math3d_d.h.

static bool csDMath3::PlanesClose ( const csDPlane p1,
const csDPlane p2 
) [static]

Check if two planes are close together.

Two planes are close if there are almost equal OR if the normalized versions are almost equal.

static bool csDMath3::PlanesEqual ( const csDPlane p1,
const csDPlane p2 
) [inline, static]

Check if two planes are almost equal.

The function returns true iff each component of the plane equation for one plane is within .001 of the corresponding component of the other plane.

Definition at line 551 of file math3d_d.h.

static void csDMath3::SetMinMax ( const csDVector3 v,
csDVector3 min,
csDVector3 max 
) [inline, static]

Set the min and max vector if this vector exceeds their current limits.

This function will check each component of vector v against the maximum and minimum values specified by min and max. If the limits are exceeded, new min or max values will be set.

Definition at line 491 of file math3d_d.h.

static bool csDMath3::Visible ( const csDVector3 p,
const csDPlane pl 
) [inline, static]

Check if the plane is visible from the given point.

This function does a back-face culling test to see whether the front face of plane pl is visible from point p.

Definition at line 470 of file math3d_d.h.

static bool csDMath3::Visible ( const csDVector3 p,
const csDVector3 t1,
const csDVector3 t2,
const csDVector3 t3 
) [static]

Tests if the front face of a triangle is visible from the given point.

Visibility test (backface culling) to see if the triangle formed by t1, t2, and t3 is visible from point p.

static int csDMath3::WhichSide3D ( const csDVector3 p,
const csDVector3 v1,
const csDVector3 v2 
) [inline, static]

Tests which side of a plane the given 3D point is on.

Return -1 if point p is left of plane '0-v1-v2', 1 if point p is right of plane '0-v1-v2', or 0 if point p lies on plane '0-v1-v2'. Plane '0-v1-v2' is the plane passing through points <0,0,0>, v1, and v2.

Definition at line 446 of file math3d_d.h.


The documentation for this class was generated from the following file:

Generated for Crystal Space 2.1 by doxygen 1.6.1