Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: C++
Posted by: Ivan Belonogov
Added: Feb 16, 2018 8:46 AM
Modified: Apr 14, 2018 2:05 AM
Views: 13
Tags: no tags
  1. struct Line {
  2.     pt O, v;
  3.     Line() {}
  4.     Line(pt A, pt B): O(A), v((B - A).norm()) {}
  5.     pt operator * (Line l) {
  6.         pt u = l.v.rotate();
  7.         dbl t = (l.O - O) % u / (v % u);
  8.         return O + v * t;
  9.     }
  10. };
  11.