Getting translated coordinates?

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Getting translated coordinates?

Postby asimmittal » Sun Feb 06, 2011 3:58 pm

Hey I have a Region that bounds a part of my canvas. The canvas draws a rectangle from x1,y1 to x2,y2. Before drawing the canvas is translated by a certain amount. This causes the rectangle to get translated as well.

is it possible to calculate the position of (x1,y1) after a translation of (dx,dy) is applied to it?
asimmittal
Developer
Developer
 
Posts: 45
Joined: Wed Jan 19, 2011 8:35 am

Top

Re: Getting translated coordinates?

Postby asimmittal » Sun Feb 06, 2011 8:06 pm

i think the new values should be x1+dx, y1+dy... any one confirm that?
asimmittal
Developer
Developer
 
Posts: 45
Joined: Wed Jan 19, 2011 8:35 am

Re: Getting translated coordinates?

Postby roopa » Mon Oct 17, 2011 12:58 pm

I think you can try with The Bresenham line algorithm since it is an algorithm which determines which points in an n-dimensional raster should be plotted in order to form a close approximation to a straight line between two given points. It is commonly used to draw lines on a computer screen, as it uses only integer addition, subtraction and bit shifting, all of which are very cheap operations in standard computer architectures. It is one of the earliest algorithms developed in the field of computer graphics. A minor extension to the original algorithm also deals with drawing circles.
roopa
Developer
Developer
 
Posts: 27
Joined: Wed Sep 14, 2011 6:46 am

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests