Thanks Bob!

That helped a lot, though I'm not quite there yet.

On Thu, Oct 21, 2010 at 06:59, Robert Hanson <[email protected]> wrote:
> Oliver,
>
> Great to see people picking up on this power of quaternions. It's easier
> than you think.

Well, they're still ~50% black magic to me. :-)

> 1) Selections are ordered by atom index, always. Not necessary here.

Since I don't want to hard-code the triangle-definitions into the code
that does the alignment,
I'm using an array to store the atoms that define a plane in the order
that I want:

faceDefs = [ [ {2807:*/1.1} , {2786:*/1.1} , {2813:*/1.1} ] ,  /* face  1 */
             [ {2757:*/1.1} , {2730:*/1.1} , {2751:*/1.1} ] ,  /* face  2 */
             [ {2702:*/1.1} , {2723:*/1.1} , {2729:*/1.1} ] ,  /* face  3 */
            ...
             [ {2842:*/1.1} , {2863:*/1.1} , {2869:*/1.1} ] ]; /* face 20 */

(always defining the corners clockwise from a designated start-point)


And if I then run e.g.:

for ( var i=1 ; i <= 20 ; i++ ) {
    var faceAtoms  = faceDefs[i]
    plane_i = @{"plane_" + i} ;
    line_i  = @{"normal_" + i} ;
    draw @plane_i            FIXED {...@faceatoms[1]} {...@faceatoms[2]}
{...@faceatoms[3]} ;
    draw @line_i  @{">" + i}  FIXED LENGTH 15.0 WIDTH 1.0  PERP $...@plane_i ;
}


I notice that only eight of the 20 vectors point away from the center
of the polyhedron.

And those are exactly the faces for which:

> Var q1 = quaternion(center1, x1, xy1)
> Var q2 = quaternion(center2, x2, xy2)
> rotate selected @{q2/q1}

orientates my planes (from the other file) also that the attached
chains to the outside of the polyhedron.
(though most planes are still rotated by +120° or -120° around the
axis  normal to the triangles center)

I really don't know anymore where should be the bug in my code (or brain).

Is it possible Jmol quietly reorders the reference points in commands like:
Var q1 = quaternion(@faceAtoms[1]}, @faceAtoms[2]}, @faceAtoms[3]} )
or
draw @plane_i            FIXED {...@faceatoms[1]} {...@faceatoms[2]} 
{...@faceatoms[3]} ;


Oliver

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to