worked on 3D walls

This commit is contained in:
k-a-z-u
2018-07-24 18:08:08 +02:00
parent 3d79fd5af0
commit f7e4323d58
11 changed files with 261 additions and 49 deletions

View File

@@ -232,7 +232,7 @@ public:
};
static inline bool intersects(const Line2& l1, const Line2& l2, bool limit, Point2& pos) {
static inline bool intersects(const Line2& l1, const Line2& l2, bool limit, Point2& pos, float* _u = nullptr) {
// (sx1,sy1) + (dx1, dy1)*u = (sx2, sy2) + (dx2, dy2)*v
// solve((c+d*v-a)/b = (g+h*v-e)/f, v)
@@ -269,6 +269,7 @@ static inline bool intersects(const Line2& l1, const Line2& l2, bool limit, Poin
if (!limit || (u >= 0 && v >= 0 && u <= 1 && v <= 1)) {
pos = Point2(x,y);
if (_u) {*_u = u;}
return true;
}
@@ -277,4 +278,6 @@ static inline bool intersects(const Line2& l1, const Line2& l2, bool limit, Poin
}
#endif // LINE2D_H