TexGen
Classes | Namespaces | Macros | Functions
mymath.h File Reference
#include <cmath>
#include <assert.h>
#include <stdlib.h>
#include <memory.h>
#include <ostream>
#include <istream>
#include <algorithm>
Include dependency graph for mymath.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TexGen::WXYZ
 Struct for representing a quaternion. More...
 
struct  TexGen::XYZ
 Struct for representing points in 3D space. More...
 
struct  TexGen::XY
 Struct for representing points in 2D space. More...
 

Namespaces

namespace  TexGen
 Namespace containing a series of customised math operations not found in the standard c++ library.
 

Macros

#define PI   3.1415926535897932384626433832795
 

Functions

XY TexGen::Convert (const XYZ &Val)
 
bool TexGen::operator== (const XYZ &left, const XYZ &right)
 
bool TexGen::operator== (const XYZ &left, const double &value)
 
bool TexGen::operator== (const XYZ &left, const int &value)
 
WXYZ TexGen::operator+ (const WXYZ &left, const WXYZ &right)
 
XYZ TexGen::operator+ (const XYZ &left, const XYZ &right)
 
XY TexGen::operator+ (const XY &left, const XY &right)
 
WXYZ & TexGen::operator+= (WXYZ &left, const WXYZ &right)
 
XYZ & TexGen::operator+= (XYZ &left, const XYZ &right)
 
XY & TexGen::operator+= (XY &left, const XY &right)
 
WXYZ TexGen::operator- (const WXYZ &left, const WXYZ &right)
 
XYZ TexGen::operator- (const XYZ &left, const XYZ &right)
 
XY TexGen::operator- (const XY &left, const XY &right)
 
WXYZ & TexGen::operator-= (WXYZ &left, const WXYZ &right)
 
XYZ & TexGen::operator-= (XYZ &left, const XYZ &right)
 
XY & TexGen::operator-= (XY &left, const XY &right)
 
WXYZ TexGen::operator* (const WXYZ &left, const WXYZ &right)
 Grassmann product multiplication between two quaternions. More...
 
XYZ TexGen::operator* (const XYZ &left, const XYZ &right)
 
XY TexGen::operator* (const XY &left, const XY &right)
 
XYZ TexGen::operator/ (const XYZ &left, const XYZ &right)
 Do a simple divide of all members, perhaps not mathematically correct but usefull. More...
 
WXYZ & TexGen::operator*= (WXYZ &left, const WXYZ &right)
 Grassmann product multiplication between two quaternions. More...
 
XYZ & TexGen::operator*= (XYZ &left, const XYZ &right)
 
XY & TexGen::operator*= (XY &left, const XY &right)
 
XYZ TexGen::operator* (const XYZ &left, const double &right)
 
XYZ TexGen::operator* (const XYZ &left, const float &right)
 
XYZ TexGen::operator* (const XYZ &left, const int &right)
 
XY TexGen::operator* (const XY &left, const double &right)
 
XYZ TexGen::operator* (const double &left, const XYZ &right)
 
XYZ TexGen::operator* (const float &left, const XYZ &right)
 
XYZ TexGen::operator* (const int &left, const XYZ &right)
 
XY TexGen::operator* (const double &left, const XY &right)
 
XYZ TexGen::operator/ (const XYZ &left, const double &right)
 
XY TexGen::operator/ (const XY &left, const double &right)
 
WXYZ & TexGen::operator/= (WXYZ &left, const double &right)
 
XYZ & TexGen::operator/= (XYZ &left, const double &right)
 
XY & TexGen::operator/= (XY &left, const double &right)
 
XYZ & TexGen::operator*= (XYZ &left, const double &right)
 
XY & TexGen::operator*= (XY &left, const double &right)
 
XYZ TexGen::operator/ (const XYZ &left, const int &right)
 
std::ostream & TexGen::operator<< (std::ostream &output, const WXYZ &Quat)
 
std::ostream & TexGen::operator<< (std::ostream &output, const XYZ &Vector)
 
std::ostream & TexGen::operator<< (std::ostream &output, const XY &Vector)
 
