# Markups distorted when zoom isn't constant along different axes

**URL:** <https://discourse.slicer.org/t/markups-distorted-when-zoom-isnt-constant-along-different-axes/24879>\
**Category:** Development\
**Created:** [August 23, 2022, 8:24am UTC](https://discourse.slicer.org/t/markups-distorted-when-zoom-isnt-constant-along-different-axes/24879 "2022-08-23T08:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [August 23, 2022, 8:24am UTC](https://discourse.slicer.org/t/markups-distorted-when-zoom-isnt-constant-along-different-axes/24879/1 "2022-08-23T08:24:50Z")

</div>

Hi,

It is probably predictable that markups may work incorrectly with 3D view where zoom along different axes is different (in the animation Z-axis zoomed 8 times).  
Does somebody know where to find methods that are responsible for this?  
 ![markups_with_inequal_zoom](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/9/8941fb3e9fdc893585ee2a5fc9956fc881a81354.gif)

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [August 26, 2022, 5:17pm UTC](https://discourse.slicer.org/t/markups-distorted-when-zoom-isnt-constant-along-different-axes/24879/5 "2022-08-26T17:17:41Z")

</div>

I created a draft [pull request](https://github.com/Slicer/Slicer/pull/6515) but I need help to finilize it.

**The idea:**  
As markups orientation is updated everytime camera is modified, the same way compensate scaling. Introduce `vtkSmartPointer<vtkDoubleArray> GlyphScaleArray;` and set `this->GlyphMapper->SetScaleModeToScaleByVectorComponents();`.  
As orientation is updated in `UpdateControlPointGlyphOrientation`, I introduce `UpdateControlPointGlyphScale` function (in `vtkSlicerMarkupsWidgetRepresentation3D.cxx`).

**The problem:**  
Camera scaling is in global coordinate system.  
Markups points always oriented away from the camera: X-to the left, Y-up, Z-away from camera.  
To compensate camera scaling I need to correctly project scaling from global coordinate system to markups point coord system (I don’t have enough knowledge what is `quaternion` and it seems I do that incorrectly).  
 ![markups_with_inequal_zoom_problem](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/f/bf16260c0d5c66e6c5d4f4e8f0d883d288e5bea0.gif)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 26, 2022, 8:49pm UTC](https://discourse.slicer.org/t/markups-distorted-when-zoom-isnt-constant-along-different-axes/24879/6 "2022-08-26T20:49:10Z")

</div>

To avoid parallel discussions, let’s talk about this in the pull request.
