[vtkusers] filling in a sphere's intersection with a plane
David Gobbi
david.gobbi at gmail.com
Sat Jan 12 11:22:03 EST 2019
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 <msmerps at gmail.com> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190112/43b43f64/attachment.html>
More information about the vtkusers
mailing list