44__host__ __device__
int Orientation(float2
const &p, float2
const &q,
46 float2 qp{q.x - p.x, q.y - p.y};
47 float2 rp{r.x - p.x, r.y - p.y};
48 float cross_prod1 = qp.x * rp.y;
49 float cross_prod2 = qp.y * rp.x;
50 if (cross_prod1 > cross_prod2)
return 1;
51 if (cross_prod1 < cross_prod2)
return -1;
63 for (
int ct = 0; ct < sz; ++ct) {
69 float yctp1 = y[ctp1];
73 if (r.y < yct or r.y > yctp1) {
76 p = float2{x[ct], yct};
77 q = float2{x[ctp1], yctp1};
79 if (r.y < yctp1 or r.y > yct) {
82 q = float2{x[ct], yct};
83 p = float2{x[ctp1], yctp1};
87 if (orientation == 0) {
90 if (orientation == 1) {
93 if (orientation == -1) {