# Rotate VtkImatgePlanWidget With vtkLineWidget

**URL:** https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404
**Category:** Development
**Tags:** code, proposal
**Created:** [May 8, 2023, 7:12am UTC](https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404 "2023-05-08T07:12:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![m.h.shanazary](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@m.h.shanazary](https://discourse.vtk.org/u/m.h.shanazary)
#### Post date: [May 8, 2023, 7:12am UTC](https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404/1 "2023-05-08T07:12:25Z")

</div>

Hi  
I Trying To Rotate VtkImagePlanWidget With VtkLineWidget  
I Create VtkImage Plan Widget And Vtk Line Widget  
And Set Event On Vtk Line Widget

```
 vtkPlaneSource ps = vtkPlaneSource.SafeDownCast(planeWidget.GetPolyDataAlgorithm());
     
 ps.SetNormal(Point2[0] - Point1[0] , Point2[1] - Point1[1] , Point2[2] - Point1[2] );
 ps.SetCenter(Point1[0], Point1[1], Point1[2]);
       
planeWidget.UpdatePlacement();

```

I Get Plan Source And Set Normal And Set Center  
Point 1 its center  
but plan its vertical on Line but I need Plan On Line Set

 ![RotatePlanWithGreenLine](https://discourse.vtk.org/uploads/default/original/2X/0/019144182c0bb4ce1d1e8f299b9704e258a1c37a.png)

I Rotating Plan Line White with Green Line Widget And Plan Its Vertical On Green Line

I need any Data About Set Origin And Set Normal And Set Center And Best Way To Use This Method  
in My Problem.

I would appreciate any help you can give me

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [May 8, 2023, 2:24pm UTC](https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404/2 "2023-05-08T14:24:40Z")

</div>

If you’re trying to rotate a plane, you’re essentially rotating the normal of the plane. In the case that you already know the line widget’s endpoints, you can directly set the line widget vector (normalizes) as the normal for the plane.

---

<div class="post-metadata">

### Author: ![m.h.shanazary](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@m.h.shanazary](https://discourse.vtk.org/u/m.h.shanazary)
#### Post date: [May 9, 2023, 6:21am UTC](https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404/3 "2023-05-09T06:21:12Z")

</div>

Hi sankhesh

I Have Three Point First, End And Center  
How Can Normalizes For Normal Plan With This Points

Thank you for giving me an explanation about this

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [May 9, 2023, 1:17pm UTC](https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404/4 "2023-05-09T13:17:16Z")

</div>

@m.h.shanazary I assume you mean you have three points on the line segment. In that case, just choose any two points and calculate the vector (p1 - p0) and normalize it. The direction of the vector would depend on which points you choose as p1 and p0.

---

<div class="post-metadata">

### Author: ![m.h.shanazary](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@m.h.shanazary](https://discourse.vtk.org/u/m.h.shanazary)
#### Post date: [May 10, 2023, 9:06am UTC](https://discourse.vtk.org/t/rotate-vtkimatgeplanwidget-with-vtklinewidget/11404/5 "2023-05-10T09:06:56Z")

</div>

Thanks For Help
