[vtkusers] Create "ovoid" with VTK
Bill Lorensen
bill.lorensen at gmail.com
Tue Jul 9 17:16:14 EDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130709/5e4baa68/attachment.htm>
More information about the vtkusers
mailing list