I am trying to find an algorithm as mentioned in the subject. It is as follows: int orientation(glm::i16vec2 &p1,                 glm::i16vec2 &p2,                 glm::i16vec2 &p3) {   return (((p3.x - p1.x) * (p2.y - p1.y)) - ((p2.x - p1.x) * (p3.y - p1.y))); } bool onSegment(const glm::i16vec2 &pi,                const glm::i16vec2 &pj,                const glm::i16vec2 &pk) {   if((std::min(pi.x,pj.x) <= pk.x && pk.x <= std::max(pi.x,pj.x)) &&      (std::min(pi.y,pj.y) <= pk.y && pk.y <= std::max(pi.y,pj.y)))    return true;   else    return false; } int main() {   glm::i16vec2 hs(5,2);  // p1   glm::i16vec2 he(5,3); // p2   glm::i16vec2 cs(5,1);   // p3   glm::i16vec2 ce(5,3); // p4   int d1 = orientation(cs,ce,hs);   int d2 = orientation(cs,ce,he);   int d3 = orientation(hs,he,cs);   int d4 = orientation(hs,he,ce);   if((d1 == 0 && d2 == 0 && d3 == 0 && d4 == 0) &&        (onSegment(cs,ce,hs) && onSegment(cs,ce,he)))   {    std::cout << HPs is entirely inside CPs << std::endl;   }   return 0; }So far it working fine. Is there any leak within procedure when it may not work as intended in some situations ? Would like  to know about those scenarios ...Thanks 
Check if one line segments is entirely on the other line segment
untagged