示例#1
0
        /**
         * Return a new mesh by intersecting @lhs with @rhs.  This operation
         * is non-commutative, so set @lhs and @rhs accordingly.
         */
        public static Mesh Intersect(GameObject lhs, GameObject rhs)
        {
            CSG_Model csg_model_a = new CSG_Model(lhs);
            CSG_Model csg_model_b = new CSG_Model(rhs);

            CSG_Node a = new CSG_Node(csg_model_a.ToPolygons());
            CSG_Node b = new CSG_Node(csg_model_b.ToPolygons());

            List <CSG_Polygon> polygons = CSG_Node.Intersect(a, b).AllPolygons();

            CSG_Model result = new CSG_Model(polygons);

            return(result.ToMesh());
        }