--- android/FriendRadar/src/dk/thoerup/friendradar/RadarView.java 2009/08/15 10:05:48 267 +++ android/FriendRadar/src/dk/thoerup/friendradar/RadarView.java 2009/08/17 07:49:49 268 @@ -13,7 +13,10 @@ import android.view.SurfaceView; //public class RadarView extends View { -public class RadarView extends SurfaceView implements SurfaceHolder.Callback, Runnable { +public class RadarView extends SurfaceView implements SurfaceHolder.Callback, Runnable { + + static final float VERT_CORECTION = 5; + int angle = 0; Paint p = new Paint(); Paint p2 = new Paint(); @@ -106,14 +109,14 @@ canvas.drawText(distanceText3, (width-textWidth3)/2, vcenter+115+6, p3); canvas.drawText(distanceText4, (width-textWidth4)/2, vcenter+150+6, p3); - final float correction = 5; + final float lineLength = 150; angle -= 6; double base = (Math.sin(angle/360.0)*lineLength) + (float)hcenter; double height = (Math.cos(angle/360.0)*lineLength) + (float)vcenter; - height += correction; + height += VERT_CORECTION; canvas.drawLine(hcenter, vcenter, (float)base, (float)height, p2); @@ -292,12 +295,15 @@ double hypotenuse = (distance / (distanceBase*4.0)) * 150.0; double vertCathesis = Math.sin(bearingRad)*hypotenuse; double horzCathesis = Math.cos(bearingRad)*hypotenuse; + //vertCathesis *= -1.0; vertCathesis += vcenter; horzCathesis += hcenter; + vertCathesis += VERT_CORECTION; + canvas.drawCircle( (float)horzCathesis, (float)vertCathesis, 3, p3); }