worked on 3D walls
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user