# Mapping between different coordinate systems

**URL:** https://discourse.vtk.org/t/mapping-between-different-coordinate-systems/11095
**Category:** Web
**Created:** [March 30, 2023, 9:13am UTC](https://discourse.vtk.org/t/mapping-between-different-coordinate-systems/11095 "2023-03-30T09:13:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lukasz\_Skrzeszewski](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lukasz_skrzeszewski/32/6766_2.png) [@Lukasz\_Skrzeszewski](https://discourse.vtk.org/u/Lukasz_Skrzeszewski)
#### Post date: [March 30, 2023, 9:13am UTC](https://discourse.vtk.org/t/mapping-between-different-coordinate-systems/11095/1 "2023-03-30T09:13:42Z")

</div>

I am trying to hook up to interactor, instance of `vtkRenderWindowInteractor`, callbacks `onMouseMove`, `onMouseWheel` and so on.

I have noticed that the position returned in the event is in a different coordinate system than I have expected. Basically (0,0) is in the bottom-left corner and the width and height are not in pixel space.

I would like to be able to convert the position returned by the event to “standard” canvas coordinates with (0,0) being in the top-left.

Can someone point me in to the right direction? I have been going through the docs for `vtkCoordinate` and `vtkPixelSpaceCallbackMapper` but I dont seem to find what I am looking for.

Additionally I would appreciate if you can point me to some docs/tutorials where I can learn more about vtk.js different coordinate systems and how things work.

Cheers.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [March 31, 2023, 2:06pm UTC](https://discourse.vtk.org/t/mapping-between-different-coordinate-systems/11095/2 "2023-03-31T14:06:51Z")

</div>

The x,y you are getting use the VTK coordinate system. You can just flip Y using the height of the VTK render window assuming you don’t have any devicePixelRatio scaling.

---

<div class="post-metadata">

### Author: ![Lukasz\_Skrzeszewski](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lukasz_skrzeszewski/32/6766_2.png) [@Lukasz\_Skrzeszewski](https://discourse.vtk.org/u/Lukasz_Skrzeszewski)
#### Post date: [March 31, 2023, 2:38pm UTC](https://discourse.vtk.org/t/mapping-between-different-coordinate-systems/11095/3 "2023-03-31T14:38:32Z")

</div>

Perfect! I think that must be it, the `devicePixelRatio`. I didn’t think about it. Thank you.
