The following is the code that I used to draw a circle by getting the touch position from the screen and calculating the radius from the origin to the touch point and passing to the renderer to draw the circle.
public boolean onTouchEvent(MotionEvent e) {
float ex=0, ey=0;
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN:
ex = (e.getX()/(getWidth()/2))-1;
ey = 1-(e.getY()/(getHeight()/2));
dist = (float) (Math.sqrt(Math.pow(ex, 2)+Math.pow(ey, 2)));
}
mRenderer.radius = dist;
requestRender();
return true;
}
But I am getting the circle drawn at a radius lesser compared to the touch point I give for radius. i.e. the output doesn't coincide with the touch event. I want to know is there any Touch Scale Factor for arriving the touch posistion and how to employ it in the code ?