Expected purpose of 'PMAP':
No graphic plotting bias between the different mappings:
Example with 'ScreenRes' mapping, then 'View' mapping, then 'Window Screen' mapping:
ScreenRes 500, 500 '' 'ScreenRes' mapping
Pset (10, 10) '' point #1
Pset (55, 55) '' point #2
Pset (100, 100) '' point #3
View (10, 10) - (100, 100) '' 'View' mapping
Pset (0, 0) '' point superimposed well at point #1
Pset (45, 45) '' point superimposed well at point #2
Pset (90, 90) '' point superimposed well at point #3
Window Screen (0, 0) - (9, 9) '' 'Window Screen' mapping
Pset (0, 0) '' point superimposed well at point #1
Pset (4.5, 4.5) '' point superimposed well at point #2
Pset (9, 9) '' point superimposed well at point #3
Sleep
But there is a bias (IMHO) for the 'Pmap' function returns, that adds for example +1 pixel offset to the max value for the 'View' mapping:.
Maybe confusion between number of pixels (100 - 10 + 1 = 91) of the viewport, and number of intervals between pixels (100 - 10 = 90).
Example:
ScreenRes 500, 500
View (10, 10) - (100, 100)
Window Screen (0, 0) - (9, 9)
Print "Logical x=0, Physical x="; PMap(0, 0) '' Expected 0, result: 0 => OK
Print "Logical y=0, Physical y="; PMap(0, 1) '' Expected 0, result: 0 => OK
Print "Logical x=4.5, Physical x="; PMap(4.5, 0) '' Expected 45, result: 45.5 => NOK
Print "Logical y=4.5, Physical y="; PMap(4.5, 1) '' Expected 45, result: 45.5 => NOK
Print "Logical x=9, Physical x="; PMap(9, 0) '' Expected 90, result: 91 => NOK
Print "Logical y=9, Physical y="; PMap(9, 1) '' Expected 90, result: 91 => NOK
Print "Physical x=0, Logical x="; PMap(0, 2) '' Expected 0, result: 0 => OK
Print "Physical y=0, Logical y="; PMap(0, 3) '' Expected 0, result: 0 => NOK
Print "Physical x=45, Logical x="; PMap(45, 2) '' Expected 4.5, result: 4.45055 => NOK
Print "Physical y=45, Logical y="; PMap(45, 3) '' Expected 4.5, result: 4.45055 => NOK
Print "Physical x=45.5, Logical x="; PMap(45.5, 2) '' Expected 9/90*45.5, result: 4.5 => NOK
Print "Physical y=45.5, Logical y="; PMap(45.5, 3) '' Expected 9/90*45.5, result: 4.5 => NOK
Print "Physical x=90, Logical x="; PMap(90, 2) '' Expected 9, result: 8.901099 => NOK
Print "Physical y=90, Logical y="; PMap(90, 3) '' Expected 9, result: 8.901099 => NOK
Print "Physical x=91, Logical x="; PMap(91, 2) '' Expected 9/90*91, result: 9 => NOK
Print "Physical y=91, Logical y="; PMap(91, 3) '' Expected 9/90*91, result: 9 => NOK
Sleep
See also the 'PMAP documentation' example:
ScreenRes 640, 480
Window Screen (0, 0)-(100, 100)
Print "Logical x=50, Physical x="; PMap(50, 0) '' 320 => NOK IMHO: 639/2 expected instead
Print "Logical y=50, Physical y="; PMap(50, 1) '' 240 => NOK IMHO: 479/2 expected instead
Print "Physical x=160, Logical x="; PMap(160, 2) '' 25 => NOK IMHO: 100/639*160 expected instead
Print "Physical y=60, Logical y="; PMap(60, 3) '' 12.5 => NOK IMHO: 100/479*60 expected instead
Sleep
SARG noted an inconsistency in gfxlib between the C code for calculating coordinates for PSET and that for PMAP calculations (expression 'context->view_w/h - 1' for the former, and only 'context->view_w/h' for the second).
See more details in the dedicated topic of the forum ('PMap Does not work correctly?' in General forum):
https://www.freebasic.net/forum/viewtopic.php?t=31991