You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to get from logical distance to distance measured in data-level values. There are no helper functions for logical->data distance formats, so I tried using following:
physical->logic (screen pixels to fraction of image)
logic (as point offset from zero) ->datapoint.
After double checking just now I realise that this is due to the "physicalToLogicalDistance" only looking up x-dimension. As width/height of the data-level image this gives a wrong logical distance for y. In order to look up y you, obviously, need to compare to the y-dimension.
Hence for a proper lookup I'd suggest separate physicalToLogicalDistanceY and physicalToLogicalDistanceX, or possibly a physicalToLogicalDistancePoints(Point A as vector from origo) returning EITHER a {w:__, h: __} object OR the diagonal. Maybe latter makes more sense.
Also a helper "physicalToDataDistance" actually makes more sense, since here only 1 number reflects both dimensions.
If I'm not entirely off the track here I'd be glad to submit a patch, but need to verify I'm not just wrong because of low blood sugar ;-)
The text was updated successfully, but these errors were encountered:
Hi!
I'm attempting to get from logical distance to distance measured in data-level values. There are no helper functions for logical->data distance formats, so I tried using following:
physical->logic (screen pixels to fraction of image)
logic (as point offset from zero) ->datapoint.
Below are my results:
After double checking just now I realise that this is due to the "physicalToLogicalDistance" only looking up x-dimension. As width/height of the data-level image this gives a wrong logical distance for y. In order to look up y you, obviously, need to compare to the y-dimension.
Hence for a proper lookup I'd suggest separate physicalToLogicalDistanceY and physicalToLogicalDistanceX, or possibly a physicalToLogicalDistancePoints(Point A as vector from origo) returning EITHER a {w:__, h: __} object OR the diagonal. Maybe latter makes more sense.
Also a helper "physicalToDataDistance" actually makes more sense, since here only 1 number reflects both dimensions.
If I'm not entirely off the track here I'd be glad to submit a patch, but need to verify I'm not just wrong because of low blood sugar ;-)
The text was updated successfully, but these errors were encountered: