Android screen coordinate system : how to set (0,0) at the bottom left side of android screen as first quadrent of xy plane
how to set the screen coordinate system of android screen as first Quadrant of the XY plane ,iwant the (0,0) position to be at bottom left , and i wanna know if i can use the trignometric equation on android screen as Android XY plane is not like the Xy plane
translate() to slide the canvas down so 0,0 is at the bottom. Now the top of the screen would be a negative number, so call
scale() to flip it around. Now 0,0 is still at the bottom, and the top of the screen is a positive number.
I'm working with information from this answer and its comments. Use something like:
canvas.save(); // need to restore after drawing canvas.translate(0, canvas.getHeight()); // reset where 0,0 is located canvas.scale(1, -1); // invert ... // draw to canvas here canvas.restore(); // restore to normal
And yes, you can use normal 2D trigonometric functions with the XY coords. You can do it even if they're not translated, you just have to think it through more carefully.
5 Android screen coordinate system : how to set (0,0) at the bottom left side of android screen as first quadrent of xy plane Mar 7 using FFMPEG in android
I don't know that you're going to have much luck changing where (0,0) is located, but you could set a constant that accounts for such. myY = y minus screenHeight so (x, myY) adjusts y to the bottom of the screen and works from there +/-.
In the case of a full-screen viewport from, say, (0,0) to (480,320) (e.g., landscape mode on a Hero), the bottom-left corner of the front side would map to the bottom-left corner of our screen, and the top-right corner of the front side would map to the top-left corner of our screen. OpenGL will perform the stretching automatically for us.
look up canvas.scale(xs,ys,xp,yp)
xp and yp are the new coordinates that you set for your (0,0) point.
The first two parameters specify the left and right coordinate of the frustum and the third and fourth parameter specify the bottom and top part of the frustum. With those 4 points we've defined the size of the near and far planes and the 5th and 6th parameter then define the distances between the near and far plane.
Addendum: Early graphics were done on vector monitors, just one step up from the oscilloscopes seen in the lab where (0,0) would be in the exact middle of the screen, subject to some knob turning to set X/Y scale, X/Y offset, and possibly X/Y inversion.
Nevertheless, there is a catch here. The graph paper from eighth grade ("Cartesian coordinate system") placed (0,0) in the center with the y-axis pointing up and the x-axis pointing to the right (in the positive direction, negative down and to the left). The coordinate system for pixels in a computer window, however, is reversed along the y-axis.
Android Open Source Project sensors. The Android Open Source Project (AOSP) provides three software-based motion sensors: a gravity sensor, a linear acceleration sensor, and a rotation vector sensor. These sensors were updated in Android 4.0 and now use a device's gyroscope (in addition to other sensors) to improve stability and performance.