Look forward to seeing it Russell - sounds interesting. I decided against using thread and spools when I was using very small spools (little sewing machine bobbins), but using even slightly larger ones seems to make the precision problems fade pretty quick. Tape seems like a good idea because like you say, the diameter change is pretty negligable. I was thinking of steel tape measures because of the spring-loadedness of them.
The maths is actually dead easy. The routines I use boil down to this to convert a cartesian to a native coordinate:
float getMachineA(float cX, float cY)
{
float a = sqrt(sq(cX)+sq(cY));
return a;
}
float getMachineB(float cX, float cY)
{
float b = sqrt(sq((pageWidth)-cX)+sq(cY));
return b;
}
and this to convert from native back to cartesian:
int getCartesianX(float aPos, float bPos)
{
int calcX = int((pow(pageWidth, 2) - pow(bPos, 2) + pow(aPos, 2)) / (pageWidth*2));
return calcX;
}
int getCartesianY(int cX, float aPos) {
int calcX = cX;
int calcY = int(sqrt(pow(aPos,2)-pow(calcX,2)));
return calcY;
}
cheers!
sandy noble
|