Hi all I am trying to understand the values that are returned to me when I use ARKit's projectPoint
function.
My goal is to take a point, p = (x,y,z)
, where all values in the tuple are in range [-1, 1]
and convert it to p' = (x',y')
where all values in the pair are in range [0,1]
, i.e. project from world space onto screen/image space.
I know that arframe.camera.imageResolution = (1920.0, 1440.0)
, and
I know that my screen size is (390.0 ,844.0)
So, when I use the function I write: arframe.camera.projectPoint(point: p, orientation: .portrait, viewportSize: arframe.camera.imageResolution
This returns (x, y)
but it is the case that x > 1440.0
and y > 1920.0
sometimes.
Furthermore, sometimes, x
and y
are negative values.
I am confused about how the function returns values that are greater than the viewportsize we gave. I am also confused by why the values themselves are negative.
The documentation provided by apple states the function 'returns the projection of a point from the 3D world space detected by ARKit into the 2D space of a view rendering the scene.'
What does '2D space of a view rendering the scene' mean more explicitly?