Example #1
0
        /// <summary>
        /// </summary>
        public bool Contains(Box3d box, Func <V2d[], IMask2d> create)
        {
            //var cs3 = box.ComputeCorners().Map(c => m_model2mask.Forward.TransformPosProj(c));
            //if (cs3.Any(c => c.Z > 1.0)) return false;
            //var cs = cs3.Map(c => c.XY);
            //var outline = new GpcPolygon(new[] { cs[0], cs[2], cs[3], cs[1] })
            //    .Unite(new GpcPolygon(new[] { cs[0], cs[4], cs[5], cs[1] }))
            //    .Unite(new GpcPolygon(new[] { cs[1], cs[5], cs[7], cs[3] }))
            //    .Unite(new GpcPolygon(new[] { cs[3], cs[7], cs[6], cs[2] }))
            //    .Unite(new GpcPolygon(new[] { cs[2], cs[6], cs[4], cs[0] }))
            //    .Unite(new GpcPolygon(new[] { cs[4], cs[6], cs[7], cs[5] }))
            //    ;
            //var r = outline.Subtract(m_mask);

            var outline = box.GetOutlineProjected(m_camPosition, m_model2mask.Forward);

            if (outline == null || outline.Length == 0)
            {
                return(false);
            }
            var r = create(outline).Subtract(m_mask);

            return(r.IsEmpty);
        }