Having trouble drawing an object relative to anothers location.

On the navigation app i'm developing the view is centred in the middle of the screen on an arrow that rotates according to your heading, hwoever i have a

feature where you can pick a saved waypoint and centre the screen on that, I am trying to then draw the arrow relative to that waypoint (i.e still focused

on the users location but offset by the fact the waypoint is now in the centre of the screen. I have this code where the arrows position is supposed to

achieve what i desire but unfortunately it seems to be offset for some reason:

var x = gw/2;

var y = gh/2; //(device width and height divided by two.

if (selectedWaypoint != null){

var scale = (zoom / 10) / 2; //(zoom = 250 for example)

var CurrentX = MyPoint[1]; //(MyPoint equals the users current location)

var CurrentY = MyPoint[0];

var package = [startLat,startLon,CurrentX,CurrentY]; (Lat and Lon are coords of waypoint)

System.println(package);

var Dist = distance(package);

x = (gw/2) + (Dist * scale);

y = (gh/2) + (Dist * scale);

x = x.toNumber();

y = y.toNumber();

System.println(x + "," + y);}

var CenterPoint = [x,y];

dc.setColor(0xFFFFFF, Graphics.COLOR_TRANSPARENT);

dc.fillPolygon(generateHandCoordinates(CenterPoint, minuteHandAngle, 20, 0, 9));

dc.setColor(0x000000, Graphics.COLOR_TRANSPARENT);

dc.fillPolygon(generateHandCoordinates(CenterPoint, minuteHandAngle, 20, 0, 9));

}

  As you can see, the arrow moves all the way to the bottom when a waypoint is

picked but the other way round is fine