Welcome to the Monastery PerlMonks

### Re^4: Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis?

by fraizerangus (Sexton)
 on Jun 29, 2012 at 09:11 UTC ( #979082=note: print w/replies, xml ) Need Help??

Hello Again

The Line Unit Vector I've calculated as (0.906, 0.258, 0.335)

Here is the sample data for the line

```ATOM         CA  GLY A  84      -3.901   9.352  -1.557
+
ATOM         CA  GLY A  85      -6.632   8.551  -2.508
+
ATOM         CA  GLY A  86      -9.362   7.750  -3.459
+
ATOM         CA  GLY A  87     -12.092   6.950  -4.409
+
ATOM         CA  GLY A  88     -14.823   6.149  -5.360
+
ATOM         CA  GLY A  89     -17.553   5.348  -6.311
+
ATOM         CA  GLY A  90     -20.283   4.547  -7.262
+
ATOM         CA  GLY A  91     -23.014   3.746  -8.212
+
ATOM         CA  GLY A  92     -25.744   2.945  -9.163
+
ATOM         CA  GLY A  93     -28.474   2.145 -10.114
+
ATOM         CA  GLY A  94     -31.205   1.344 -11.065
+
ATOM         CA  GLY A  95     -33.935   0.543 -12.015
+
ATOM         CA  GLY A  96     -36.666  -0.258 -12.966
+
ATOM         CA  GLY A  97     -39.396  -1.059 -13.917
+
ATOM         CA  GLY A  98     -42.126  -1.859 -14.867
+
ATOM         CA  GLY A  99     -44.857  -2.660 -15.818
+
ATOM         CA  GLY A 100     -47.587  -3.461 -16.769
+
ATOM         CA  GLY A 101     -50.317  -4.262 -17.720

and here are the Cartesian co-ordinates for the points I want to rotate by 1 degree intervals for each iteration

```ATOM    183  N   MET B  25     -18.731  -0.135 -11.272
ATOM    184  CA  MET B  25     -19.287  -1.473 -11.499
ATOM    185  C   MET B  25     -20.545  -1.396 -12.335
ATOM    186  O   MET B  25     -21.421  -0.553 -12.114
ATOM    187  CB  MET B  25     -19.594  -2.172 -10.170
ATOM    188  CG  MET B  25     -18.388  -2.409  -9.308
ATOM    189  SD  MET B  25     -18.784  -3.016  -7.671
ATOM    190  CE  MET B  25     -17.107  -3.128  -6.966
ATOM    191  N   PRO B  26     -20.681  -2.300 -13.307
ATOM    192  CA  PRO B  26     -21.870  -2.245 -14.145
ATOM    193  C   PRO B  26     -23.239  -2.337 -13.447
ATOM    194  O   PRO B  26     -24.201  -1.730 -13.882
ATOM    195  CB  PRO B  26     -21.604  -3.351 -15.184
ATOM    196  CG  PRO B  26     -20.782  -4.304 -14.461
ATOM    197  CD  PRO B  26     -19.827  -3.453 -13.654
ATOM    198  N   GLU B  27     -23.296  -3.065 -12.345
ATOM    199  CA  GLU B  27     -24.545  -3.199 -11.624
ATOM    200  C   GLU B  27     -24.971  -1.907 -10.917
ATOM    201  O   GLU B  27     -26.155  -1.714 -10.652
ATOM    202  CB  GLU B  27     -24.417  -4.262 -10.541
ATOM    203  CG  GLU B  27     -24.206  -5.670 -11.059
ATOM    204  CD  GLU B  27     -22.756  -6.001 -11.359
ATOM    205  OE1 GLU B  27     -21.843  -5.132 -11.182
ATOM    206  OE2 GLU B  27     -22.549  -7.164 -11.773
ATOM    340  N   VAL B  44     -28.758  -0.366  -7.293
ATOM    341  CA  VAL B  44     -28.277  -1.382  -8.227
ATOM    342  C   VAL B  44     -29.430  -2.020  -8.991
ATOM    343  O   VAL B  44     -30.583  -2.037  -8.548
ATOM    344  CB  VAL B  44     -27.545  -2.528  -7.509
ATOM    345  CG1 VAL B  44     -26.301  -2.027  -6.834
ATOM    346  CG2 VAL B  44     -28.453  -3.165  -6.499
ATOM    347  N   GLU B  45     -29.101  -2.474 -10.197
ATOM    348  CA  GLU B  45     -30.032  -3.224 -11.040
ATOM    349  C   GLU B  45     -29.268  -4.484 -11.492
ATOM    350  O   GLU B  45     -28.116  -4.412 -11.942
ATOM    351  CB  GLU B  45     -30.496  -2.378 -12.258
ATOM    352  CG  GLU B  45     -31.341  -1.173 -11.858
ATOM    353  CD  GLU B  45     -31.677  -0.230 -13.021
ATOM    354  OE1 GLU B  45     -30.974  -0.274 -14.048
ATOM    355  OE2 GLU B  45     -32.633   0.552 -12.884
ATOM    356  N   THR B  46     -29.918  -5.632 -11.352
ATOM    357  CA  THR B  46     -29.341  -6.925 -11.736
ATOM    358  C   THR B  46     -30.384  -7.735 -12.500
ATOM    359  O   THR B  46     -31.579  -7.459 -12.407
ATOM    360  CB  THR B  46     -28.853  -7.732 -10.500
ATOM    361  OG1 THR B  46     -29.953  -8.003  -9.622
ATOM    362  CG2 THR B  46     -27.735  -6.958  -9.755
ATOM    363  N   ASP B  47     -29.939  -8.747 -13.241
ATOM    364  CA  ASP B  47     -30.878  -9.551 -14.011
ATOM    365  C   ASP B  47     -31.833 -10.352 -13.136
ATOM    366  O   ASP B  47     -33.036 -10.461 -13.408
ATOM    367  CB  ASP B  47     -30.088 -10.510 -14.903
ATOM    368  CG  ASP B  47     -29.320  -9.797 -15.991
ATOM    369  OD1 ASP B  47     -29.582  -8.595 -16.229
ATOM    370  OD2 ASP B  47     -28.457 -10.451 -16.622
ATOM    371  N   THR B  48     -31.275 -10.936 -12.094
ATOM    372  CA  THR B  48     -31.996 -11.805 -11.190
ATOM    373  C   THR B  48     -31.636 -11.519  -9.746
ATOM    374  O   THR B  48     -30.654 -10.802  -9.448
ATOM    375  CB  THR B  48     -31.599 -13.294 -11.440
ATOM    376  OG1 THR B  48     -30.210 -13.487 -11.070
ATOM    377  CG2 THR B  48     -31.741 -13.642 -12.949
ATOM    378  N   LEU B  49     -32.428 -12.075  -8.840
ATOM    379  CA  LEU B  49     -32.135 -11.978  -7.411
ATOM    380  C   LEU B  49     -30.851 -12.716  -7.074
ATOM    381  O   LEU B  49     -30.080 -12.298  -6.199
ATOM    382  CB  LEU B  49     -33.281 -12.532  -6.554
ATOM    383  CG  LEU B  49     -34.391 -11.563  -6.233
ATOM    384  CD1 LEU B  49     -35.291 -12.246  -5.196
ATOM    385  CD2 LEU B  49     -33.834 -10.232  -5.630
ATOM    386  N   LYS B  50     -30.598 -13.835  -7.746
ATOM    387  CA  LYS B  50     -29.385 -14.574  -7.494
ATOM    388  C   LYS B  50     -28.185 -13.675  -7.804
ATOM    389  O   LYS B  50     -27.196 -13.667  -7.069
ATOM    390  CB  LYS B  50     -29.374 -15.839  -8.366
ATOM    391  CG  LYS B  50     -28.083 -16.600  -8.281
ATOM    392  CD  LYS B  50     -28.213 -17.957  -8.920
ATOM    393  CE  LYS B  50     -26.851 -18.613  -9.055
ATOM    394  NZ  LYS B  50     -26.976 -20.031  -9.478
ATOM    395  N   ASP B  51     -28.281 -12.904  -8.884
ATOM    396  CA  ASP B  51     -27.192 -11.993  -9.228
ATOM    397  C   ASP B  51     -27.020 -10.918  -8.147
ATOM    398  O   ASP B  51     -25.897 -10.550  -7.798
ATOM    399  CB  ASP B  51     -27.447 -11.319 -10.586
ATOM    400  CG  ASP B  51     -27.316 -12.286 -11.759
ATOM    401  OD1 ASP B  51     -26.408 -13.135 -11.716
ATOM    402  OD2 ASP B  51     -28.108 -12.169 -12.711
ATOM    403  N   LEU B  52     -28.126 -10.396  -7.647
ATOM    404  CA  LEU B  52     -28.039  -9.393  -6.586
ATOM    405  C   LEU B  52     -27.400  -9.998  -5.331
ATOM    406  O   LEU B  52     -26.592  -9.339  -4.682
ATOM    407  CB  LEU B  52     -29.432  -8.849  -6.290
ATOM    408  CG  LEU B  52     -29.515  -7.909  -5.079
ATOM    409  CD1 LEU B  52     -28.622  -6.677  -5.324
ATOM    410  CD2 LEU B  52     -30.990  -7.549  -4.806
ATOM    411  N   ASP B  53     -27.788 -11.220  -4.974
ATOM    412  CA  ASP B  53     -27.250 -11.886  -3.803
ATOM    413  C   ASP B  53     -25.745 -12.043  -3.924
ATOM    414  O   ASP B  53     -25.000 -11.783  -2.971
ATOM    415  CB  ASP B  53     -27.931 -13.252  -3.645
ATOM    416  CG  ASP B  53     -27.790 -13.802  -2.257
ATOM    417  OD1 ASP B  53     -27.786 -13.011  -1.288
ATOM    418  OD2 ASP B  53     -27.688 -15.033  -2.135
ATOM    419  N   GLN B  54     -25.280 -12.456  -5.100
ATOM    420  CA  GLN B  54     -23.859 -12.616  -5.309
ATOM    421  C   GLN B  54     -23.145 -11.284  -5.250
ATOM    422  O   GLN B  54     -22.033 -11.206  -4.727
ATOM    423  CB  GLN B  54     -23.597 -13.346  -6.625
ATOM    424  CG  GLN B  54     -24.127 -14.755  -6.529
ATOM    425  CD  GLN B  54     -23.878 -15.578  -7.770
ATOM    426  OE1 GLN B  54     -23.247 -15.119  -8.724
ATOM    427  NE2 GLN B  54     -24.368 -16.813  -7.760
ATOM    428  N   PHE B  55     -23.758 -10.226  -5.757
ATOM    429  CA  PHE B  55     -23.128  -8.913  -5.673
ATOM    430  C   PHE B  55     -22.938  -8.514  -4.211
ATOM    431  O   PHE B  55     -21.864  -8.030  -3.828
ATOM    432  CB  PHE B  55     -24.018  -7.892  -6.380
ATOM    433  CG  PHE B  55     -23.448  -6.509  -6.415
ATOM    434  CD1 PHE B  55     -22.595  -6.140  -7.449
ATOM    435  CD2 PHE B  55     -23.733  -5.581  -5.409
ATOM    436  CE1 PHE B  55     -22.035  -4.860  -7.485
ATOM    437  CE2 PHE B  55     -23.167  -4.280  -5.431
ATOM    438  CZ  PHE B  55     -22.322  -3.934  -6.480
ATOM    439  N   ILE B  56     -23.984  -8.686  -3.405
ATOM    440  CA  ILE B  56     -23.948  -8.313  -2.000
ATOM    441  C   ILE B  56     -22.987  -9.148  -1.168
ATOM    442  O   ILE B  56     -22.261  -8.598  -0.347
ATOM    443  CB  ILE B  56     -25.376  -8.459  -1.390
ATOM    444  CG1 ILE B  56     -26.289  -7.371  -1.967
ATOM    445  CG2 ILE B  56     -25.329  -8.392   0.151
ATOM    446  CD1 ILE B  56     -27.739  -7.521  -1.574
ATOM    447  N   THR B  57     -22.959 -10.461  -1.364
ATOM    448  CA  THR B  57     -22.088 -11.246  -0.490
ATOM    449  C   THR B  57     -20.683 -11.497  -1.042
ATOM    450  O   THR B  57     -19.718 -11.631  -0.257
ATOM    451  CB  THR B  57     -22.774 -12.556  -0.095
ATOM    452  OG1 THR B  57     -22.821 -13.385  -1.247
ATOM    453  CG2 THR B  57     -24.225 -12.310   0.420
ATOM    454  N   GLU B  58     -20.531 -11.490  -2.358
ATOM    455  CA  GLU B  58     -19.203 -11.666  -2.942
ATOM    456  C   GLU B  58     -18.510 -10.387  -3.385
ATOM    457  O   GLU B  58     -17.411 -10.096  -2.922
ATOM    458  CB  GLU B  58     -19.234 -12.599  -4.139
ATOM    459  CG  GLU B  58     -19.923 -13.930  -3.875
ATOM    460  CD  GLU B  58     -19.918 -14.829  -5.113
ATOM    461  OE1 GLU B  58     -20.834 -15.660  -5.290
ATOM    462  OE2 GLU B  58     -18.981 -14.717  -5.920

The stopping point would be when any of the points come into contact with any of these Cartesian points after numerous iterations?

```ATOM     39  N   ILE A   6     -28.498  -0.713  -1.733        0.03
ATOM     40  CA  ILE A   6     -27.704  -1.211  -0.641        0.03
ATOM     41  C   ILE A   6     -27.201  -0.065   0.236        0.03
ATOM     42  O   ILE A   6     -26.458   0.817  -0.235        0.03
ATOM     43  CB  ILE A   6     -26.486  -1.991  -1.182        0.03
ATOM     44  CG1 ILE A   6     -26.936  -3.007  -2.231        0.03
ATOM     45  CG2 ILE A   6     -25.762  -2.672  -0.060        0.03
ATOM     46  CD1 ILE A   6     -25.781  -3.823  -2.789        0.03
ATOM     47  N   LEU A   7     -27.587  -0.085   1.510        0.02
ATOM     48  CA  LEU A   7     -27.153   0.909   2.483        0.02
ATOM     49  C   LEU A   7     -25.832   0.351   2.982        0.02
ATOM     50  O   LEU A   7     -25.725  -0.855   3.179        0.02
ATOM     51  CB  LEU A   7     -28.150   0.965   3.635        0.02
ATOM     52  CG  LEU A   7     -29.480   1.674   3.398        0.02
ATOM     53  CD1 LEU A   7     -30.088   1.292   2.072        0.02
ATOM     54  CD2 LEU A   7     -30.441   1.320   4.561        0.02
ATOM     55  N   MET A   8     -24.844   1.208   3.209        0.02
ATOM     56  CA  MET A   8     -23.528   0.721   3.622        0.02
ATOM     57  C   MET A   8     -22.874   1.588   4.663        0.02
ATOM     58  O   MET A   8     -23.051   2.789   4.654        0.02
ATOM     59  CB  MET A   8     -22.538   0.723   2.437        0.02
ATOM     60  CG  MET A   8     -22.909  -0.149   1.303        0.02
ATOM     61  SD  MET A   8     -21.700   0.110  -0.066        0.02
ATOM     62  CE  MET A   8     -22.383  -1.085  -1.224        0.02
ATOM     63  N   VAL A   9     -22.103   0.946   5.551        0.04
ATOM     64  CA  VAL A   9     -21.251   1.656   6.509        0.04
ATOM     65  C   VAL A   9     -19.827   1.350   6.024        0.04
ATOM     66  O   VAL A   9     -19.506   0.197   5.667        0.04
ATOM     67  CB  VAL A   9     -21.425   1.146   7.936        0.04
ATOM     68  CG1 VAL A   9     -20.279   1.661   8.813        0.04
ATOM     69  CG2 VAL A   9     -22.738   1.625   8.459        0.04
ATOM     70  N   THR A  10     -18.983   2.377   5.928        0.09
ATOM     71  CA  THR A  10     -17.612   2.153   5.477        0.09
ATOM     72  C   THR A  10     -16.618   2.492   6.565        0.09
ATOM     73  O   THR A  10     -16.966   3.024   7.616        0.09
ATOM     74  CB  THR A  10     -17.207   3.026   4.219        0.09
ATOM     75  OG1 THR A  10     -17.096   4.420   4.591        0.09
ATOM     76  CG2 THR A  10     -18.220   2.859   3.097        0.09
ATOM     77  N   ALA A  11     -15.364   2.173   6.285        0.10
ATOM     78  CA  ALA A  11     -14.313   2.532   7.215        0.10
ATOM     79  C   ALA A  11     -14.258   4.060   7.162        0.10
ATOM     80  O   ALA A  11     -14.598   4.689   6.142        0.10
ATOM     81  CB  ALA A  11     -12.997   1.943   6.763        0.10
ATOM     82  N   ALA A  12     -13.817   4.657   8.263        0.10
ATOM     83  CA  ALA A  12     -13.702   6.102   8.382        0.10
ATOM     84  C   ALA A  12     -12.862   6.679   7.260        0.10
ATOM     85  O   ALA A  12     -11.763   6.198   6.975        0.10
ATOM     86  CB  ALA A  12     -13.038   6.467   9.721        0.10
ATOM     87  N   GLY A  13     -13.401   7.713   6.625        0.10
ATOM     88  CA  GLY A  13     -12.709   8.403   5.560        0.10
ATOM     89  C   GLY A  13     -12.679   7.741   4.199        0.10
ATOM     90  O   GLY A  13     -12.124   8.301   3.256        0.10
ATOM     91  N   LYS A  14     -13.292   6.567   4.099        0.10
ATOM     92  CA  LYS A  14     -13.296   5.834   2.836        0.10
ATOM     93  C   LYS A  14     -14.613   5.968   2.067        0.10
ATOM     94  O   LYS A  14     -14.816   5.265   1.073        0.10
ATOM     95  CB  LYS A  14     -13.052   4.340   3.097        0.10
ATOM     96  CG  LYS A  14     -11.847   4.006   3.973        0.10
ATOM     97  CD  LYS A  14     -10.669   3.514   3.192        0.10
ATOM     98  CE  LYS A  14      -9.425   3.504   4.096        0.10
ATOM     99  NZ  LYS A  14      -8.294   2.793   3.470        0.10
ATOM    100  N   GLU A  15     -15.515   6.845   2.506        0.10
ATOM    101  CA  GLU A  15     -16.819   6.965   1.812        0.10
ATOM    102  C   GLU A  15     -16.734   7.312   0.338        0.10
ATOM    103  O   GLU A  15     -17.331   6.638  -0.490        0.10
ATOM    104  CB  GLU A  15     -17.727   8.003   2.502        0.10
ATOM    105  CG  GLU A  15     -18.061   7.715   3.976        0.10
ATOM    106  CD  GLU A  15     -17.016   8.228   4.947        0.10
ATOM    107  OE1 GLU A  15     -15.892   8.584   4.527        0.10
ATOM    108  OE2 GLU A  15     -17.340   8.275   6.164        0.10
ATOM    109  N   ARG A  16     -15.982   8.340  -0.017        0.10
ATOM    110  CA  ARG A  16     -15.900   8.706  -1.430        0.10
ATOM    111  C   ARG A  16     -15.152   7.639  -2.208        0.10
ATOM    112  O   ARG A  16     -15.500   7.374  -3.355        0.10
ATOM    113  CB  ARG A  16     -15.213  10.071  -1.614        0.10
ATOM    114  CG  ARG A  16     -15.066  10.477  -3.074        0.10
ATOM    115  CD  ARG A  16     -14.327  11.819  -3.243        0.10
ATOM    116  NE  ARG A  16     -13.901  11.961  -4.661        0.10
ATOM    117  CZ  ARG A  16     -12.676  12.396  -4.952        0.10
ATOM    118  NH1 ARG A  16     -11.841  12.690  -3.980        0.10
ATOM    119  NH2 ARG A  16     -12.324  12.531  -6.223        0.10
ATOM    120  N   GLU A  17     -14.127   7.041  -1.600        0.10
ATOM    121  CA  GLU A  17     -13.340   5.994  -2.257        0.10
ATOM    122  C   GLU A  17     -14.268   4.836  -2.644        0.10
ATOM    123  O   GLU A  17     -14.220   4.331  -3.769        0.10
ATOM    124  CB  GLU A  17     -12.243   5.483  -1.324        0.10
ATOM    125  CG  GLU A  17     -11.398   4.389  -1.922        0.10
ATOM    126  CD  GLU A  17     -10.374   3.854  -0.952        0.10
ATOM    127  OE1 GLU A  17      -9.787   4.637  -0.182        0.10
ATOM    128  OE2 GLU A  17     -10.145   2.634  -0.974        0.10
ATOM    129  N   VAL A  18     -15.088   4.417  -1.687        0.05
ATOM    130  CA  VAL A  18     -16.032   3.353  -1.954        0.05
ATOM    131  C   VAL A  18     -17.052   3.764  -3.010        0.05
ATOM    132  O   VAL A  18     -17.362   2.988  -3.934        0.05
ATOM    133  CB  VAL A  18     -16.728   2.910  -0.642        0.05
ATOM    134  CG1 VAL A  18     -17.948   1.984  -0.944        0.05
ATOM    135  CG2 VAL A  18     -15.732   2.187   0.235        0.05
ATOM    136  N   MET A  19     -17.576   4.985  -2.896        0.07
ATOM    137  CA  MET A  19     -18.546   5.491  -3.868        0.07
ATOM    138  C   MET A  19     -17.983   5.393  -5.290        0.07
ATOM    139  O   MET A  19     -18.674   4.895  -6.177        0.07
ATOM    140  CB  MET A  19     -18.893   6.968  -3.577        0.07
ATOM    141  CG  MET A  19     -20.080   7.412  -4.413        0.07
ATOM    142  SD  MET A  19     -20.383   9.219  -4.338        0.07
ATOM    143  CE  MET A  19     -19.063   9.830  -5.317        0.07
ATOM    144  N   GLU A  20     -16.756   5.884  -5.511        0.09
ATOM    145  CA  GLU A  20     -16.196   5.861  -6.857        0.09
ATOM    146  C   GLU A  20     -15.772   4.495  -7.343        0.09
ATOM    147  O   GLU A  20     -15.901   4.220  -8.534        0.09
ATOM    148  CB  GLU A  20     -15.044   6.862  -6.987        0.09
ATOM    149  CG  GLU A  20     -15.543   8.306  -6.956        0.09
ATOM    150  CD  GLU A  20     -16.363   8.708  -8.202        0.09
ATOM    151  OE1 GLU A  20     -16.970   9.796  -8.155        0.09
ATOM    152  OE2 GLU A  20     -16.379   7.971  -9.220        0.09
ATOM    153  N   LYS A  21     -15.252   3.643  -6.462        0.10
ATOM    154  CA  LYS A  21     -14.915   2.272  -6.858        0.10
ATOM    155  C   LYS A  21     -16.180   1.564  -7.282        0.10
ATOM    156  O   LYS A  21     -16.169   0.784  -8.252        0.10
ATOM    157  CB  LYS A  21     -14.303   1.491  -5.708        0.10
ATOM    158  CG  LYS A  21     -12.832   1.764  -5.525        0.10
ATOM    159  CD  LYS A  21     -12.327   1.210  -4.178        0.10
ATOM    160  CE  LYS A  21     -10.801   1.122  -4.130        0.10
ATOM    161  NZ  LYS A  21     -10.349   0.604  -2.784        0.10
ATOM    162  N   LEU A  22     -17.288   1.806  -6.579        0.11
ATOM    163  CA  LEU A  22     -18.534   1.162  -6.994        0.11
ATOM    164  C   LEU A  22     -19.072   1.736  -8.301        0.11
ATOM    165  O   LEU A  22     -19.512   0.989  -9.171        0.11
ATOM    166  CB  LEU A  22     -19.598   1.245  -5.873        0.11
ATOM    167  CG  LEU A  22     -19.223   0.453  -4.620        0.11
ATOM    168  CD1 LEU A  22     -20.205   0.865  -3.502        0.11
ATOM    169  CD2 LEU A  22     -19.288  -1.055  -4.861        0.11
ATOM    223  N   GLU A  30     -26.173   4.298  -9.604        0.06
ATOM    224  CA  GLU A  30     -26.154   5.548  -8.818        0.06
ATOM    225  C   GLU A  30     -25.520   5.244  -7.485        0.06
ATOM    226  O   GLU A  30     -25.520   4.099  -7.058        0.06
ATOM    227  CB  GLU A  30     -27.568   6.089  -8.553        0.06
ATOM    228  CG  GLU A  30     -28.375   6.303  -9.811        0.06
ATOM    229  CD  GLU A  30     -29.809   6.722  -9.535        0.06
ATOM    230  OE1 GLU A  30     -30.598   6.782 -10.509        0.06
ATOM    231  OE2 GLU A  30     -30.165   6.966  -8.358        0.06
ATOM    232  N   ALA A  31     -24.951   6.248  -6.833        0.05
ATOM    233  CA  ALA A  31     -24.363   6.006  -5.506        0.05
ATOM    234  C   ALA A  31     -24.301   7.338  -4.796        0.05
ATOM    235  O   ALA A  31     -24.077   8.365  -5.437        0.05
ATOM    236  CB  ALA A  31     -22.978   5.359  -5.608        0.05
ATOM    237  N   TYR A  32     -24.572   7.316  -3.488        0.04
ATOM    238  CA  TYR A  32     -24.652   8.533  -2.696        0.04
ATOM    239  C   TYR A  32     -23.980   8.358  -1.362        0.04
ATOM    240  O   TYR A  32     -24.240   7.361  -0.691        0.04
ATOM    241  CB  TYR A  32     -26.131   8.855  -2.372        0.04
ATOM    242  CG  TYR A  32     -27.052   8.910  -3.572        0.04
ATOM    243  CD1 TYR A  32     -27.483  10.132  -4.088        0.04
ATOM    244  CD2 TYR A  32     -27.498   7.734  -4.193        0.04
ATOM    245  CE1 TYR A  32     -28.332  10.204  -5.226        0.04
ATOM    246  CE2 TYR A  32     -28.364   7.805  -5.341        0.04
ATOM    247  CZ  TYR A  32     -28.750   9.031  -5.829        0.04
ATOM    248  OH  TYR A  32     -29.576   9.155  -6.940        0.04
ATOM    249  N   VAL A  33     -23.111   9.305  -0.989        0.05
ATOM    250  CA  VAL A  33     -22.554   9.322   0.369        0.05
ATOM    251  C   VAL A  33     -23.675  10.096   1.073        0.05
ATOM    252  O   VAL A  33     -24.156  11.136   0.594        0.05
ATOM    253  CB  VAL A  33     -21.220  10.083   0.445        0.05
ATOM    254  CG1 VAL A  33     -20.755  10.141   1.920        0.05
ATOM    255  CG2 VAL A  33     -20.178   9.346  -0.413        0.05
ATOM    256  N   VAL A  34     -24.084   9.606   2.238        0.04
ATOM    257  CA  VAL A  34     -25.214  10.222   2.922        0.04
ATOM    258  C   VAL A  34     -24.914  10.490   4.371        0.04
ATOM    259  O   VAL A  34     -23.962   9.945   4.913        0.04
ATOM    260  CB  VAL A  34     -26.489   9.301   2.849        0.04
ATOM    261  CG1 VAL A  34     -26.909   9.102   1.409        0.04
ATOM    262  CG2 VAL A  34     -26.195   7.910   3.440        0.04
ATOM    263  N   TYR A  35     -25.732  11.375   4.933        0.04
ATOM    264  CA  TYR A  35     -25.675  11.728   6.350        0.04
ATOM    265  C   TYR A  35     -26.947  11.098   6.898        0.04
ATOM    266  O   TYR A  35     -28.070  11.485   6.523        0.04
ATOM    267  CB  TYR A  35     -25.713  13.247   6.505        0.04
ATOM    268  CG  TYR A  35     -25.506  13.693   7.918        0.04
ATOM    269  CD1 TYR A  35     -24.229  13.810   8.453        0.04
ATOM    270  CD2 TYR A  35     -26.602  14.002   8.703        0.04
ATOM    271  CE1 TYR A  35     -24.064  14.240   9.769        0.04
ATOM    272  CE2 TYR A  35     -26.438  14.440  10.025        0.04
ATOM    273  CZ  TYR A  35     -25.179  14.547  10.528        0.04
ATOM    274  OH  TYR A  35     -25.061  15.008  11.825        0.04
ATOM    275  N   GLY A  36     -26.755  10.167   7.815        0.05
ATOM    276  CA  GLY A  36     -27.878   9.430   8.387        0.05
ATOM    277  C   GLY A  36     -27.317   8.205   9.102        0.05
ATOM    278  O   GLY A  36     -26.136   8.180   9.497        0.05
ATOM    279  N   GLU A  37     -28.152   7.181   9.241        0.06
ATOM    280  CA  GLU A  37     -27.716   5.986   9.945        0.06
ATOM    281  C   GLU A  37     -26.676   5.184   9.210        0.06
ATOM    282  O   GLU A  37     -25.909   4.448   9.828        0.06
ATOM    283  CB  GLU A  37     -28.913   5.123  10.324        0.06
ATOM    284  CG  GLU A  37     -29.626   5.662  11.596        0.06
ATOM    285  CD  GLU A  37     -28.641   5.978  12.759        0.06
ATOM    286  OE1 GLU A  37     -28.100   7.102  12.829        0.06
ATOM    287  OE2 GLU A  37     -28.369   5.099  13.599        0.06
ATOM    288  N   TYR A  38     -26.637   5.312   7.885        0.06
ATOM    289  CA  TYR A  38     -25.628   4.630   7.088        0.06
ATOM    290  C   TYR A  38     -24.754   5.692   6.410        0.06
ATOM    291  O   TYR A  38     -25.087   6.891   6.460        0.06
ATOM    292  CB  TYR A  38     -26.302   3.702   6.043        0.06
ATOM    293  CG  TYR A  38     -26.774   2.386   6.623        0.06
ATOM    294  CD1 TYR A  38     -25.935   1.280   6.620        0.06
ATOM    295  CD2 TYR A  38     -28.064   2.253   7.172        0.06
ATOM    296  CE1 TYR A  38     -26.345   0.074   7.134        0.06
ATOM    297  CE2 TYR A  38     -28.480   1.039   7.696        0.06
ATOM    298  CZ  TYR A  38     -27.612  -0.032   7.671        0.06
ATOM    299  OH  TYR A  38     -27.972  -1.249   8.206        0.06
ATOM    300  N   ASP A  39     -23.666   5.240   5.773        0.07
ATOM    301  CA  ASP A  39     -22.715   6.122   5.095        0.07
ATOM    302  C   ASP A  39     -22.972   6.280   3.599        0.07
ATOM    303  O   ASP A  39     -22.630   7.313   3.035        0.07
ATOM    304  CB  ASP A  39     -21.268   5.626   5.263        0.07
ATOM    305  CG  ASP A  39     -20.814   5.604   6.699        0.07
ATOM    306  OD1 ASP A  39     -21.158   6.535   7.462        0.07
ATOM    307  OD2 ASP A  39     -20.061   4.677   7.044        0.07
ATOM    308  N   LEU A  40     -23.514   5.243   2.964        0.05
ATOM    309  CA  LEU A  40     -23.828   5.322   1.528        0.05
ATOM    310  C   LEU A  40     -25.104   4.579   1.239        0.05
ATOM    311  O   LEU A  40     -25.514   3.699   1.976        0.05
ATOM    312  CB  LEU A  40     -22.778   4.630   0.631        0.05
ATOM    313  CG  LEU A  40     -21.479   5.351   0.353        0.05
ATOM    314  CD1 LEU A  40     -20.465   4.981   1.407        0.05
ATOM    315  CD2 LEU A  40     -21.005   4.968  -1.063        0.05
ATOM    316  N   ILE A  41     -25.715   4.944   0.130        0.04
ATOM    317  CA  ILE A  41     -26.837   4.195  -0.420        0.04
ATOM    318  C   ILE A  41     -26.429   4.027  -1.883        0.04
ATOM    319  O   ILE A  41     -26.037   4.995  -2.562        0.04
ATOM    320  CB  ILE A  41     -28.223   4.858  -0.239        0.04
ATOM    321  CG1 ILE A  41     -29.288   3.916  -0.824        0.04
ATOM    322  CG2 ILE A  41     -28.325   6.173  -0.938        0.04
ATOM    323  CD1 ILE A  41     -30.749   4.243  -0.427        0.04
ATOM    541  N   MET A  68     -20.563  -2.717   6.892        0.13
ATOM    542  CA  MET A  68     -21.918  -3.188   7.191        0.13
ATOM    543  C   MET A  68     -22.777  -2.880   5.974        0.13
ATOM    544  O   MET A  68     -22.516  -1.911   5.266        0.13
ATOM    545  CB  MET A  68     -22.532  -2.425   8.376        0.13
ATOM    546  CG  MET A  68     -21.642  -2.257   9.591        0.13
ATOM    547  SD  MET A  68     -22.647  -1.596  10.958        0.13
ATOM    548  CE  MET A  68     -21.570  -1.866  12.362        0.13
ATOM    549  N   THR A  69     -23.759  -3.734   5.714        0.14
ATOM    550  CA  THR A  69     -24.695  -3.461   4.626        0.14
ATOM    551  C   THR A  69     -26.114  -3.843   5.016        0.14
ATOM    552  O   THR A  69     -26.355  -4.624   5.935        0.14
ATOM    553  CB  THR A  69     -24.373  -4.249   3.311        0.14
ATOM    554  OG1 THR A  69     -24.469  -5.672   3.533        0.14
ATOM    555  CG2 THR A  69     -22.981  -3.930   2.810        0.14
ATOM    556  N   SER A  70     -27.059  -3.260   4.303        0.20
ATOM    557  CA  SER A  70     -28.483  -3.591   4.459        0.20
ATOM    558  C   SER A  70     -28.977  -3.509   3.019        0.20
ATOM    559  O   SER A  70     -28.971  -2.437   2.406        0.20
ATOM    560  CB  SER A  70     -29.213  -2.581   5.344        0.20
ATOM    561  OG  SER A  70     -30.606  -2.925   5.446        0.20
ATOM    562  N   THR A  71     -29.427  -4.639   2.480        0.40
ATOM    563  CA  THR A  71     -29.837  -4.738   1.093        0.40
ATOM    564  C   THR A  71     -31.352  -4.814   0.899        0.40
ATOM    565  O   THR A  71     -32.039  -5.562   1.600        0.40
ATOM    566  CB  THR A  71     -29.178  -5.970   0.493        0.40
ATOM    567  OG1 THR A  71     -27.743  -5.825   0.591        0.40
ATOM    568  CG2 THR A  71     -29.593  -6.126  -0.957        0.40

Many Thanks again!

Dan

Replies are listed 'Best First'.
Re^5: Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis?
by BrowserUk (Pope) on Jun 29, 2012 at 15:17 UTC

The whole problem becomes far simpler if you re-base your points (both those you need to rotate, and those that form stopping points) so that they are relative to your axis of rotation. Ie. move the entire field of view so that the axis unit vector lines up with the Z-axis of your re-based coordinate system.

That is, once the points are re-based, sqrt( x2 + y2 ) for each of the points will give you their radius of rotation. Now you only need compare any given input point against those stopping points that have that same radius (+-some tolorance).

And if once you've re-based the points, you convert them to 2D vectors, the length is the radius directly, and the difference between their angles tells you how far you would have to rotate them before they collided.

So now you don't need to rotate all the points incrementally at all, you simply find all the pairs of input/stopping points that can collide; and choose the minimum or maximum angle (depending upon which direction you are rotating them, as your "first collision point".

This is a much simpler, and far more computationally efficient way of folding your molecule.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Hello

Apologies I'm really struggling to understand what you mean? any chance you could give me an equation or example code so I can get my head around it please?

many thanks and best wishes

Dan

I'll try to clarify the approach with some 2D ascii art.

Here is a diagram of the problem simplified so that we have 1 input point (x); 4 stopping points (o); and the rotational axis (+).

Fortuitously, in this example all the z values are 0; and the axis of rotation happens to be parallel to the z-axis:

```+ Axis of rotation:              [-5, -2, *]

x An input point to be rotated   [+1, -2, *]

o Several stopping points:       [-7, +4, *]
[-6, +3, *]
[-5, +5, *]
[-4, +4, *]

o         5
o     o       |
o           |
|
|
- - - 5 - - - - 0 - - - - 5 - - - -
|
+         | x
|
|
5

Using your described approach, you now have to rotate (x) around (+) and then compare the new position with each of the 4 (o)s; and do that 360 times. Or more, depending upon your allowable tolerance.

In this example it is easy to see that by applying a simple translation transform to all the points, we can re-base the coordinates, and thus slide the z-axis until it is coincident with the axis of rotation. The 2D transform required is just [+5, +2], giving the points:

```+ Axis of rotation:              [ 0,  0, *]

x An input point to be rotated   [+6,  0, *]

o Several stopping points:       [-2, +6, *]
[-1, +5, *]
[ 0, +7, *]
[+1, +6, *]
|
o
o   | o
o 5
|
|
|
|
- - - + - - - - 5 x
|
|
|

And now we can convert the 3D cartesian points, to 2D polar vectors:

```                                                [radius, angle]
x An input point to be rotated   [+6,  0, *] -> [6.00,   0.000]

o Several stopping points:       [-2, +6, *] -> [6.32,   108.4]
[-1, +5, *] -> [5.09,   101.3]
[ 0, +7, *] -> [7.00,    90.0]
[+1, +6, *] -> [6.08,    80.5]

And it is easy to see that if our tolerance on the radius, for a collision, were 0.1, then we only need look at 1 of the 4 stopping points.

And we can directly obtain the rotation required to produce that collision by subtracting the angles. In this case 80.5 degrees.

Obviously, real data is not so convenient, and the transform you'll need to apply to the points to align the axis of rotation with the z-axis will need to be a full Affine transform. But with the unit vector for the axis of rotation, you already have the major information required to construct it.

The other part of the matrix will require you to find the closest point on the axis of rotation to the origin; in order to fill in the x,y,z translation values. But as I recall, that is simply derived directly from the equation of the axis, which is derived directly from is unit vector.

But the major point is, once you have transformed the points to align the axis, you can exclude the z-coordinates and use 2D vectors to avoid having to iterate the rotation or do a full input points to stopping point cross comparison. You only need consider the z values again once you've found pairs that have the same radius in the X-Y plane.

I'll need to refresh my memory of the math involved -- I always do -- but I'll try to post a worked example over the weekend.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Re^5: Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis?
by salva (Abbot) on Jun 29, 2012 at 11:44 UTC
This script below does what you have asked for. It uses Math::Vector::Real::kdTree for fast lookups.

But anyway, I am not sure that this is really what you need. If by doing 1deg rotation you are trying to simulate a continuous rotation, 1deg may be not fine enough. Even going for 0.1deg may not be fine enough and the computational cost grows exponentially with the precision.

If you are on the continuous simulation problem there are better ways to do it...

Create A New User
Node Status?
node history
Node Type: note [id://979082]
help
Chatterbox?
 [1nickt]: yes, comma-sep (if you mean the html input attr). This ^ is for the human label :-)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-07-22 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
I came, I saw, I ...

Results (340 votes). Check out past polls.