Exemple #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(CSG_Model csg_model_a, CSG_Model csg_model_b)
        {
            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());
        }
Exemple #2
0
        /**
         * Returns a new mesh by subtracting @rhs from @lhs.
         */
        public static Mesh Subtract(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.Subtract(a, b).AllPolygons();

            CSG_Model result = new CSG_Model(polygons);

            return(result.ToMesh());
        }