// the right-side distance from point pt to the line which passes through linePt // and has unit direction vector unitDir. // ie, if the point is on the right of the line, this will be positive. // if the point is on the left of the line, this will be negative. // if the point is on the line, this will be zero. // // the following code is an optimization of: // * rotate the unit direction vector 90 degrees CW // * dot the vector from the line point to the point in question onto the rotated unit vector. // oxeVec2f is just a struct with float x and float y. static inline float oxeVec2f_distanceRight_PointLine( oxeVec2f* linePt, oxeVec2f* unitDir, oxeVec2f* pt) { float vx = pt->x - linePt->x; float vy = pt->y - linePt->y; return unitDir->y * vx - unitDir->x * vy; }