| 38 | } |
| 39 | |
| 40 | bool IsSegmentInCone(PointD const & v, PointD const & v1, PointD const & vPrev, PointD const & vNext) |
| 41 | { |
| 42 | double const cpLR = OrientedS(vPrev, vNext, v); |
| 43 | |
| 44 | if (cpLR == 0.0) |
| 45 | { |
| 46 | // Points vPrev, v, vNext placed on one line; |
| 47 | // use property that polygon has CCW orientation. |
| 48 | return OrientedS(vPrev, vNext, v1) > 0.0; |
| 49 | } |
| 50 | |
| 51 | if (cpLR < 0.0) |
| 52 | { |
| 53 | // vertex is concave |
| 54 | return OrientedS(v, vPrev, v1) < 0.0 && OrientedS(v, vNext, v1) > 0.0; |
| 55 | } |
| 56 | // vertex is convex |
| 57 | return OrientedS(v, vPrev, v1) < 0.0 || OrientedS(v, vNext, v1) > 0.0; |
| 58 | } |
| 59 | } // namespace m2::robust |