Rounding Errors in primitives?

RE: Rounding Errors in primitives?
#22
(2021-06-06, 23:16)Travis Cobbs Wrote: By doing it right and comparing.

1. Compute the X and Z for the given angle using sin and cos and a radius of 1.
2. Round each number to 4 decimal places.
3. Multiply the rounded numbers by the desired radius.

Here are the calculations:

1)
1-4edge.dat consists of a quarter circle of radius 1 with three points between the end points.

The angles of the three points to put into cos and sin in order to get the coordinates of the points are:

1*PI/8
2*PI/8
3*PI/8

cos and sin for the four angles give us the points (note the symmetries and redo these computations by pasting the left hand sides into google):

cos(1*PI/8) = 0.92387953251
cos(2*PI/8) = 0.70710678118
cos(3*PI/8) = 0.38268343236
sin(1*PI/8) = 0.38268343236
sin(2*PI/8) = 0.70710678118
sin(3*PI/8) = 0.92387953251

2)
Rounding these to 4 decimals

0.92387953251 -> 0.9239
0.70710678118 -> 0.7071
0.38268343236 -> 0.3827

This shows that the values of 1-4edge.dat are correct. The content is copied below for transparency:

2 24 1 0 0 0.9239 0 0.3827
2 24 0.9239 0 0.3827 0.7071 0 0.7071
2 24 0.7071 0 0.7071 0.3827 0 0.9239
2 24 0.3827 0 0.9239 0 0 1

3)
Since the points of 1-4edge.dat are correct, the points of 1-4ring5.dat can be computed as in my previous post. Recall that the points of 1-4ring5.dat span from the quarter circle of diameter 5 to the quarter circle of diameter 6:

5 0 0
4.6195 0 1.9135
3.5355 0 3.5355
1.9135 0 4.6195
0 0 5

6 0 0
5.5434 0 2.2962
4.2426 0 4.2426
2.2962 0 5.5434
0 0 6

Which differ from the points in the official file where highlighted.

Final calculations done in JS console, by:
'1 0 0 0.9239 0 0.3827 0.7071 0 0.7071 0.3827 0 0.9239 0 0 1'.split(' ').map(x => 5*x).join(' ');
'1 0 0 0.9239 0 0.3827 0.7071 0 0.7071 0.3827 0 0.9239 0 0 1'.split(' ').map(x => 6*x).join(' ');

Shall I start submitting the fixed files to Chris?
« Next Oldest | Next Newest »

 Messages In This Thread Rounding Errors in primitives? - by Tery Hamer - 2021-03-25, 18:42 RE: Rounding Errors in primitives? - by Travis Cobbs - 2021-03-25, 19:43 RE: Rounding Errors in primitives? - by Philippe Hurbain - 2021-03-25, 19:45 RE: Rounding Errors in primitives? - by Tery Hamer - 2021-03-25, 23:34 RE: Rounding Errors in primitives? - by Chris Dee - 2021-03-26, 12:17 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-04-29, 19:59 RE: Rounding Errors in primitives? - by Travis Cobbs - 2021-04-29, 20:14 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-04-29, 20:43 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-04-29, 20:48 RE: Rounding Errors in primitives? - by Magnus Forsberg - 2021-04-29, 20:54 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-04-29, 21:44 RE: Rounding Errors in primitives? - by Magnus Forsberg - 2021-05-02, 19:45 RE: Rounding Errors in primitives? - by Magnus Forsberg - 2021-05-03, 15:57 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-05-05, 8:33 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-05-05, 8:50 RE: Rounding Errors in primitives? - by Magnus Forsberg - 2021-05-05, 15:29 RE: Rounding Errors in primitives? - by Orion Pobursky - 2021-05-06, 18:58 RE: Rounding Errors in primitives? - by Travis Cobbs - 2021-05-06, 18:48 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-06-06, 11:49 RE: Rounding Errors in primitives? - by Travis Cobbs - 2021-06-06, 23:16 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-06-10, 17:42 RE: Rounding Errors in primitives? - by Orion Pobursky - 2021-06-10, 17:59 RE: Rounding Errors in primitives? - by Lasse Deleuran - 2021-06-11, 8:02 RE: Rounding Errors in primitives? - by Travis Cobbs - 2021-04-29, 21:58

Forum Jump:

Users browsing this thread: 2 Guest(s)