
-----------------------------------
lain
Mon May 16, 2005 5:36 pm

Chaging around mehtods
-----------------------------------
i have two mehtods (see below) that i need to convert in to two new methods; int findX(float lat, float long) and int findY(float lat, float long). Any help whould be gr8.


private static float northPoalX = (float)297, northPoalY = (float)4.6496;
private static float centerX = (float)300, centerY = (float)-88;
private static float mNum = (float)7.1117;

private float distance(float x1, float y1, float x2, float y2)
{
	return (float)Math.sqrt((float)((float)Math.pow((float)((float)x2-x1),2) + (float)Math.pow((float)((float)y2-y1),2)));
}
	
private float distanceNorth(int x, int y)
{
	float dist = (float)Math.sqrt((float)((float)Math.pow((float)((float)x-northPoalX),2) + (float)Math.pow((float)((float)y-northPoalY),2)));
	return dist;
}

private float findLat(int x, int y)
{
	if (y > 217)
		return (float)90-(float)(distanceNorth((x + (int)(0.2*(northPoalX-x))), (y + (int)(0.05*(217-y)))) / mNum);
	else
		return (float)90-(float)(distanceNorth((x + (int)(0.25*(northPoalX-x))), (y - (int)(-0.15*(217-y)))) / mNum);
}
	
private float findLong(int x, int y)
{		
	float k = 0;
	float d = 0;
			
	d = (float)(-0.16*(217-y));
			
	float midX = (float)391.88;
	float midY = (float)-88;
			
	float A = distance(centerX,centerY,(float)x+k,(float)y+d);
	float B = distance(centerX,centerY,midX,midY);
	float C = distance((float)x+k,(float)y+d,midX,midY);
			
	float log = (float)Math.acos((float)((Math.pow(A,2) + Math.pow(B,2) - Math.pow(C,2))/(2*A*B))) * (float)(180/Math.PI) + (float)9;
	log += 0.06*(centerX-x);
	log *= -1;
			
	return log;
}


-----------------------------------
Martin
Mon May 16, 2005 5:49 pm


-----------------------------------


