Dear Forum!
Can someone give me a little help to calculate centrobaric coordinates?
Still my solution works well, but something become wrong.
NB. load a list of coordinates from file
load'I:\FKJL.run'
NB. list of coordinates file XYZ
>FKJ
1 -91.406 53.344 8.320
2 -91.297 53.222 0.916
3 -60.158 24.280 8.948
4 -60.135 24.278 1.521
5 -56.298 -19.186 5.700
6 -13.269 -2.677 -1.444
7 -4.666 17.245 -1.605
8 -49.939 14.297 27.119
9 -52.769 11.523 25.906
10 -72.929 -8.630 27.146
11 -46.500 -30.291 23.078
12 -52.581 -22.934 5.676
13 -58.972 -17.511 18.862
14 -55.429 -26.155 23.077
15 -55.313 -26.131 23.039
16 -63.467 27.962 26.981
17 -57.673 22.069 25.782
18 -49.687 14.083 -3.666
NB. compute centrobaric coordinates
AS=:(".AKJ)-"1 RA=:(+/%#)".AKJ=:>,5}."1&.>,.FKJ
AKJ NB. list of coordinates without point number
-91.406 53.344 8.320
-91.297 53.222 0.916
-60.158 24.280 8.948
-60.135 24.278 1.521
-56.298 -19.186 5.700
-13.269 -2.677 -1.444
-4.666 17.245 -1.605
-49.939 14.297 27.119
-52.769 11.523 25.906
-72.929 -8.630 27.146
-46.500 -30.291 23.078
-52.581 -22.934 5.676
-58.972 -17.511 18.862
-55.429 -26.155 23.077
-55.313 -26.131 23.039
-63.467 27.962 26.981
-57.673 22.069 25.782
-49.687 14.083 -3.666
RA NB. XYZ coordinates of center of gravity
_46.396999999999998 _29.359777777777779 _6.9718333333333327
AS NB. list of centrobaric coordinates = AKJ - RA
_45.009000000000007 _23.984222222222222 _1.3481666666666676
_44.899999999999999 _23.862222222222222 6.0558333333333323
_13.761000000000003 5.0797777777777782 _1.9761666666666677
_13.738 5.0817777777777806 5.4508333333333328
9.2849999999999966 _21.23822222222222 6.9718333333333327
34.360999999999997 29.359777777777779 6.9718333333333327
43.335999999999999 13.719777777777779 6.9718333333333327
_3.5420000000000016 15.062777777777779 _20.147166666666667
_6.3719999999999999 17.83677777777778 _18.934166666666666
_17.902000000000008 _16.423222222222222 6.9718333333333327
30.187999999999999 5.9377777777777787 6.9718333333333327
16.749999999999996 _17.545222222222222 6.9718333333333327
4.9359999999999999 _10.75022222222222 6.9718333333333327
17.122999999999998 _2.9922222222222246 6.9718333333333327
17.214999999999996 _2.9142222222222216 6.9718333333333327
_17.07 1.3977777777777796 _20.009166666666669
_11.276000000000003 7.2907777777777802 _18.810166666666667
0.37599999999999767 18.942777777777778 6.9718333333333327
NB. wrong results, program running without error massage
NB. check by hand calculation - lenght error
(-91.406 53.344 8.320) - RA
_45.009000000000007 _23.984222222222222 _1.3481666666666676
(-91.297 53.222 0.916) - RA
_44.899999999999999 _23.862222222222222 6.0558333333333323
(-60.158 24.280 8.948) - RA
_13.761000000000003 5.0797777777777782 _1.9761666666666677
(-60.135 24.278 1.521) - RA
_13.738 5.0817777777777806 5.4508333333333328
(-56.298 -19.186 5.700) - RA
|length error
| (-56.298000000000002-19.186 5.7000000000000002) -RA
$AKJ NB. string
18 29
$RA
3
$AS
18 3
".AKJ NB. do numbers from string ??? wrong
_91.406000000000006 _53.344000000000001 _8.3200000000000003
_91.296999999999997 _53.222000000000001 _0.91600000000000004
_60.158000000000001 _24.280000000000001 _8.9480000000000004
_60.134999999999998 _24.277999999999999 _1.5209999999999999
_37.112000000000002 _50.597999999999999 0
_12.036 0 0
_3.0610000000000004 _15.640000000000001 0
_49.939 _14.297000000000001 _27.119
_52.768999999999998 _11.523 _25.905999999999999
_64.299000000000007 _45.783000000000001 0
_16.209 _23.422000000000001 0
_29.647000000000002 _46.905000000000001 0
_41.460999999999999 _40.109999999999999 0
_29.274000000000001 _32.352000000000004 0
_29.182000000000002 _32.274000000000001 0
_63.466999999999999 _27.962 _26.981000000000002
_57.673000000000002 _22.068999999999999 _25.782
_46.021000000000001 _10.417 0
As you can see when I try to convert a string to number, its not working.
Thank you in advance for your kind help.
Best regards,
Erik
[email protected]
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm