Re: filling in a sphere's intersection with a plane

David Gobbi <[email protected]> Sat, 12 Jan 2019 09:22:03 -0700
Newsgroups gmane.comp.lib.vtk.user
Message-ID <CANwS1=FC1JC=92G2gJV0y4p0gXNHSyk4nZw_JqS_Gcf0LqMRdQ@mail.gmail.com>
Hi M,

From the images (especially slice89) it looks like your program still
renders the whole sphere, in addition to rendering the cross-section.
Remove or disable the code that renders the whole sphere.

I'm pretty sure that the problem is that you haven't yet written code that
updates the origin of your cut plane when the user changes the slice.

Even then, as I mentioned before, there are likely to be rendering problems
due to coincident geometry (e.g. the image might get rendered on top of the
polydata and thus obscure it).  It's possible that the
SetResolveCoincidentTopologyToPolygonOffset method isn't available in the
language you are using.  I know there are other ways of ensuring that the
polydata is drawn on top (e.g. move it slightly closer to the camera) but
right now I can't recall a simple way to do this in VTK (only complicated
ways).

  David


On Fri, Jan 11, 2019 at 9:30 PM The Merper <[email protected]> wrote:

>
> Thank you David,
>     I tried to do as you suggested with the following code:
>
>                     // Use vtkCutter to derive the contour of the
> intersection with the Z-plane
>                     var Origin=_ZPlaneSource.GetOrigin();
>                     var Normal= _ZPlaneSource.GetNormal();
>                     var TempPlane = vtkPlane.New();
>                     TempPlane.SetOrigin(Origin[0], Origin[1], Origin[2]);
>                     TempPlane.SetNormal(Normal[0], Normal[1], Normal[2]);
>                     var Cutter = vtkCutter.New();
>                     Cutter.SetCutFunction(TempPlane);
>                     Cutter.SetInputConnection(
> SphereSource.GetOutputPort());
>                     Cutter.Update();
>                     var CutterMapper = vtkPolyDataMapper.New();
>                     CutterMapper.SetInputConnection(Cutter.
> GetOutputPort());
>
>                     // Use vtkContourTriangulator to fill the polyline
> contour with traingles
>                     vtkContourTriangulator Poly =
> vtkContourTriangulator.New();
>                     Poly.SetInputConnection(Cutter.GetOutputPort());
>                     var PolyMapper = vtkDataSetMapper.New();
>                     PolyMapper.SetInputConnection(Poly.GetOutputPort());
>                     PolyMapper.ScalarVisibilityOff();
>                     var PolyActor = vtkActor.New();
>                     PolyActor.GetProperty().SetColor(((double)_LandmarkColors[i].R)
> / 255,
>                         ((double)_LandmarkColors[i].G) / 255,
> ((double)_LandmarkColors[i].B) / 255);
>                     PolyActor.SetMapper(PolyMapper);
>                     Ren.AddActor(PolyActor);
>
> And it renders a circle in the slice that intersects the center of the
> sphere (i.e., the attached slice91.png). However, when you go below or
> above that slice, you just see the outline of the sphere (e.g.,
> slice90.jpg). When you go down one or more slices further you see the
> bottom of the sphere with 3D shading (e.g., slice89.jpg), until it goes out
> of view.
>
> Did I do something wrong? My PolyMapper instance of vtkDataSetMaper does
> not have a method SetResolveCoincidentTopologyToPolygonOffset().
>      thanks again,
>         -M
>

_______________________________________________
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:
https://vtk.org/mailman/listinfo/vtkusers