title: Check if a point is inside a plane segment
body: <p>i would like to know if a point in a plane segment, and its coordinate in [0,1][0,1] relative to segment. e.g 0,0 left bottom corner, 1,1 right top corner, 0.5,0.5 center</p>
  
  <p>these are the thing i already know:</p>
  
  <p>-point is in on the same plane as plane segment.
  -coordinates of 4 points of the plane segment. but they are not clock-wise order or any order i would know.
  -plane's normal and its distance to origin. such as; ax + by + cz +d . x,y,z,d are known. </p>
  
  <p>here is a sketch i did:
  <a href="https://i.stack.imgur.com/s2K8p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s2K8p.png" alt="plane"></a>
  
  A,B,C points are on same plane as plane segment. P1, P2, P3, P4 coordinates is known, but is not ordered in any meaningful way. </p>
  
  <p>thank you.</p>
  
  <p>edit:</p>
  
  <p>one idea i have is</p>
  
  <ul>
  <li><p>sort points</p></li>
  <li><p>create vector between each points</p></li>
  <li><p>create vectors from 2 points</p></li>
  <li><p>dot product them</p></li>
  <li><p>if degree is between 0 and 90, it's inside</p></li>
  </ul>
  
  <p>would this work? i need good real-time performance, isn't dot product is slow on CPU?
  how would i find relative coordinate of point?</p>