[vtk-developers] Fwd: vtkUnstructuredGridVolumeRayCastMapper (05B22CB8): Can't use the ray cast mapper without scalars!
David Feng
dfeng at cs.unc.edu
Wed Oct 7 16:35:39 EDT 2009
If you look at the edges, you'll see that it is actually made of up
triangles:
actor.SetRepresentationToWireframe()
There are other ways of approximating spheres with geometry, but it
doesn't look like they are in VTK.
David
Ali Habib wrote:
> thanks alot for your great efforts,
>
> Please I have another question it's not a perfect traingle ,I want to
> create a mesh to be used in FEM any advice please
>
>
> best regards
>
> On Wed, Oct 7, 2009 at 9:59 PM, David Feng <dfeng at cs.unc.edu
> <mailto:dfeng at cs.unc.edu>> wrote:
>
> I haven't used the vtkUnstructuredGridVolumeRayCastMapper before,
> nor do I know anything about meshing. I'm guessing that
> vtkUnstructuredGridVolumeRayCastMapper is trying to composite all
> of the scalars on the geometry points, and fails when there aren't
> any.
> It looks like you're trying to set the scalars with this code:
>
> unstructuredReader->GetOutput()->GetPointData()->AddArray(arr);
> unstructuredReader->GetOutput()->GetPointData()->SetActiveScalars("myarray");
>
> I'd be careful with that. Modifications to the output of a filter
> often get wiped out when the filter updates. Better to make a
> copy of the output, if you have space:
>
> copy = vtkUnstructuredGrid::New()
> copy->DeepCopy(unstructuredReader->GetOutput());
> copy->GetPointData()->SetScalars(arr);
>
> But it seems like you really don't care about scalars defined at
> points, since you're just filling the scalar array with 1.0
> everywhere. If all you want is to see a surface, then render it
> using one of the standard geometry mappers. The code would look
> something like this, in python:
>
> -----------
> sphereSource = vtk.vtkSphereSource()
> delaunay = vtk.vtkDelaunay3D()
> delaunay.SetInputConnection(sphereSource.GetOutputPort())
>
> mapper = vtk.vtkDataSetMapper()
> mapper.SetInputConnection(delaunay.GetOutputPort())
>
> actor = vtk.vtkActor()
> actor.SetMapper(mapper)
>
> ren = vtk.vtkRenderer()
> rwin = vtk.vtkRenderWindow()
> iren = vtk.vtkRenderWindowInteractor()
>
> ren.AddActor(actor)
> rwin.AddRenderer(ren)
> rwin.SetInteractor(iren)
> iren.Start()
> -------------
>
> I tested this out and it rendered a sphere. It looks the same as
> the normal output from vtkSphereSource. Again, I'm not familiar
> with what you're trying to do, but hopefully this was helpful.
>
> David
>
> Ali Habib wrote:
>
> Dear All
> I know it's for developing just , but I sent 6 times to vtk
> user forum , with no reply helped me , so I am not sure is
> this bug or not
> best regards
>
> ---------- Forwarded message ----------
> From: *Ali Habib* <ali.mahmoud.habib at gmail.com
> <mailto:ali.mahmoud.habib at gmail.com>
> <mailto:ali.mahmoud.habib at gmail.com
> <mailto:ali.mahmoud.habib at gmail.com>>>
> Date: Tue, Sep 29, 2009 at 9:47 PM
> Subject: vtkUnstructuredGridVolumeRayCastMapper (05B22CB8):
> Can't use the ray cast mapper without scalars!
> To: vtkusers at vtk.org <mailto:vtkusers at vtk.org>
> <mailto:vtkusers at vtk.org <mailto:vtkusers at vtk.org>>
>
>
> I wrote a code to make tetrahedral mesh on sphere , but it no
> give result except :
> ERROR: In
> m:\dev\cur\vtkdotnet\branch\50\VolumeRendering\vtkUnstructuredGridVolumeRayCastMapper.cxx,
> line 274
> vtkUnstructuredGridVolumeRayCastMapper (05B22CB8): Can't use
> the ray cast mapper without scalars!
> every time I run the code
> attached is the c++ code , your fast reply is highly appretiated
> best regards
>
> ------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com/>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>
>
>
More information about the vtk-developers
mailing list