简体   繁体   中英

VTK - 2D Point cloud within an ellipse

Using VTK, I want to create a cloud of points (random amount) located inside an ellipse.

So far I've got this:

vtkSmartPointer<vtkPointSource> pointSource = vtkSmartPointer<vtkPointSource>::New();
pointSource->SetCenter(0.0, 0.0, 0.0);
pointSource->SetNumberOfPoints(nPoints);
pointSource->SetRadius(radius);
pointSource->Update();

However I wonder how to describe it as an elliptical shaped cloud .

You could use a vtkTransform to convert the point source sphere to an ellipse. Here's an example that scales a plane: http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Modelling/Python/expCos.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM