Chipmunk++
 All Classes Functions Variables Pages
segmentqueryinfo.hpp
1 #pragma once
2 
3 #include "types.hpp"
4 
5 #pragma GCC visibility push(default)
6 namespace cp {
8  struct SegmentQueryInfo {
9  SegmentQueryInfo() : t(0) {}
10  Float t; // The normalized distance along the query segment in the range [0, 1].
11  Vect n; // The normal of the surface hit.
12 
13  inline Vect hitPoint(Vect start, Vect end) {
14  return Vect::lerp(start, end, t);
15  }
16 
17  inline Float hitDist(Vect start, Vect end) {
18  return Vect::dist(start, end)*t;
19  }
20  };
21 }
22 #pragma GCC visibility pop