How do I transform value into screen coordinates

Click For Summary
SUMMARY

This discussion focuses on transforming x, y values into screen coordinates within a defined pixel space. The origin is set at (40, 495), with the usable display area ranging from X=40 to X=750 and Y=495 to Y=55. A linear transformation is required to map the coordinate system accurately, with specific equations provided to calculate the transformation coefficients A and B for both x and y axes. The transformation ensures that the screen representation maintains proportionality without distortion.

PREREQUISITES
  • Understanding of linear transformations in coordinate systems
  • Familiarity with pixel-based graphics and screen coordinates
  • Basic algebra for solving equations
  • Knowledge of time and distance representation in graphical formats
NEXT STEPS
  • Research "Linear transformations in computer graphics" for deeper insights
  • Explore "Coordinate mapping algorithms" for various applications
  • Learn about "Graphical User Interface (GUI) coordinate systems" for practical implementations
  • Investigate "Pixel density and resolution effects on graphical representation" for optimization
USEFUL FOR

Graphic designers, software developers, and data visualization specialists who need to accurately map data points to screen coordinates in pixel-based applications.

tonytj
Messages
1
Reaction score
0
How do I transform my x, y values into screen coordinates system

All values is in pixels
In my coordinate system origo is located in (40,495)
The display area that I can use is from X=40 to x=750 and
from y=495 to y=55
When you go down in the coordinate system the y value is increasing and when
you go to the right
the x value is increasing.
The y-axis is showing time from 12:00 to 20:00 and the x-axis is distance
showing from 0 to 800

So I can have values like
[13:10, 190]
[13:40, 240]
[14:25, 390]
[15:10, 431]
[16:10, 554]
[17:10, 643]
[18:10, 740]

I just wonder if someone has a algorithm that I can use to transform my
values into this coordinate system.


//Tony
 
Mathematics news on Phys.org
I assume you want a linear transformation (so that one part of the screen isn not "squeezed" or "stretched" more than another). You want x= 0 to correspond to screen coordinate, h= 40 and x= 800 to correspond to h= 750. A linear transformation is of the form h= Ax+ B. x=0, h= 40 tells you that 40= A(0)= B so B= 40. x= 800, h= 750 gives 750= 800A+ B= 800A+ 40. Solve that for A.

Similarly, in terms of "y" and vertical coordinates, you want v= Ay+ B. y= 12, at the bottom, corresponds to v= 495 so 495= 12A+ B. y= 20, at the top, corresponds to v= 55 so 55= 20A+ B. You can eliminate B from that by subtracting the two equations: 495- 55= 440= 8A. Solve that for A, the put that into either equation to solve for B.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 40 ·
2
Replies
40
Views
6K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K