package com.torn.enemy;

import android.util.FloatMath;

/* 制御情報を持つAtom */
public class MovableAtom {

	private Atom atom;
	private float r; /* 誤差をなくすために固定値を保持 */
	private float alpha;
	public int t;

	public MovableAtom(Atom atom) {
		this.atom = atom;
		r = FloatMath.sqrt(atom.x * atom.x + atom.y * atom.y);
		t = 1;
		
		if (atom.y >= 0) {
			alpha = (float)Math.acos(atom.x / r);
		} else {
			alpha = - (float)Math.acos(atom.x / r);
		}
	}
	public Atom getAtom() {
		return atom;
	}
	public float getX() {
		return atom.x;
	}
	public float getY() {
		return atom.y;
	}
	public float getR() {
		return r;
	}
	public void setAtom(float x, float y, boolean update) {
		if (update) {
			updateParam();
		}
		atom.x = x;
		atom.y = y;
	}
	
	private void updateParam() {
	}
	public float getAlpha() {
		return alpha;
	}
}
