17 #ifndef __UT_PolySample__
18 #define __UT_PolySample__
34 inline void init(
float x0[2],
float x1[2],
float x2[2])
36 u0 = x1[0] - x0[0];
v0 = x1[1] - x0[1];
37 u1 = x2[0] - x0[0];
v1 = x2[1] - x0[1];
38 Nxi = 1.0F/(u0*
v1 -
u1*
v0);
43 u0 = x1 - x0;
v0 = y1 - y0;
44 u1 = x2 - x0;
v1 = y2 - y0;
45 Nxi = 1.0F / (u0*
v1 -
u1*
v0);
51 u1 = x2[0] - x0[0];
v1 = x2[1] - x0[1];
59 if (tu >= -tol && tu <= 1+tol) {
61 if (tv >= -tol && tu+tv <= 1+tol) {
80 myTri.setVertices(x0, y0, x1, y1, x2, y2);
81 dx = myTri.v1; dy = -myTri.u1;
83 myBackface = dx*x1 + dy*y1 + z > 0;
87 if (myTri.sample(x, y, myX[0], myX[1], u, v, tol))
108 myXY[0][0] = x0; myXY[0][1] = y0;
109 myXY[1][0] = x1; myXY[1][1] =
y1;
110 myXY[2][0] =
x2; myXY[2][1] =
y2;
111 myXY[3][0] = x3; myXY[3][1] = y3;
119 return (this->*mySampler)(
x,
y, u,
v);
127 int sampleTrap1(
double x,
double y,
float &u,
float &
v);
128 int sampleTrap2(
double x,
double y,
float &u,
float &
v);
131 int sampleQuad(
double x,
double y,
float &u,
float &
v);
133 int sampleConcave(
double x,
double y,
float &u,
float &
v);
135 int sampleBowtie(
double x,
double y,
float &u,
float &
v);
136 int sampleGeneral(
double x,
double y,
float &u,
float &
v);
171 float myAx, myAy, myBx, myBy, myCx, myCy, myDx, myDy;
172 float myK, myIK, myL, myM;
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
int sample(fpreal sx, fpreal sy, fpreal x0, fpreal y0, float &u, float &v, fpreal tol=0.0)
void initD0(float x0[2], float x2[2], fpreal dx, fpreal dy)
int sample(double x, double y, float &u, float &v)
void setVertices(fpreal x0, fpreal y0, fpreal x1, fpreal y1, fpreal x2, fpreal y2)
GLdouble GLdouble GLdouble z
int setVertices(fpreal x0, fpreal y0, fpreal x1, fpreal y1, fpreal x2, fpreal y2, fpreal x3, fpreal y3)
void init(float x0[2], float x1[2], float x2[2])
int(UT_SampleQuad2D::* UT_QuadSampleFunc)(double x, double y, float &u, float &v)
void setVertices(fpreal x0, fpreal y0, fpreal x1, fpreal y1, fpreal x2, fpreal y2)
GLdouble GLdouble GLdouble y2
int sample(fpreal x, fpreal y, float &u, float &v, fpreal tol=0.0)