From: <ha...@us...> - 2008-06-30 05:04:37
|
Revision: 9534 http://jmol.svn.sourceforge.net/jmol/?rev=9534&view=rev Author: hansonr Date: 2008-06-29 22:04:35 -0700 (Sun, 29 Jun 2008) Log Message: ----------- version=11.5.43 quaternion, POV-RAY, more. # new feature: quaterion % point4f --- "thetaDirected" -- # point4f is {x, y, z, w} (w ignored), where {x y z} is a # preferred direction. # Returns a point4f angle-Axis equivalent with x, y, z the normal for the quaternion # rotation and w = theta for the rotation, where the normal and theta are chosen # to be directed with a positive dot product between the input {x y z} # vector and the output {x y z}. # bug fix: POV-RAY output of quadrilaterals. # new feature: Ramachandran "r" --- includes third (Z) axis quaternion r difference2 X component equivalent # bug fix: quaternion definition with dot-product check not effective -- removed # bug fix: quaternion construction from matrix error # # new feature: _applet boolean # # new feature: extended quaternion math # # q = quaternion({x y z}, angleDegrees) # q = quaternion(q0, q1, q2,q3) # q = {qx, qy, qz, qw} # # returning component values: # # q.x, q.y, q.z, q.w # # note that the Point4f equivalent stores w LAST, even though it is "q0" # because the Java Quat4f() and Point4f() both do that as well. We're just # being consistent with other Java use. # # Modulus operator for extended information retrieval: # # (q%0) -- q0 (w) # (q%1) -- q1 (x) # (q%2) -- q2 (y) # (q%3) -- q3 (z) # (q%-1) -- the vector {q1, q2, q3} # (q%-2) -- theta # (q%-3) -- equivalent rotational frame X-axis # (q%-4) -- equivalent rotational frame Y-axis # (q%-5) -- equivalent rotational frame Z-axis # (q%{x y z}) -- rotational transform of a point or vector based on a quaternion # # thus, for example, (q%{1 0 0}) is the same as (q%-3) # # (!q) -- quaternion inverse # # # Quaternion right division (difference "dq"): # # q2 / q1 = q2 * (!q1) # # Quaternion left division (relative difference n): # # q2 \ q1 = (!q1) * q2 # # Examples: # # q = quaternion({1 1 1},120) # print "" + (q%{1 0 0}) + " " + (q%{0 1 0}) + " " + (q%{0 0 1}) # # {0 1.0 0} {0 0 1.0} {1.0 0 0} # # new feature: Numerical left division (integer divide) # # 3.6 \ 2 = 1 # 3.6 \ 1.3 = 2 # # new feature: sqrt(x) # # bug fix: load trajectory for cases with different atom counts. # # experimental: "straightness" defined as 1 - 2 * acos(normal(dq[i]%-1) dot normal(dq[i+1])) / PI # giving a measure proportional to the difference in local helical axis angle # and ranging from -1 (opposite direction) to 1 (same direction) for proteins # -- a work in progress. See # # load =1d66 # calculate straightness;color straightness # Modified Paths: -------------- trunk/Jmol/src/org/jmol/util/Quaternion.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/util/Quaternion.java =================================================================== --- trunk/Jmol/src/org/jmol/util/Quaternion.java 2008-06-30 04:34:03 UTC (rev 9533) +++ trunk/Jmol/src/org/jmol/util/Quaternion.java 2008-06-30 05:04:35 UTC (rev 9534) @@ -285,6 +285,17 @@ return (float) (Math.acos(q0) * 2 * 180/Math.PI); } + public void getThetaDirected(Point4f axisAngle) { + //fills in .w; + float theta = getTheta(); + Vector3f v = getNormal(); + if (axisAngle.x * q1 + axisAngle.y * q2 + axisAngle.z * q3 < 0) { + v.scale(-1); + theta = -theta; + } + axisAngle.set(v.x, v.y, v.z, theta); + } + public Point4f toPoint4f() { fixQ(); return new Point4f(q1, q2, q3, q0); Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-06-30 04:34:03 UTC (rev 9533) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-06-30 05:04:35 UTC (rev 9534) @@ -12929,6 +12929,11 @@ Point4f q = (Point4f) x1.value; if (x2.tok == Token.point3f) return addX((new Quaternion(q)).transform((Point3f) x2.value)); + if (x2.tok == Token.point4f) { + Point4f v4 = new Point4f((Point4f) x2.value); + (new Quaternion(q)).getThetaDirected(v4); + return addX(v4); + } switch (n) { case 0: return addX(q.w); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-06-30 04:34:03 UTC (rev 9533) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-06-30 05:04:35 UTC (rev 9534) @@ -1,8 +1,16 @@ # Developers: to add a description of changes you have made, # add it on line starting with # below the "version=..." line -version=11.5.43_dev +version=11.5.43 +# new feature: quaterion % point4f --- "thetaDirected" -- +# point4f is {x, y, z, w} (w ignored), where {x y z} is a +# preferred direction. +# Returns a point4f angle-Axis equivalent with x, y, z the normal for the quaternion +# rotation and w = theta for the rotation, where the normal and theta are chosen +# to be directed with a positive dot product between the input {x y z} +# vector and the output {x y z}. + # bug fix: POV-RAY output of quadrilaterals. # new feature: Ramachandran "r" --- includes third (Z) axis quaternion r difference2 X component equivalent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |