Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.

You can then subset your stopping points against your input points by their radius.

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?


In reply to Re^5: Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis? by BrowserUk
in thread Polar Co-Ordinates: Rotating a 3D cartesian point around a fixed axis? by fraizerangus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-24 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found