<div dir="ltr">Hi Mark,<div><br></div><div>You should use a callback to color the plane etc.</div><div><br></div><div>Have a look at the example here: <a href="https://github.com/glawlor/vtkbioeng/blob/master/Testing/Cxx/TestCollisionDetection.cxx">https://github.com/glawlor/vtkbioeng/blob/master/Testing/Cxx/TestCollisionDetection.cxx</a></div>
<div><br></div><div>Feel feel to ask further if the code isn't clear.</div><div><br></div><div>hth</div><div><br></div><div>Goodwin</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Jun 13, 2014 at 3:47 PM, Mark Hervagault <span dir="ltr"><<a href="mailto:mark.hervagault@gmail.com" target="_blank">mark.hervagault@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi guys,<br>
<br>
At the first. I would like to detect if a line collides with a actor (I took<br>
plane some example).<br>
I have the plane and the line. To see if the collision is detected, I would<br>
like to change the color of my plane.<br>
After, I would like translate the plane on this line...<br>
How to detect a collision?<br>
<br>
*My main:*<br>
<br>
        vtkPlaneSource planSource = new vtkPlaneSource();<br>
        planSource.SetCenter(0.0, 0.0, 0.0);<br>
        planSource.SetNormal(0.0, 0.0, 0.0);<br>
        planSource.Update();<br>
        vtkPolyData plan = planSource.GetOutput();<br>
        vtkPolyDataMapper mapper = new vtkPolyDataMapper();<br>
        mapper.ScalarVisibilityOn();<br>
        mapper.SetInputData(plan);<br>
        vtkActor actor = new vtkActor();<br>
        actor.SetMapper(mapper);<br>
<br>
        double origin[] = new double[3];<br>
        origin[0]=0.0;<br>
        origin[1]=0.0;<br>
        origin[2]=-3.0;<br>
        double p0[] = new double[3];<br>
        p0[0]=0.0;<br>
        p0[1]=0.0;<br>
        p0[2]=3.0;<br>
<br>
        vtkPoints pts= new vtkPoints();<br>
        pts.InsertNextPoint(origin);<br>
        pts.InsertNextPoint(p0);<br>
<br>
        vtkLine ligne = new vtkLine();<br>
        ligne.GetPointIds().SetId(0, 0);<br>
        ligne.GetPointIds().SetId(1, 1);<br>
        vtkCellArray lines = new vtkCellArray();<br>
        lines.InsertNextCell(ligne);<br>
<br>
        vtkPolyData line = new vtkPolyData();<br>
        line.SetPoints(pts);<br>
        line.SetLines(lines);<br>
        vtkPolyDataMapper mapper2 = new vtkPolyDataMapper();<br>
        mapper2.SetInputData(line);<br>
        vtkActor actorLigne = new vtkActor();<br>
        actorLigne.SetMapper(mapper2);<br>
<br>
        vtkRenderer renderer = new vtkRenderer();<br>
        vtkRenderWindow renWin = new vtkRenderWindow();<br>
        renWin.AddRenderer(renderer);<br>
        vtkRenderWindowInteractor renWinInt = new<br>
vtkRenderWindowInteractor();<br>
        renWinInt.SetRenderWindow(renWin);<br>
<br>
        renderer.AddActor(actor);<br>
        renderer.AddActor(actorLigne);<br>
        renderer.SetBackground(.1,.2,.3);<br>
<br>
        renWin.Render();<br>
        renWin.Start();<br>
        renWinInt.Start();<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/vtkCollisionDetectionFilter-with-2-vtkActor-line-and-palne-translation-tp5727475.html" target="_blank">http://vtk.1045678.n5.nabble.com/vtkCollisionDetectionFilter-with-2-vtkActor-line-and-palne-translation-tp5727475.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>