>> I may send you some very small code snippets and ask you to comment on
>> them.

ChemFrameRenderer.java calculates the minMagnitude and maxMagnitude for
all the AtomVectors in molecules. Then magnitudeRange is calculated. These
values are passed as parameters to the constructor for AtomVectorShape:
 ... new AtomVectorShape(atom, settings, minMagnitude, magnitudeRange)

When the AtomVector is rendered these values are used to calculate a scale.

AtomVectorShape.java
--------------------
  public void render(Graphics g) {
    if (settings.getShowVectors()) {
      if (atom.getVector() != null) {
        double magnitude = atom.getVector().distance(zeroPoint);
        double scaling = (magnitude - minMagnitude) / magnitudeRange
                           + 0.5;
        ArrowLine al = new ArrowLine(g, atom.getScreenPosition().x,
                         atom.getScreenPosition().y,
                         atom.getScreenVector().x,
                         atom.getScreenVector().y, false, true, scaling);
      }
    }
  }

ArrowLine.java
--------------
  double ly = scaling * arrowHeadSize * arrowHeadRadius;
  double lx = lengthOffset + directionSign * 2.0 * scaling * arrowHeadSize;
  double rx = lx;
  double ry = -ly;
  double mx = lengthOffset + directionSign * 1.5 * scaling * arrowHeadSize;


My interpretation of what is going on is as follows:
 - the normalized scaling is being applied to adjust the arrowhead size in
proportion with the magnitude of the vector
 - the vector whose length is minMagnitude will have scaling == 0.5
 - the vector whose length is maxMagnitude will have scaling == 1.5

Q: Please confirm that I am interpreting this correctly.




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to