| 92 | } |
| 93 | |
| 94 | Float compute_winding_number(const VectorF& p, |
| 95 | const MatrixFr& points, |
| 96 | const MatrixIr& segments) { |
| 97 | const size_t num_segments = segments.rows(); |
| 98 | Float total_angle=0; |
| 99 | for (size_t i=0; i<num_segments; i++) { |
| 100 | Vector2I segment = segments.row(i); |
| 101 | Vector2F v1 = points.row(segment[0]) - p.transpose(); |
| 102 | Vector2F v2 = points.row(segment[1]) - p.transpose(); |
| 103 | Float angle = atan2( |
| 104 | v1.x()*v2.y() - v1.y()*v2.x(), |
| 105 | v1.dot(v2)); |
| 106 | total_angle += angle; |
| 107 | } |
| 108 | |
| 109 | return total_angle / (2 * M_PI); |
| 110 | } |
| 111 | |
| 112 | Float compute_2D_triangle_area( |
| 113 | const VectorF& v0, |
no test coverage detected