olilarkin
07-25-2010, 03:01 AM
i modified iplug to give me access to the LICE filled polygon method, but I'm not sure how to make it work properly, and it ends up just drawing a triangle. I'm trying to draw a kind of gaussian shape:
#define NUMSTEPS 64
class ESVis: public IControl
{
public:
ESVis(IPlugBase *pPlug, IRECT* pR)
: IControl(pPlug, pR)
{
CalcTable();
}
bool Draw(IGraphics* pGraphics)
{
pGraphics->FillIConvexPolygon(&COLOR_RED, mXPoints, mYPoints, NUMSTEPS, 1.);
for(int i=0;i<NUMSTEPS-1;i++)
{
pGraphics->DrawLine(&COLOR_BLACK, (float) mXPoints[i], (float) mYPoints[i], (float) mXPoints[i+1], (float) mYPoints[i+1],0, true);
}
return true;
}
void CalcTable()
{
for(int i=0;i<NUMSTEPS;i++)
{
double gauss = exp(-4.8283*(1.-cos(6.2831853*((double)i-31.5)/(NUMSTEPS-1.))));
double bell = 0.5 + 5. * cos(6.2831853*(((double) i-31.5)/(NUMSTEPS-1.))) / 10.;
double yval = gauss;//(bell * envmix) + (gauss * (1-envmix));
mXPoints[i] = (i*4);
mYPoints[i] = 100. - (yval * 100.);
printf("x %i, y %i\n",mXPoints[i] ,mYPoints[i]);
}
}
bool IsDirty() { return true;}
private:
IColor mBgColor;
int mXPoints[NUMSTEPS];
int mYPoints[NUMSTEPS];
};
anyone used it before?
#define NUMSTEPS 64
class ESVis: public IControl
{
public:
ESVis(IPlugBase *pPlug, IRECT* pR)
: IControl(pPlug, pR)
{
CalcTable();
}
bool Draw(IGraphics* pGraphics)
{
pGraphics->FillIConvexPolygon(&COLOR_RED, mXPoints, mYPoints, NUMSTEPS, 1.);
for(int i=0;i<NUMSTEPS-1;i++)
{
pGraphics->DrawLine(&COLOR_BLACK, (float) mXPoints[i], (float) mYPoints[i], (float) mXPoints[i+1], (float) mYPoints[i+1],0, true);
}
return true;
}
void CalcTable()
{
for(int i=0;i<NUMSTEPS;i++)
{
double gauss = exp(-4.8283*(1.-cos(6.2831853*((double)i-31.5)/(NUMSTEPS-1.))));
double bell = 0.5 + 5. * cos(6.2831853*(((double) i-31.5)/(NUMSTEPS-1.))) / 10.;
double yval = gauss;//(bell * envmix) + (gauss * (1-envmix));
mXPoints[i] = (i*4);
mYPoints[i] = 100. - (yval * 100.);
printf("x %i, y %i\n",mXPoints[i] ,mYPoints[i]);
}
}
bool IsDirty() { return true;}
private:
IColor mBgColor;
int mXPoints[NUMSTEPS];
int mYPoints[NUMSTEPS];
};
anyone used it before?