-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeometry_utils.h
More file actions
67 lines (55 loc) · 2.1 KB
/
geometry_utils.h
File metadata and controls
67 lines (55 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef GEOMETRY_UTILS_H
#define GEOMETRY_UTILS_H
#include "types.h"
#include <algorithm>
#include <iostream>
#include <cmath>
#ifdef __GNUC__
#define DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED(func) __declspec(deprecated) func
#else
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
#define DEPRECATED(func) func
#endif
using namespace std;
struct ThreePoints;
struct Line;
struct Point;
struct Plane;
struct Sphere;
struct Vector;
struct Triangle;
struct Particle;
struct Object3D;
namespace Geometry {
// geometry utils with random
DEPRECATED(Point getRandomPointFromSphere(Sphere));
Point getRandomPointFromSphere2(Sphere);
Point getRandomPointOnSphere(Sphere);
Vector getRandomOrthogonalVector(Vector);
Point getRandomPointFromTriangle(ThreePoints&);
// geometry utils returning distances and lengths
real getDistanceBetweenPoints(Point,Point);
real getDistanceBetweenPointAndPlane(ThreePoints&,Point);
real getDistanceBetweenPointAndSphere(Sphere&,Point);
real getChordLength(Sphere,Line);
// geometry utils for intersections and projections calculation
Point getPointOnPlaneProjection(ThreePoints&,Point);
Point getPointOnLineProjection(Line,Point);
DEPRECATED(Point getPlaneAndLineIntersection(ThreePoints&,Line));
Point getPlaneAndLineIntersection2(ThreePoints&,Line);
//Point getNearestObject3DAndParticleTrajectoryIntersection(Object3D&,Particle);
int getIndexOfPolygonThatParicleIntersects(Object3D&, Particle&);
// geometry utils for conditions checking
DEPRECATED(bool isPointInsideTriangle(ThreePoints&,Point));
bool isPointInsideTriangle2(ThreePoints&,Point);
bool doesLineIntersectTriangle(ThreePoints&,Line);
bool isPointInsideParallelepiped(Point,Point,Point);
bool doesParticlesTrajectoryIntersectObject(Particle&,Object3D&);
bool doesLineIntersectParallelepiped(Line,Point,Point);
bool doesLineIntersectSphere(Line,Sphere);
// other geometry utils
Point rotatePointAroundLine(Point,Line,double);
}
#endif // GEOMETRY_UTILS_H