/* 
	Flake.java

	[ more java @ mlab - 10-17.1.2000 - juhuu@katastro.fi ]
*/

public class Flake
{
	double	dX_coord;
	double	dY_coord;

	double	dX_sine;
	double	dY_sine;

	double	dCounter;

	// Flake constructor :	x - x coordinate of the flake
	//						y - y coordinate of the flake
	public Flake(double x, double y)
	{
		dX_coord	= x;
		dY_coord	= y;

		// init sine multipliers & counter
		dX_sine		= Math.random();
		dY_sine		= Math.random();
		dCounter	= Math.random();
	}

	public int getX()
	{
		// add sine counter
		dCounter += dX_sine / 50;		// add sine value to the x coordinate
		dX_coord += (0.5 + dX_sine) * Math.sin((dCounter + dX_sine * 4));
		return (int) dX_coord;
	}

	public int getY()
	{
		// increment y coordinate		dY_coord += 0.5 + dY_sine * 2.0;		// add sine counter
		dCounter += dY_sine / 50;							// add sine value to the y coordinate
		dY_coord += (0.1 + dY_sine) * Math.sin((dCounter + dY_sine * 6) / 20);

		return (int) dY_coord;
	}
}
