[vtkusers] Create polyData from 4 points

David E DeMarle dave.demarle at kitware.com
Fri Dec 4 09:13:11 EST 2009


What you are looking for is called a frustum selection. See
/Rendering/Testing/Cxx/TestAreaSelections.cxx

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Fri, Dec 4, 2009 at 3:01 PM, Francesco Ferro <le_maitre at bluewin.ch> wrote:
> Hi David,
>
> Thank's for the answer! vtkAreaPicker is exactly the class I was looking for
> (using the frustum etc..) !! I tried to use it and it works very well
> (I'm drawing 4 points around my 3d object, I call AreaPick and it returns me
> the prop3D of the actor where the frustum has intersected..).
> Unfortunately this class can only return the "whole"" actor (and not the
> group of cell intersecting with the frustum). Usefull for me if I want only
> get Which cell is intersecting with the frustum...
> for example if I select only half of my 3D object...and the delect all the
> cells in the frustum area...
>
> So I will have a look to how AreaPicker class compute the intersections
> unless there is a class already doing that ?
>
> Thank's again,
>
>
>
> David E DeMarle wrote:
>>
>> Look at vtkAreaPicker::AreaPick() and ::DefineFrustum(). That uses the
>> renderer to get 8 world space coordinates out of the four screen space
>> coordinates. After that you need to create a vtkPolyData, makes those
>> 8 points it's Points, and then make up one or more Cells that refer to
>> those points.
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>>
>>
>> On Thu, Dec 3, 2009 at 12:34 PM, Francesco Ferro <le_maitre at bluewin.ch>
>> wrote:
>>
>>>
>>> Hi all,
>>>
>>> I would like to know if is it possible to create a polydata from 4 points
>>> ?
>>> here an example of what I'm trying to do.
>>>
>>> 1. I have a windows where I can display 3D object and where I can draw
>>> with
>>> the mouse on a 2 overlay (using Actor2D and polyMapper2D...)
>>>
>>> 2. I click on my windows 4 times that will create 4 points on my windows
>>> (imagine I click the 4 edges of a square for example....)
>>>
>>> 3. I'd like then  draw lines between there 4 pointes (so it will display
>>> like a 2d square...)
>>>
>>> 2. And then I'd like from these 4 points create a 3D object. with the X
>>> and
>>> Y dimension I clicked and an "infinite" or very longue dimension in Z.
>>>
>>> Is there any easy way or Intelligent way to do that ? Storing the points
>>> in
>>> a particular data or array ?
>>>
>>> Thank's in advance
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>>
>
>



More information about the vtkusers mailing list