testing protocol
by ursulawolz
I need three reciprocal functions for my quilt stitch project, relating the chord of a circle to the radius and angle of the circle. Proof of relationship forthcoming in turtlestitch for now rely on any trig website out there.
a - angle
chord (this is the distance to move)
r is the radius of the implicit circle.
sin(a/2) = chord/(2*r)
chord = 2rsin(a/2)
a = 2*arcsin(chord/(2*r)
r = c/*2sin(a/2)
To test my three reporters I needed to generate 'known' examples based on the unit circle. Starting with the 'magic' 15 degrees, I generated corresponding chords,then tested them by generating the inverses that are 'close enough' to the original. Blame the craxy numbers on how multiplication and division work. Finally all of the radii should be "1" because that's how I generated the chords from the 15 degree angles.
Looks like everything works.
But it should probably be tested for other values of r,
like 2, or 1.5. Take this a step further and make the radius a variable and run it for a list of values.
Comments (0)
No comments yet