in reply to Re^10: Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis?
in thread Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis?
A is angstroms, which the data is already calculated in,
Interesting. If I set the limit calculation to 4, I get no collisions between those datasets at all. I have to increase it to 13 before I get any collisions at all.
Which might mean my code is wrong. Or that the datasets are you provided have no collisions at that limit?
Also, I'm not particularly impressed with your unit vector calculation. After the transform is applied to the line datapoints, they should all lie on the Z-axis. They almost do, but the discrepancies are larger than I would like to see:
[ [0, 0, "-1.64339316511165"], ["-0.0575455472996209", "-0.0224071887914015", "-4.64348473502688"], ["-0.114768843254732", "-0.0450882573775804", "-7.64267013501932"], ["-0.172842568057038", "-0.066807562033258", "-10.641262423793"], ["-0.230388115356658", "-0.0892147508246577", "-13.6413539937082"], ["-0.28761141131177", "-0.111895819410838", "-16.6405393937007"], ["-0.344834707266879", "-0.134576887997017", "-19.6397247936931"], ["-0.403322450352862", "-0.156984076788417", "-22.6394813007782"], ["-0.460545746307973", "-0.179665145374598", "-25.6386667007706"], ["-0.517677275323917", "-0.201384450030274", "-28.6375940523744"], ["-0.575222822623537", "-0.223791638821677", "-31.6376856222897"], ["-0.633388314365008", "-0.246472707407854", "-34.6365359594519"], ["-0.69093386166463", "-0.268879896199255", "-37.6366275293672"], ["-0.748157157619741", "-0.291560964785434", "-40.6358129293596"], ["-0.806230882422045", "-0.313280269441112", "-43.6344052181333"], ["-0.863776429721667", "-0.335687458232513", "-46.6344967880485"], ["-0.92099972567678", "-0.35836852681869", "-49.633682188041"], ["-0.978223021631888", "-0.381049595404871", "-52.6328675880334"], ]
Close, but no cigar :) Perhaps it is just the low accuracy of the unit vector values you supplied.
When I derive the tranform from a unit vector calculated to greater precision, and then apply the transform back to the points the unit vector was derived from, I get much more satisfying results, Ie, given list line:
x x x x x 1 0 0 x x x x x 2 1 1 x x x x x 3 2 2 x x x x x 4 3 3 x x x x x 5 4 4 x x x x x 6 5 5 x x x x x 7 6 6 x x x x x 8 7 7 x x x x x 9 8 8 x x x x x 10 9 9 x x x x x 11 10 10
I calculate the unit vector as (0.57735026918962576450914878050196, 0.57735026918962576450914878050196, 0.57735026918962576450914878050196 )
Deriving the transform from that, and applying it to the points above, I get:
[ [ 0, 0, "0.5773502691 +89626"], ["-5.55111512312578e-017", 0, "2.3094010767 +585" ], ["-2.77555756156289e-016", 0, "4.0414518843 +2738" ], [" 1.66533453693773e-016", 0, "5.7735026918 +9626" ], ["-7.21644966006352e-016", 0, "7.5055534994 +6513" ], ["-7.21644966006352e-016", 0, "9.2376043070 +3401" ], [" 1.66533453693773e-016", "4.44089209850063e-016", "10.9696551146 +029" ], ["-7.21644966006352e-016", "-4.44089209850063e-016", "12.7017059221 +718" ], ["-7.21644966006352e-016", "-4.44089209850063e-016", "14.4337567297 +406" ], ["-1.60982338570648e-015", "4.44089209850063e-016", "16.1658075373 +095" ], ["-1.60982338570648e-015", "4.44089209850063e-016", "17.8978583448 +784" ], ]
Which is a much more satisfying alignment between the axis of rotation and the z-axis The difference between made-up data and real-world measurements I guess :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis?
by fraizerangus (Sexton) on Jul 02, 2012 at 18:32 UTC | |
by BrowserUk (Patriarch) on Jul 02, 2012 at 19:21 UTC |