worked on floorplan (v2)
worked on grid-generation (v2) new helper methods for geometry new test cases
This commit is contained in:
15
math/Math.h
15
math/Math.h
@@ -2,6 +2,7 @@
|
||||
#define K_MATH_MATH_H
|
||||
|
||||
#include "../Defines.h"
|
||||
#include "../geo/Point3.h"
|
||||
|
||||
class Math {
|
||||
|
||||
@@ -14,6 +15,20 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
/** get the cross-product of u and v */
|
||||
static inline Point3 cross(const Point3 u, const Point3 v) {
|
||||
float x = u.y*v.z - u.z*v.y;
|
||||
float y = u.z*v.x - u.x*v.z;
|
||||
float z = u.x*v.y - u.y*v.x;
|
||||
return Point3(x,y,z);
|
||||
}
|
||||
|
||||
/** get the normal-vector for u and v */
|
||||
static inline Point3 normal(const Point3 u, const Point3 v) {
|
||||
const Point3 p = cross(u,v);
|
||||
return p/p.length();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user