[vtkusers] question ? [vtkPlane]

Miro Drahos mdrahos at robodoc.com
Tue Mar 25 17:29:45 EDT 2014


Hi Agata,
you need three points to uniquely define a plane in 3D space, two points 
are not enough (there is infinitely many planes that pass through the 
line defined by 2 points).
To create a plane, set the origin and the normal vector. If you have 3 
points that lie in the plane, p1, p2, p3, create 2 vectors, e.g. p12, 
p23 and do a cross-product to create normal:
     double n[3];  // plane normal
     vtkMath::Cross(p12, p23, n);
     plane->SetOrigin(p1);
     plane->SetNormal(n);

If you just need it for the cutter, you don't have to worry about 
orientation of the plane.
Best,
Miro


On 03/25/2014 01:44 PM, Agata Krasoń wrote:
> Hello,
>
>
> I have a question concering vtkPlane. I set two points and I want to 
> create a plane and use it in vtkCutter. Finally I want to clip  a mesh 
> in this place.
> Is there any possibility to to set two points and create vtkPlane ?
>
> *  double p1[3] = {26.4345, 12.3461, 15.3201};*
> *  double p2[3] = {22.496, 15.3133, 15.9631};*
> *
> *
> * vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();*
> *  // plane->SetOrigin(0,0,0);*
>
>   vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();
>   cutter->SetCutFunction(plane);
> cutter->SetInputConnection(reader->GetOutputPort());
>   cutter->Update();
>
> I would appreciate for any help please :)
>
> Best,
> Agata

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140325/920dfd97/attachment.html>


More information about the vtkusers mailing list