Beispiel #1
0
        //TODO: Write a test to ensure this actually intersects itself
        private bool IntersectsWithOwner(Connector c)
        {
            ReferenceWithContext intersectedReference =
                new ReferenceIntersector(                           // shoots a ray from the connector's face
                    c.Owner.Id,                                     // element it looks for intersection with
                    FindReferenceTarget.All,                        // look for all intersections because this should hit it's owner first anyway if they intersect
                    CurrentDocument.Create3DView()).                // newly created 3DView
                FindNearest(c.Origin, c.CoordinateSystem.BasisZ);   // gives the normal from the connector's face

            // if the object returned is not null AND is the element itself, the connector intersects with it
            if (null != intersectedReference.GetReference() &&
                intersectedReference.GetReference() == new Reference(c.Owner))
            {
                return(true);
            }

            return(false);
        }