[vtkusers] Transform a clipping plane

Cory Quammen cory.quammen at kitware.com
Tue Jan 5 14:45:53 EST 2016


Chiang,

You can't clip an object with two planes and get a convex object as shown
in the attachment. Instead, try clipping with a vtkBox:

http://www.vtk.org/doc/nightly/html/classvtkBox.html

- Cory

On Tue, Jan 5, 2016 at 2:40 PM, WangQ <wangq1979 at outlook.com> wrote:

> Dear Cory,
>
> I try to use 2 perpendicular planes to clip a volume to achieve something
> shown in the attachment, i.e. clipping 1/4 of a volume. But the result
> unfortunately  is reverse, i.e. clipping 3/4 away, and showing the rest
> 1/4. Do you have any suggestion?
>
> Many thanks!
>
> Chiang
>
> ------------------------------
> Date: Tue, 5 Jan 2016 10:28:33 -0500
> Subject: Re: [vtkusers] Transform a clipping plane
> From: cory.quammen at kitware.com
> To: wangq1979 at outlook.com
> CC: vtkusers at vtk.org
>
> Chiang,
>
> The transform is applied to points at which the plane function is
> evaluated, but it is not considered when setting up clipping planes in the
> mapper.
>
> You should be able to get the same effect from your rotations by applying
> the transform to a point representing the tip of the plane normal.
>
> double normal[] = {0, 1, 0};
> double rotatedNormal[3];
> transPlane->TransformPoint(normal, rotatedNormal);
> plane->SetNormal(rotatedNormal);
>
> HTH,
> Cory
>
>
> On Tue, Jan 5, 2016 at 7:32 AM, WangQ <wangq1979 at outlook.com> wrote:
>
> Hello vtkusers,
>
> I used vtkplane to clip a volume. Everything is find until the volume is
> transformed. The plane is still at the original position. I then applied
> vtkTransform to the plane, but the plane is still the same place. The code
> snippet is as below:
>
>     vtkSmartPointer<vtkPlane> plane =
>         vtkSmartPointer<vtkPlane>::New();
>     plane->SetOrigin(0, tomo2DDims / 2, 0);
>     plane->SetNormal(0, 1, 0);
>     vtkSmartPointer<vtkTransform> transPlane =
> vtkSmartPointer<vtkTransform>::New();
>     transPlane->RotateY(90);
>     transPlane->RotateZ(90);
>     transPlane->RotateX(55);
>     transPlane->RotateY(3);
>     plane->SetTransform(transPlane);
>
>     cutVolumeMapper->AddClippingPlane(plane);
>
>
> Appreciate your help in advance!
>
> cheers,
>
> Chiang
>
> _______________________________________________
> Powered by www.kitware.com
>
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160105/733d9d6a/attachment.html>


More information about the vtkusers mailing list