boolean transform(Dipole dipole) {
    Vector3f vector = dipole.vector;
    offset.set(vector);
    if (dipole.center == null) { 
      offset.scale(dipole.offsetAngstroms / dipole.dipoleValue);
      if (dipoleVectorScale < 0)
        offset.add(vector);
    points[cylinderBase].set(dipole.origin);
    points[cylinderBase].add(offset);
    } else {
      offset.scale(-0.5f * dipoleVectorScale);
      points[cylinderBase].set(dipole.center);
      points[cylinderBase].add(offset);    
      if (dipole.offsetAngstroms != 0) { 
        offset.set(vector);
        offset.scale(dipole.offsetAngstroms / dipole.dipoleValue);
        points[cylinderBase].add(offset);       
      }
    }
    
    points[cross].scaleAdd(dipoleVectorScale * crossOffset, vector,
        points[cylinderBase]);
    points[crossEnd].scaleAdd(dipoleVectorScale * (crossOffset + crossWidth),
        vector, points[cylinderBase]);
    points[center]
        .scaleAdd(dipoleVectorScale / 2, vector, points[cylinderBase]);
    points[arrowHeadBase].scaleAdd(dipoleVectorScale * arrowHeadOffset, vector,
        points[cylinderBase]);
    points[arrowHeadTip].scaleAdd(dipoleVectorScale, vector,
        points[cylinderBase]);

    if (dipole.atoms[0] != null) {
      if (frame.bsHidden.get(dipole.atoms[0].atomIndex))
        return false;
      offset.set(points[center]);
      offset.cross(offset, vector);
      if (offset.length() == 0) {
        offset.set(points[center].x + 0.2345f, points[center].y + 0.1234f,
            points[center].z + 0.4321f);
        offset.cross(offset, vector);
      }
      offset.scale(dipole.offsetSide / offset.length());
      for (int i = 0; i < 6; i++)
        points[i].add(offset);
    }
    for (int i = 0; i < 6; i++)
      viewer.transformPoint(points[i], screens[i]);
    viewer.transformPoint(points[cross], cross0);
    viewer.transformPoint(points[crossEnd], cross1);
    short mad = dipole.mad;
    diameter = viewer.scaleToScreen(screens[center].z, mad);
    headWidthPixels = (int) (diameter * arrowHeadWidthFactor);
    if (headWidthPixels < diameter + 10)
      headWidthPixels = diameter + 10;
    crossWidthPixels = headWidthPixels;
    return true;
  }