Computer Science, asked by utsavanand59, 1 year ago

Given a window with center (25,99) and a 322mm x 199mm screen with resolution 1024x1024, map the world point (38,84) into screen coordinates, where the viewport is (10,10)-(883,492), assuming 1mm (1 unit) in the world is 4mm on the screen.

Answers

Answered by kvnmurty
2

This is part of computer graphics. Display of graphs, diagrams etc involves mapping of coordinates from the real world (window space or problem space) onto a viewport (displayed area) on the total screen area.


Scaling factor Sx along x or y

= viewport width/window width

= 4 mm/1mm as given

Sx = 4 = Sy


Screen coordinates: (0,0) to (1023, 1023).

So width = 1024 pixels.

Height = 1024 pixels.


Viewport = (10,10) to (883,492).

So Width = 874 pixels.

Height = 483 pixels.


Window is 1/4 th size of the screen. So width = height = 1024/4 = 256.


Window center ie. (128,128) th point is given as (25,99).

Window origin = (-103, -29).


Given Point in the world to map = (38,84).


Viewport x - viewport origin

= Sx * (window x - origin)

= 4 * (38 +103) = 564

Viewport x = 574.


Similarly

Viewport y - viewport origin

= Sy * (window y - origin)

= 4 * (84 +29) = 532


Coordinates: (574, 532) .. ANSwer

Similar questions