package speiger.src.coreengine.math;

import speiger.src.coreengine.math.bits.BitUtil;
import speiger.src.coreengine.math.vector.ints.Vec2i;

public class ShapeUtil {
	public static boolean isInCircle(int position, int radius, int testX, int testZ) {
		return isInCircle(BitUtil.shortKey(position), BitUtil.shortValue(position), radius, testX, testZ);
	}
	
	public static boolean isInCircle(Vec2i position, int radius, int testX, int testZ) {
		return isInCircle(position.x(), position.y(), radius, testX, testZ);
	}
	
	public static boolean isInCircle(int posX, int posZ, int radius, int testX, int testZ) {
		posX -= testX;
		posZ -= testZ;
		return (posX * posX) + (posZ * posZ) < radius * radius;
	}
}
