Exemple #1
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();
		}
Exemple #2
0
        public static Mesh Subtract(Mesh lhs, Mesh 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());
        }
Exemple #3
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());
        }
Exemple #4
0
        public Mesh getMesh()
        {
            CSG_Model result = new CSG_Model(current_object.AllPolygons());

            return(result.ToMesh());
        }