Get Time
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
a shorter line intersection | Reply
I usually use the following code for line intersection (cp stands for cross product, lines are ab and cd):
inline point line_inter(const point &a, const point &b, const point &c, const point &d){
  return a + cp(a - c, d - c)/cp(d - c, b - a) * (b - a);