mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	FIX: update_sequential_clearance may crash due to clipper's bug
m_hull_2d_cache must be set since later on we'll use its point number, which is a very large number when not inited. This will cause a fatal out-of-memory error. Jira: STUDIO-2452 Change-Id: I9b397a53bdcdf555eccf745f1b96786010ebe309 (cherry picked from commit 6802be53709649e75a1562d29e14559c766d427b)
This commit is contained in:
		
							parent
							
								
									304e29529b
								
							
						
					
					
						commit
						e4f6315da0
					
				
					 1 changed files with 10 additions and 10 deletions
				
			
		|  | @ -4964,20 +4964,20 @@ void GLCanvas3D::update_sequential_clearance() | |||
|         for (size_t i = 0; i < m_model->objects.size(); ++i) { | ||||
|             ModelObject* model_object = m_model->objects[i]; | ||||
|             ModelInstance* model_instance0 = model_object->instances.front(); | ||||
|             auto tmp = offset(model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(), | ||||
|                 model_instance0->get_scaling_factor(), model_instance0->get_mirror())), | ||||
|             Polygon hull_no_offset = model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(), | ||||
|                 model_instance0->get_scaling_factor(), model_instance0->get_mirror())); | ||||
|             auto tmp = offset(hull_no_offset, | ||||
|                 // Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
 | ||||
|                 // exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
 | ||||
|                 shrink_factor, | ||||
|                 jtRound, mitter_limit); | ||||
|             if (!tmp.empty()) { // tmp may be empty due to clipper's bug, see STUDIO-2452
 | ||||
|                 Polygon hull_2d = tmp.front(); | ||||
|                 Pointf3s& cache_hull_2d = m_sequential_print_clearance.m_hull_2d_cache.emplace_back(Pointf3s()); | ||||
|                 cache_hull_2d.reserve(hull_2d.points.size()); | ||||
|                 for (const Point& p : hull_2d.points) { | ||||
|                     cache_hull_2d.emplace_back(unscale<double>(p.x()), unscale<double>(p.y()), 0.0); | ||||
|                 } | ||||
|             } | ||||
|             Polygon hull_2d = !tmp.empty() ? tmp.front() : hull_no_offset;// tmp may be empty due to clipper's bug, see STUDIO-2452
 | ||||
| 
 | ||||
|             Pointf3s& cache_hull_2d = m_sequential_print_clearance.m_hull_2d_cache.emplace_back(Pointf3s()); | ||||
|             cache_hull_2d.reserve(hull_2d.points.size()); | ||||
|             for (const Point& p : hull_2d.points) { | ||||
|                 cache_hull_2d.emplace_back(unscale<double>(p.x()), unscale<double>(p.y()), 0.0); | ||||
|             }             | ||||
|         } | ||||
|         m_sequential_print_clearance_first_displacement = false; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Arthur
						Arthur