instersetcs function returning non intersecting planes


#1

Hi guys! I have “pile of planes” and I need to find out all intersections between these planes. I have wrote following piece of code to give me list of all planes and planes their are intersecting with. Problem is that intersects function is returning me also planes that are not intersecting with current one. Do you know whats wrong there? Where I made mistake or misunderstood something?

Also I use array to store intersecting planes, this array i put into dictionary, but if I free this array after setting it into dictionary, values in dictionary are empty. Why is this happening?

Thanks for help!


for i = 1 to planes.Count do 
(
      currentPlane                                     = planes [i]
      currentPlaneName                            = currentPlane.name as name
      planesInfo [currentPlaneName]    = undefined

      for y = 1 to planes.Count do
      (
            collisionCandidate = planes [y]
      
            if currentPlane.name != collisionCandidate.name then
            (
                  if intersects currentPlane collisionCandidate == true then
                  (
                        appendIfUnique collidingPlanes collisionCandidate.name

                  )
            )
      )
   
      SetDictValue       planesInfo currentPlaneName collidingPlanes   
      free                collidingPlanes
)