# [vtkusers] How to set normal of vtkImagePlaneWidget ?

DL I inglis.dl at gmail.com
Wed Jun 24 09:35:43 EDT 2015

```you cannot set a normal without somehow specifying how the plane would be
positioned
relative to it.  A normal is only a direction: you need at least one
position and a direction to define any plane.
vtkImagePlaneWidget is further constrained because it has edges and this is
why it has methods
to define it : SetPoint1, SetPoint2, SetOrigin.  The general mathematical
definition of a plane does not impose
such constraints (ie., it has no edges), and so a point and a normal are
sufficient to define it.

Dean

On Tue, Jun 23, 2015 at 9:32 PM, 沧海一粟 <liyihai2009 at qq.com> wrote:

> Hi, DL I,
>
> The means you recommended is suited to calculate the normal according to
> orgin, point1 and point2. But I just want to change the normal to specified
> value, and the value of orgin, point1 or point2 are unknown.
>
> ------------------ 原始邮件 ------------------
> *发件人:* "DL I";<inglis.dl at gmail.com>;
> *发送时间:* 2015年6月23日(星期二) 晚上9:37
> *收件人:* "沧海一粟"<liyihai2009 at qq.com>;
> *抄送:* "vtkusers"<vtkusers at vtk.org>;
> *主题:* Re: [vtkusers] How to set normal of vtkImagePlaneWidget ?
>
> Hi,
>
> there is no SetNormal() method but a plane normal can be defined from 3
> points
> and vtkImagePlaneWidget allows SetPoint1(), SetPoint2(), SetOrigin() .
>
> try this (pseudocode):
>
> if you define your normal from an origin, o and 2 other points p1, p2
> such that p1 , p2 and o define a plane (and also 3 corners of the widget)
> then a normal to the plane, n, can be found with
> po1 = p1 - o;
> po2 = p2 - o;
> n = po1/||po1|| x po1/||po2||
>
> where x is the cross product operator and ||.|| is the norm of a vector.
> To set the widget's plane normal, you do so indirectly from p1, p2 and o:
>
> w.SetPoint1(p1)
> w.SetPoint2(p2)
> w.SetOrigin(o)
> w.UpdatePlacement()
>
>
> best,
> Dean
>
>
>
> On Mon, Jun 22, 2015 at 10:14 PM, 沧海一粟 <liyihai2009 at qq.com> wrote:
>
>> I just found method GetNormal() of vtkImagePlaneWidget, but no
>> SetNormal(). I want to set the plane normal, how should I do it ?
>>
>> _______________________________________________
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>