std::istream & TexGen::operator>> (std::istream &input, WXYZ &Quat)
 
std::istream & TexGen::operator>> (std::istream &input, XYZ &Vector)
 
std::istream & TexGen::operator>> (std::istream &input, XY &Vector)
 
double TexGen::DotProduct (const XYZ &left, const XYZ &right)
 Get the dot product of two vectors. More...
 
double TexGen::DotProduct (const XY &left, const XY &right)
 Get the dot product of two vectors. More...
 
XYZ TexGen::CrossProduct (const XYZ &left, const XYZ &right)
 Get the cross product of two vectors. More...
 
double TexGen::RandomNumber (double dMin, double dMax)
 Generate a random number between the limits given. More...
 
double TexGen::GetLength (const XYZ &Point1, const XYZ &Point2)
 Get the length between two points. More...
 
double TexGen::GetLengthSquared (const XYZ &Point1, const XYZ &Point2)
 Get the length squared between two points. More...
 
double TexGen::GetLength (const XY &Point1, const XY &Point2)
 Get the length between two points. More...
 
double TexGen::GetLengthSquared (const XY &Point1, const XY &Point2)
 Get the length squared between two points. More...
 
double TexGen::GetLength (const WXYZ &Quaternion)
 Get the length of a quaternion. More...
 
double TexGen::GetLength (const XYZ &Vector)
 Get the length of a vector. More...
 
double TexGen::GetLength (const XY &Vector)
 Get the length of a vector. More...
 
double TexGen::GetLengthSquared (const XYZ &Point)
 Get the length squared of a vector. More...
 
double TexGen::GetLengthSquared (const XY &Point)
 Get the length squared of a vector. More...
 
WXYZ & TexGen::Normalise (WXYZ &Quaternion)
 Normalise the quaternion and return it. More...
 
XYZ & TexGen::Normalise (XYZ &Vector)
 Normalise the vector and return it. More...
 
XY & TexGen::Normalise (XY &Vector)
 Normalise the vector and return it. More...
 
double TexGen::Max (XYZ &Vector)
 Get maximum element of vector and return it. More...
 
XYZ TexGen::operator* (const WXYZ &left, const XYZ &right)
 Rotate a vector by given Quaternion. More...
 
bool TexGen::SphereSphereIntersect (const XYZ &p1, const XYZ &p2, double dRadii)
 Check if two spheres intersect given their center points and combined radii. More...
 
XYZ TexGen::ShortestDistPointLine (const XYZ &Point, const XYZ &LineStart, const XYZ &LineEnd, double &dU)
 
bool TexGen::SphereCylinderIntersect (const XYZ &Point, const XYZ &LineStart, const XYZ &LineEnd, double dRadii, double *pdUReturn=NULL)
 
bool TexGen::LineLineIntersect2D (const XY &p1, const XY &p2, const XY &p3, const XY &p4, double &dU1, double &dU2)
 
bool TexGen::ShortestDistLineLine (const XYZ &p1, const XYZ &p2, const XYZ &p3, const XYZ &p4, double &dU1, double &dU2, XYZ &pa, XYZ &pb)
 
bool TexGen::RoundedCylinderIntersect (const XYZ &p1, const XYZ &p2, const XYZ &p3, const XYZ &p4, double dRadii, double *pdU1=NULL, double *pdU2=NULL)
 
bool TexGen::BoundingBoxIntersect (const XYZ &BBox1Min, const XYZ &BBox1Max, const XYZ &BBox2Min, const XYZ &BBox2Max, double dTolerance=0)
 Find if two AABBs intersect with given tolerance. More...
 
bool TexGen::PointInsideBox (const XYZ &Point, const XYZ &BoxMin, const XYZ &BoxMax, double dTolerance=0)
 Find if a point is inside an Axis Aligned Bounding Box with given tolerance. More...
 
void TexGen::GetLocalCoordinateSystem (XYZ &LocalX, XYZ &LocalY, XYZ &LocalZ, const XYZ &Point1, const XYZ &Point2)
 
