- Main Page
- Modules
- Classes
- Files
- Related Pages

- File List
- File Members

# src/vectorMath/VectorMath.h

Go to the documentation of this file.

    00001 #ifndef VECTORMATH_H_
    00002 #define VECTORMATH_H_
    00003
    00004 #include "../config.h"
    00005 #include <math.h>
    00006 #include "mathex.h"
    00007 #include "vmath.h"
    00008 #include "../typedefs.h"
    00009
    00011 int randomIntInRange(int lowest, int highest);
    00012
    00014 inline Vector3r midPoint(const Vector3r &a, const Vector3r &b) {
    00015     return Vector3r((a.x+b.x)/2, (a.y+b.y)/2, (a.z+b.z)/2);
    00016 };
    00017
    00019 inline Vector3r midPoint(const dReal* a, const dReal* b) {
    00020     return Vector3r((a[0]+b[0])/2, (a[1]+b[1])/2, (a[2]+b[2])/2);
    00021 };
    00022
    00024 inline Vector3r midPoint(const Line &l) {
    00025     return Vector3r((l._a.x+l._b.x)/2, (l._a.y+l._b.y)/2, (l._a.z+l._b.z)/2);
    00026 };
    00027
    00029 enum IntersectResult {PARALLEL, COINCIDENT, NOT_INTERESECTING, INTERESECTING};
    00030
    00037 IntersectResult intersect(const Line &l1, const Line &l2, Vector3r &intersection);
    00038
    00045 IntersectResult intersect(const Vector3r &l1a, const Vector3r &l1b, const Vector3r &l2a, const Vector3r &l2b, Vector3r &intersection);
    00046
    00054 unsigned IntersectPolygon(const Polygon &p, const Line &l, Vector3r* intersections, unsigned* intersected);
    00055
    00063 unsigned IntersectPolygon(const Polygon* p, const Line &l, Vector3r* intersections, unsigned* intersected);
    00064
    00072 unsigned IntersectPolygon(const Polygon &p, const Vector3r &la, const Vector3r &lb, Vector3r* intersections, unsigned* intersected);
    00073
    00081 unsigned IntersectPolygon(const Polygon* p, const Vector3r &la, const Vector3r &lb, Vector3r* intersections, unsigned* intersected);
    00082
    00088 dReal orientedDistFromLine(const Line &l, const Vector3r p);
    00089
    00091 bool pointInPolygon(const Polygon &polygon, const Vector3r &point);
    00092
    00093 #endif /*VECTORMATH_H_*/