private int RayCastFilter(Ray ray, IDrawable d, List <RayCastHit <IDrawable> > hits) { var bb = d.GetBounds(); //var dist = (ray.Origin - bb.GetCenter()).Length(); float dist; //if (ray.Intersects(bb) && dist < RCDist) if ((((d.DrawFilter & DrawFilter) > 0 && d.DrawGroups.IsInDisplayGroup(DisplayGroup) && d.IsVisible) || d.Highlighted) && ray.Intersects(bb) && d.RayCast(ray, out dist) && dist < RCDist) { RCDist = dist; hits.Clear(); hits.Add(new RayCastHit <IDrawable>(d, ray.Origin + ray.Direction * dist, dist)); return(1); } return(0); }
private void updateDrawBounds(IDrawable child) { try { Point corner = child.GetBounds().BottomRight; corner.Offset(50, 50); extent.Union(corner); //Console.WriteLine("Extent rect updated to " + extent.ToString()); } catch (NotImplementedException) { // do nothing } }