bool TexGen::GetIntersectionLinePlane (const XYZ &p1, const XYZ &p2, const XYZ &p3, const XYZ &N, XYZ &Intersection, double *pdU=NULL)
 P1 and P2 are two points on the line, P3 is a point on the plane, N is the plane normal, Intersection is the returned intersection. More...
 
void TexGen::GetRandomColor (double &r, double &g, double &b)
 Create a random color from a set of pre-defined colors. More...
 
void TexGen::GetFractionColor (double dFraction, double &r, double &g, double &b)
 
bool TexGen::GetCircleCenter (const XYZ &A, const XYZ &B, const XYZ &C, XYZ &Center)
 
XYZ TexGen::Max (const XYZ &P1, const XYZ &P2)
 Given two points, return a new point who's coordinates are the greater of the two. More...
 
XYZ TexGen::Min (const XYZ &P1, const XYZ &P2)
 Given two points, return a new point who's coordinates are the smaller of the two. More...
 
XY TexGen::Max (const XY &P1, const XY &P2)
 Given two points, return a new point who's coordinates are the greater of the two. More...
 
XY TexGen::Min (const XY &P1, const XY &P2)
 Given two points, return a new point who's coordinates are the smaller of the two. More...
 
int TexGen::Round (double dValue)
 
template<typename T >
TexGen::CalculateBezierPoint (T p1, T p2, T p3, T p4, double mu)
 
template<typename T >
TexGen::CalculateBezierTangent (T p1, T p2, T p3, T p4, double mu)
 
double TexGen::RandomNormalDistribution (double dStandrdDeviation=1, double dAverage=0)
 
double TexGen::GetArea (XYZ Points[], int iNumPoints)
 
bool TexGen::PointInsideTriangle (const XYZ &P1, const XYZ &P2, const XYZ &P3, const XYZ &P)
 P1, P2, P3 are the three triangle corners, P is the points to be tested. More...
 
bool TexGen::PointInsideTriangle (const XYZ &P1, const XYZ &P2, const XYZ &P3, const XYZ &P, const XYZ &N)
 P1, P2, P3 are the three triangle corners, P is the points to be tested, N is the normal to the triangle. More...
 
double TexGen::PointInsideTriangleAccuracy (const XYZ &P1, const XYZ &P2, const XYZ &P3, const XYZ &P, const XYZ &N)
 P1, P2, P3 are the three triangle corners, P is the points to be tested, N is the normal to the triangle. More...
 
bool TexGen::PointInsideTriangle2D (const XYZ &P1, const XYZ &P2, const XYZ &P3, const XYZ &P, const XYZ *pNormal=NULL)
 P1, P2, P3 are the three triangle corners, P is the points to be tested, ignoring the z component. More...
 
double TexGen::ShortestDistPointTriangle (const XYZ &P1, const XYZ &P2, const XYZ &P3, const XYZ &P, XYZ *pTrianglePoint=NULL, XYZ *pNormal=NULL)
 P1, P2, P3 are the three triangle corners, P is the points to be tested. More...
 
XYZ TexGen::GetBarycentricCoordinates (const XY &P1, const XY &P2, const XY &P3, const XY &P)
 Get the barycentric coordinates of a point lying on a triangle. More...
 
int TexGen::GetClosestPointIndex (const std::vector< XY > &Points, const XY Position)
 
int TexGen::GetClosestPointWithinTol (const std::vector< XY > &Points, const XY Position, double dTol)
 
XY TexGen::GetClosestPoint (const std::vector< XY > &Points, const XY Position)
 
int TexGen::GetClosestPointIndex (const std::vector< XYZ > &Points, const XYZ Position)
 
int TexGen::GetClosestPointWithinTol (const std::vector< XYZ > &Points, const XYZ Position, double dTol)
 
XYZ TexGen::GetClosestPoint (const std::vector< XYZ > &Points, const XYZ Position)
 
bool TexGen::PointInside (const XY &Point, const std::vector< XY > &Nodes)
 
bool TexGen::PointInside (const XY &Point, std::vector< XYZ > &Nodes)
 

Macro Definition Documentation

◆ PI

#define PI   3.1415926535897932384626433832795

Definition at line 30 of file mymath.h.