Wednesday, April 13, 2011

doodler formulas

Here are some of the formulas I use to calculate where to draw.

doodler formulas

I need to figure out where the pen is.
I keep track of how long each string is with each step it takes.
I also know the distance between the cuphooks the strings go over.
That defines a triangle.
There is a neat formula for calculating the area of a triangle.
Add up all three sides, that is the perimeter. Half of that is the semi-perimeter.
Find the difference between each side and the semi-perimeter.
Multiply those three differences times each other and times the semi-perimeter.
Take the square root of that and you have the area.
Once you have the area you can figure out the height of the triangle, (area*2)/base=height.

WBPLEFT is the length of the left string.
WBPRIGHT is the length of the right string.
WBPBASE is the distance between the cuphooks.
WBPS is the semi-perimeter.
WBPS = (WBPLEFT + WBPRIGHT + WBPBASE) / 2
WBPAREA = SQR(WBPS * (WBPS - WBPLEFT) * (WBPS - WBPRIGHT) * (WBPS - WBPBASE))
WBPHEIGHT is the distance down from the cuphooks to the pen.
WBPHEIGHT = (WBPAREA * 2) / WBPBASE
WBPWIDTH is the distance from the left hook to the pen.
WBPWIDTH = SQR((WBPLEFT * WBPLEFT) - (WBPHEIGHT * WBPHEIGHT))
The center of my board is 0,0 so this calculates X and Y for where the pen is.
Units is inches.
WBPXNOW = WBPWIDTH - WBPCENTERWIDTH
WBPYNOW = WBPCENTERHEIGHT - WBPHEIGHT
WBPCENTERWIDTH is the distance from the left hook to the center of the board.
WBPHEIGHT is the distance from the hooks down to the center of the board.

No comments:

Post a Comment