Finding Pi
#6
I get this:
'45 /2 = 22.5
'sin(_d2r(22.5) = a/5 ' Update: actually (1/2 of a) /5 = sin(22.5 degrees)
Print "a ="; 2 * (5 * Sin(_D2R(22.5))) ' 3.8268...

The only way you might avoid a trig table is if you can somehow use the fact that 22.5 is 1/3 of 67.5 the base angles of the iso tri.
My trig not that good.

Here it is illustrated in QB64pe:
Code: (Select All)
Screen _NewImage(800, 600, 32)
'45 /2 = 22.5
'sin(_d2r(22.5) = a/5
Print "a ="; 2 * (5 * Sin(_D2R(22.5))) ' 3.8268...

'draw scale model
xc = 400: yc = 300 ' center of screen
scale = 10
radius = 5 * scale
x1 = xc + radius * Cos(0): y1 = yc + radius * Sin(0)
x2 = xc + radius * Cos(_D2R(45)): y2 = yc + radius * Sin(_D2R(45))
Line (xc, yc)-(x1, y1), &HFF0000FF
Line (xc, yc)-(x2, y2), &HFF0000FF


Color &HFFFFFF00
Line (x1, y1)-(x2, y2),
dist = Sqr((x1 - x2) ^ 2 + (y1 - y2) ^ 2)
Print dist / scale

   
b = b + ...
Reply


Messages In This Thread
Finding Pi - by PhilOfPerth - 11-16-2022, 12:30 AM
RE: Finding Pi - by SMcNeill - 11-16-2022, 01:06 AM
RE: Finding Pi - by PhilOfPerth - 11-16-2022, 02:18 AM
RE: Finding Pi - by Pete - 11-16-2022, 01:08 AM
RE: Finding Pi - by SMcNeill - 11-16-2022, 01:17 AM
RE: Finding Pi - by PhilOfPerth - 11-16-2022, 02:28 AM
RE: Finding Pi - by Pete - 11-16-2022, 01:28 AM
RE: Finding Pi - by bplus - 11-16-2022, 01:29 AM
RE: Finding Pi - by Pete - 11-16-2022, 01:36 AM
RE: Finding Pi - by bplus - 11-16-2022, 02:17 AM
RE: Finding Pi - by PhilOfPerth - 11-16-2022, 02:59 AM
RE: Finding Pi - by bplus - 11-16-2022, 02:24 AM
RE: Finding Pi - by bplus - 11-16-2022, 03:06 AM
RE: Finding Pi - by PhilOfPerth - 11-16-2022, 04:01 AM
RE: Finding Pi - by SMcNeill - 11-16-2022, 04:11 AM
RE: Finding Pi - by jcm - 11-16-2022, 03:16 AM
RE: Finding Pi - by bplus - 11-16-2022, 04:57 AM
RE: Finding Pi - by Pete - 11-16-2022, 04:05 AM
RE: Finding Pi - by bplus - 11-16-2022, 04:55 AM



Users browsing this thread: 3 Guest(s)