<commit_before>package io.measures.passage.geometry;

/**
 * Created by d on 4/21/14.
 */
public class ImagePackedCircle {
}<commit_msg>tweenable circle for image circle packing<commit_after>package io.measures.passage.geometry;

import io.measures.passage.Integrator;

import java.awt.Color;
import java.util.List;

import static io.measures.passage.Sketch.*;

/**
 * ImagePackedCircle
 * @author <NAME>
 */
public class ImagePackedCircle {

    private final IntegratorPoint2D center;
    private final Integrator radius;
    private Integrator r,g,b;

    public ImagePackedCircle(float x, float y, float radius, Color c) {
        this.center = new IntegratorPoint2D(x,y);
        this.radius = new Integrator(radius);
        this.r = new Integrator(c.getRed());
        this.g = new Integrator(c.getGreen());
        this.b = new Integrator(c.getBlue());
    }

    public float getRadius() {
        return radius.get();
    }

    public Projectable2D getCenter() {
        return center;
    }

    public Projectable2D getTargetCenter() {
        return center.target();
    }

    public float getTargetRadius() {
        return radius.target();
    }

    public void targetRadius(float radius) {
        this.radius.target(radius);
    }

    public void tweenTo(Projectable2D p) {
        this.center.tweenTo(p);
    }

    public void targetColor(Color c) {
        r.target(c.getRed());
        g.target(c.getGreen());
        b.target(c.getBlue());
    }

    public Color getColor() {
        return new Color(round(r.get()), round(g.get()), round(b.get()));
    }

    public void update() {
        center.update();
        radius.update();
        r.update();
        g.update();
        b.update();
    }

    public boolean collidesWith(List<ImagePackedCircle> env) {
        for(ImagePackedCircle c : env) {
            if(dist(c.center.target(), center.target()) < (radius.target() + c.radius.target())) {
                return true;
            }
        }
        return false;
    }
}
{'fraction_non_alphanumeric': 0.12816691505216096, 'fraction_numerical': 0.004967709885742673, 'mean_word_length': 2.4486301369863015, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '3956180', 'n_tokens_mistral': 631, 'n_tokens_neox': 609, 'n_words': 135}