# Coordinate system transformation

**URL:** https://discourse.vtk.org/t/coordinate-system-transformation/13848
**Category:** Support
**Tags:** python
**Created:** [May 6, 2024, 1:26pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848 "2024-05-06T13:26:34Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Mordrago](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mordrago/32/8974_2.png) [@Mordrago](https://discourse.vtk.org/u/Mordrago)
#### Post date: [May 6, 2024, 1:26pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/1 "2024-05-06T13:26:34Z")

</div>

Hello!  
I want to create 3-2-1 alignment based on pane-line-point. I created plane, line and point based on user select point(best-fit algorithm). Now i want to transform my whole coordinate system, i tried to use vtktransformation but it only rotated my scene, without changing coordinate system. I also using vtkCameraOrientationWidget, so i also want to change this widget due to my calculation

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 6, 2024, 2:36pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/2 "2024-05-06T14:36:03Z")

</div>

Hello,

I believe you need to be more specific. What do you mean by “coordinate system transformation”? Do you mean from Cartesian to polar? Do you mean from local to global? Do you mean from Mercator to UTM? Do you mean from screen to model space?.

best,

PC

---

<div class="post-metadata">

### Author: ![Mordrago](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mordrago/32/8974_2.png) [@Mordrago](https://discourse.vtk.org/u/Mordrago)
#### Post date: [May 6, 2024, 7:29pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/3 "2024-05-06T19:29:19Z")

</div>

Ye, you are right. I want to turn my local coordiante system created by 3-2-1 into a global coordinate system.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 8, 2024, 1:05pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/4 "2024-05-08T13:05:00Z")

</div>

What is 3-2-1?

---

<div class="post-metadata">

### Author: ![Mordrago](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mordrago/32/8974_2.png) [@Mordrago](https://discourse.vtk.org/u/Mordrago)
#### Post date: [May 8, 2024, 1:36pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/5 "2024-05-08T13:36:31Z")

</div>

3-2-1 is Plane Line Point. This method is require two direction and one point to lock all 6 degree of freedom. That is, we simply create a local coordinate system based on our actor using a plane, line and point and then transfer the global coordinate system to the part/actor coordinate system.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 8, 2024, 1:50pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/6 "2024-05-08T13:50:58Z")

</div>

I see. What have you done so far in terms of code?

---

<div class="post-metadata">

### Author: ![Mordrago](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mordrago/32/8974_2.png) [@Mordrago](https://discourse.vtk.org/u/Mordrago)
#### Post date: [May 8, 2024, 2:10pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/7 "2024-05-08T14:10:44Z")

</div>

In short, I have a mini program in QT where it defines:  
`self.cam_orient_widget = vtkCameraOrientationWidget()`

By clicking points I create:  
Plane, Line and Point.  
From these primitives using normals, direction, etc., I create a vtkTransform. After using the created transformation, my actor moves, but the global coordinate system remains the same. Now I would like it not the actor(s) on the renderer to be moved and rotated, I want the global coordinate system to change.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 8, 2024, 6:26pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/8 "2024-05-08T18:26:59Z")

</div>

The global coordinate system, as its name suggests, doesn’t have a reference or datum. You can scale or change its handedness, but not move or rotate. If you don’t want to apply a transform to every actor, you can move the camera.

---

<div class="post-metadata">

### Author: ![Mordrago](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mordrago/32/8974_2.png) [@Mordrago](https://discourse.vtk.org/u/Mordrago)
#### Post date: [May 9, 2024, 6:39am UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/9 "2024-05-09T06:39:58Z")

</div>

So, the best approach would be to create a vtkTransform that rotates my actor(s) and then when the vtkTransform exists, I need to use the transformation for each new actor loaded.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 9, 2024, 6:28pm UTC](https://discourse.vtk.org/t/coordinate-system-transformation/13848/10 "2024-05-09T18:28:55Z")

</div>

Well, try that and observe. Try not to worry too much about whether it’s the best approach.
