<commit_before>package infovis.embed;

import static infovis.VecUtil.*;
import infovis.embed.pol.Interpolator;

import java.awt.geom.Point2D;

/**
 * A simple circular embedder.
 * 
 * @author Joschi <<EMAIL>>
 */
public class CircularEmbedder extends AbstractEmbedder {

  /**
   * The weighter.
   */
  private final Weighter weighter;

  /**
   * Creates a circular embedder.
   * 
   * @param weighter The weighter.
   * @param drawer The drawer.
   */
  public CircularEmbedder(final Weighter weighter, final NodeDrawer drawer) {
    super(drawer);
    this.weighter = weighter;
  }

  @Override
  protected void step() {
    final SpringNode ref = weighter.getReferenceNode();
    if(weighter.hasChanged()) {
      Point2D refP;
      if(ref != null) {
        refP = ref.getPos();
      } else {
        refP = null;
      }
      for(final SpringNode n : weighter.nodes()) {
        final Point2D pos = weighter.getDefaultPosition(n);
        if(n == ref) {
          continue;
        }
        Point2D dest;
        if(refP == null) {
          dest = pos;
        } else {
          if(!weighter.hasWeight(n, ref)) {
            dest = new Point2D.Double();
          } else {
            final double w = weighter.weight(n, ref);
            dest = addVec(setLength(subVec(pos, refP), w), refP);
          }
        }
        n.startAnimationTo(dest, Interpolator.INTERPOLATOR, Interpolator.DURATION);
      }
    }
    for(final SpringNode n : weighter.nodes()) {
      n.animate();
    }
  }

  @Override
  protected boolean doesDrag() {
    return false;
  }

}<commit_msg>correct node position after multiple selections solves #16<commit_after>package infovis.embed;

import static infovis.VecUtil.*;
import infovis.embed.pol.Interpolator;

import java.awt.geom.Point2D;

/**
 * A simple circular embedder.
 * 
 * @author Joschi <<EMAIL>>
 */
public class CircularEmbedder extends AbstractEmbedder {

  /**
   * The weighter.
   */
  private final Weighter weighter;

  /**
   * Creates a circular embedder.
   * 
   * @param weighter The weighter.
   * @param drawer The drawer.
   */
  public CircularEmbedder(final Weighter weighter, final NodeDrawer drawer) {
    super(drawer);
    this.weighter = weighter;
  }

  @Override
  protected void step() {
    final SpringNode ref = weighter.getReferenceNode();
    if(weighter.hasChanged()) {
      Point2D diff;
      Point2D refP;
      if(ref != null) {
        final Point2D orig = weighter.getDefaultPosition(ref);
        refP = ref.getPos();
        diff = subVec(refP, orig);
      } else {
        refP = null;
        diff = null;
      }
      for(final SpringNode n : weighter.nodes()) {
        final Point2D pos = weighter.getDefaultPosition(n);
        if(n == ref) {
          continue;
        }
        Point2D dest;
        if(refP == null) {
          dest = pos;
        } else {
          if(!weighter.hasWeight(n, ref)) {
            dest = new Point2D.Double();
          } else {
            final double w = weighter.weight(n, ref);
            dest = addVec(setLength(subVec(addVec(pos, diff), refP), w), refP);
          }
        }
        n.startAnimationTo(dest, Interpolator.INTERPOLATOR, Interpolator.DURATION);
      }
    }
    for(final SpringNode n : weighter.nodes()) {
      n.animate();
    }
  }

  @Override
  protected boolean doesDrag() {
    return false;
  }

}
{'fraction_non_alphanumeric': 0.11707172495554238, 'fraction_numerical': 0.004149377593360996, 'mean_word_length': 2.196022727272727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4885801', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1060, 'n_words': 249}