[vtkusers] Re: Simple Collision Detection between camera and object

Chris Hughes chughes at informatics.bangor.ac.uk
Wed Jan 31 10:21:49 EST 2007


Hi Goodwin,

The vtkOBBTree looks like it could do exactly what I need. However I am 
really struggling to get it to work. I have a closed polygon mesh and I 
have ried to set up he OBBTree like this:

            vtkOBBTree *obbTree = vtkOBBTree::New();
            obbTree->SetDataSet(vPolyDataReader->GetOutput());
            obbTree->SetMaxLevel(10);
            obbTree->BuildLocator();

I then have a look which runs a simulation and moves the camera around 
and include:

ioo = obbTree->InsideOrOutside(ren1->GetActiveCamera()->GetPosition());

However this causes the application to compile but crash with a 'has 
encountered a problem and needs to close' style error. Any suggestions?

Many thanks..

Chris

Goodwin Lawlor wrote:
> Chris Hughes wrote:
>> Hi Guys,
>>
>> I have a simple scene with a single vtkActor containing polyData and 
>> a vtkCamera. I am looking for a simple way to be able to tell if the 
>> camera (which I obviously know the position of) is touching the 
>> polygon mesh.Ie does the polygon mesh appear at the coordinates of 
>> the camera?
>>
>> I am sure that there must be an easy solution to this, but I am not 
>> sure where to start!
>>
>> Many thanks,
>>
>> Chris
>>
>
> Hi Chris,
>
> You could use:
> int vtkOBBTree::InsideOrOutside (const double point[3])
>
> within a callback to check if the camera position has penetrated your 
> polydata mesh.
>
> hth
>
> Goodwin
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


-- 

Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi,
gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig
gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y
neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar
unwaith a dilëwch y neges. Os na fwriadwyd anfon y neges atoch chi,
rhaid i chi beidio â defnyddio, cadw neu ddatgelu unrhyw wybodaeth a
gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i
hanfonodd yn unig  ac nid yw o anghenraid yn cynrychioli barn
Prifysgol Cymru, Bangor. Nid yw Prifysgol Cymru, Bangor yn gwarantu
bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau neu
100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn
nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract
rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa
Cyllid Prifysgol Cymru, Bangor.  www.bangor.ac.uk (YCYG)

This email and any attachments may contain confidential material and
is solely for the use of the intended recipient(s).  If you have
received this email in error, please notify the sender immediately
and delete this email.  If you are not the intended recipient(s), you
must not use, retain or disclose any information contained in this
email.  Any views or opinions are solely those of the sender and do
not necessarily represent those of the University of Wales, Bangor.
The University of Wales, Bangor does not guarantee that this email or
any attachments are free from viruses or 100% secure.  Unless
expressly stated in the body of the text of the email, this email is
not intended to form a binding contract - a list of authorised
signatories is available from the University of Wales, Bangor Finance
Office.  www.bangor.ac.uk (SEECS)




More information about the vtkusers mailing list