[vtkusers] Create "ovoid" with VTK

Bill Lorensen bill.lorensen at gmail.com
Tue Jul 9 17:50:38 EDT 2013


You could use
http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/BooleanOperationPolyDataFilterto
create a union of a sphere and ellipsoid. This image might help:
http://commons.wikimedia.org/wiki/File:Ovoid_plot.gif



On Tue, Jul 9, 2013 at 5:35 PM, mar x <myint101 at gmail.com> wrote:

> Thanks for the fast answers. I tried both but both gives just an ellipsoid
> and no ovoid. In other words I want to create a 3D object that is a
> composition of a half sphere and and half ellipsoid.
>
> Best regards.
>
>
> 2013/7/9 Bill Lorensen <bill.lorensen at gmail.com>
>
>> Or try:
>> // .NAME vtkParametricEllipsoid - Generate an ellipsoid.
>> // .SECTION Description
>> // vtkParametricEllipsoid generates an ellipsoid.
>> // If all the radii are the same, we have a sphere.
>> // An oblate spheroid occurs if RadiusX = RadiusY > RadiusZ.
>> // Here the Z-axis forms the symmetry axis. To a first
>> // approximation, this is the shape of the earth.
>> // A prolate spheroid occurs if RadiusX = RadiusY < RadiusZ.
>>
>>
>>
>> On Tue, Jul 9, 2013 at 5:11 PM, Shawn Waldon <swaldon at cs.unc.edu> wrote:
>>
>>> You probably want something more like:
>>>
>>> vtkSphereSource *sSource= vtkSphereSource::New();
>>>    sSource->SetThetaResolution( 12);
>>>    sSource->SetPhiResolution (  12);
>>>    sSource->SetCenter( 0, 0, 0 );
>>>    sSource->SetRadius( 10.0 );
>>>
>>>  vtkTransform* transform = vtkTransform::New();
>>>      transform->Identity();
>>>    transform->Scale(3,1,1);
>>>    transform->Update();
>>> vtkTransformPolyDataFilter* tFilter = vtkTransformPolyDataFilter::New();
>>> tFilter->SetInputConnection(sSource.GetOutputPort());
>>> tFilter->SetTransform(transform);
>>> tFilter->Update()
>>>
>>> vtkPolyDataMapper *map = vtkPolyDataMapper::New();
>>> map->SetInputConnection(tFilter->GetOutputPort());
>>>
>>> .................
>>>
>>> I didn't change your example much due to laziness and wanting to
>>> copy/paste, but you really should use vtkSmartPointers.
>>>
>>>
>>>
>>> On Tue, Jul 9, 2013 at 5:06 PM, mar x <myint101 at gmail.com> wrote:
>>>
>>>> Dear VTK list,
>>>>
>>>> I want to create a 3D object that looks like an egg/ovoid. I tried to
>>>> to this with vtkSphere and by setting the vtkTransform->Scale to something
>>>> like 3,1,1 but it's not working. I would be very glad if you could help me
>>>> on this. Please find below the code and thank you for any help!
>>>>
>>>>
>>>> vtkSphereSource *sSource= vtkSphereSource::New();
>>>>    sSource->SetThetaResolution( 12);
>>>>    sSource->SetPhiResolution (  12);
>>>>    sSource->SetCenter( 0, 0, 0 );
>>>>    sSource->SetRadius( 10.0 );
>>>>
>>>> vtkTransform* transform = vtkTransform::New();
>>>>      transform->Identity();
>>>>    transform->Scale(3,1,1);
>>>>    transform->Update();
>>>>    vtkSphere* sphere = vtkSphere::New();
>>>>    sphere->SetCenter(0,0,0);
>>>>   sphere->SetTransform(transform);
>>>>
>>>>      vtkSmartPointer<vtkClipPolyData> clipper =
>>>> vtkSmartPointer<vtkClipPolyData>::New();
>>>>     clipper->SetInputConnection(sSource->GetOutputPort());
>>>>     clipper->SetClipFunction(sphere);
>>>>     clipper->SetValue(0);
>>>>     clipper->Update();
>>>>
>>>>   vtkPolyDataMapper *map = vtkPolyDataMapper::New();
>>>>   map->SetInput(clipper->GetOutput());
>>>>
>>>>   vtkActor *aSphere = vtkActor::New();
>>>>   aSphere->SetMapper(map);
>>>>    aSphere->GetProperty()->SetColor(0,0,1);
>>>> ......
>>>> .....
>>>> .....
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>>
>>>
>>>
>>> --
>>> Shawn Waldon
>>> Graduate Student
>>> Department of Computer Science
>>> University of North Carolina at Chapel Hill
>>> swaldon at cs.unc.edu
>>>
>>> _______________________________________________
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130709/35740d0b/attachment.htm>


More information about the vtkusers mailing list