[vtkusers] Fwd: Division of vtkPolyData - please help me ...

Hila Hiler hilahiler at gmail.com
Tue May 8 07:50:42 EDT 2012


Jagjeet,

Thank you very much for the idea.
I tried to alter my code as your suggestion, but this RT error returns with
the same memory location massage:

 // Description:
  // Return the id at location i.
  vtkIdType GetId(const vtkIdType i) {return this->Ids[i];};

R U sure that I divided my poly to buckets well with number of required
regions?


Thanks again!


On Tue, May 8, 2012 at 2:22 PM, Jagjeet Nain <jagjeet.nain at gmail.com> wrote:

> Hi,
> What will happen if you try like:
>
> for(int i=1; i<numOfRequiredRegions; i++)
>   {
>       for(vtkIdType id=1; id<cell_num; id++) //go over each cell in bucket
>          curIdx =  *cellLocator->GetCells(i)* ->GetId(id); //get the
> index in each cell
>   }
> Is it same error or something else ????
>
> regards
>
>
> On Tue, May 8, 2012 at 12:26 PM, Hila Hiler <hilahiler at gmail.com> wrote:
>
>> Hi All,
>>
>> I hope somebody will answer me this time :-)
>> actualy, my question is very simple:
>>
>> In order to divide my polyData- I simply divided it to buckets such that
>> each bucket will contain X number of cells in this way:
>>
>>
>>  unsigned int cell_num = poly->GetNumberOfCells();
>>
>> // building vtkCellLocator
>>  vtkSmartPointer<vtkCellLocator> cellLocator =
>> vtkSmartPointer<vtkCellLocator>::New();
>>  cellLocator->SetDataSet(poly);
>>  cellLocator->BuildLocator();
>>  cellLocator->SetNumberOfCellsPerBucket(cell_num/numOfRequiredRegions);
>>  cellLocator->Update();
>>
>> //build a list of indexes for each region
>>  vtkSmartPointer<vtkIdList> listOfIndexesInBucket =
>> vtkSmartPointer<vtkIdList>::New();
>>  vtkIdType curIdx;
>>
>>  //go over each bucket
>>  for(int i=1; i<numOfRequiredRegions; i++)
>>   {
>>    *listOfIndexesInBucket = cellLocator->GetCells(i);*
>>       for(vtkIdType id=1; id<cell_num; id++) //go over each cell in bucket
>>          curIdx = listOfIndexesInBucket->GetId(id); //get the index in
>> each cell
>>   }
>>
>>
>> Unfortunately, there is a RT error in the marked line above and the
>> folowing code + massage are represented the error:
>>
>> unhandled exeption acces violaion reading location ...
>> and the code is:
>>
>> void vtkSmartPointerBase::Register()
>> {
>>   // Add a reference only if the object is not NULL.
>>   if(this->Object)
>>     {
>>     this->Object->Register(0);
>>     }
>> }
>>
>> Any Idea ?
>>
>>
>> Thanks.
>>
>>
>> ---------- Forwarded message ----------
>> From: Hila Hiler <hilahiler at gmail.com>
>> Date: Mon, May 7, 2012 at 7:35 PM
>> Subject: Division of vtkPolyData
>> To: "<vtkusers at vtk.org>" <vtkusers at vtk.org>
>>
>>
>> Hi all,
>>
>> I have a vtkPolyData and would like to:
>> 1. divide it to regions/areas/pieces
>> 2. get the indexes/cells/array from that division to further processing
>>
>> Visually, I'd like to get this<http://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/OBBDicer>division BUT to use the indexes that this division returns.
>> (if you look at the attached link, I'd like to get the points that each
>> piece has)
>> I know OBBDicer won't return the required data, but which can?
>>
>> ANY help, I'm lost ...
>> Thanks.
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120508/1a242286/attachment.htm>


More information about the vtkusers mailing list