mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Don't repeat redundant minima or maxima in the profile plot
If we have more than four identical depth readings, the old code would see those as local maxima and minima and print spurious depth values in the profile plot. Yes, in real sample data identical readings won't happen - but in synthetic data they can and there this looks really bogus. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									d906c82f31
								
							
						
					
					
						commit
						edbba678b3
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		
							
								
								
									
										12
									
								
								profile.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								profile.c
									
										
									
									
									
								
							|  | @ -276,6 +276,7 @@ static void plot_text_samples(struct graphics_context *gc, struct plot_info *pi) | |||
| 	static const text_render_options_t deep = {14, 1.0, 0.2, 0.2, CENTER, TOP}; | ||||
| 	static const text_render_options_t shallow = {14, 1.0, 0.2, 0.2, CENTER, BOTTOM}; | ||||
| 	int i; | ||||
| 	int last = -1; | ||||
| 
 | ||||
| 	for (i = 0; i < pi->nr; i++) { | ||||
| 		struct plot_data *entry = pi->entry + i; | ||||
|  | @ -283,11 +284,18 @@ static void plot_text_samples(struct graphics_context *gc, struct plot_info *pi) | |||
| 		if (entry->depth < 2000) | ||||
| 			continue; | ||||
| 
 | ||||
| 		if (entry == entry->max[2]) | ||||
| 		if ((entry == entry->max[2]) && entry->depth != last) { | ||||
| 			render_depth_sample(gc, entry, &deep); | ||||
| 			last = entry->depth; | ||||
| 		} | ||||
| 
 | ||||
| 		if (entry == entry->min[2]) | ||||
| 		if ((entry == entry->min[2]) && entry->depth != last) { | ||||
| 			render_depth_sample(gc, entry, &shallow); | ||||
| 			last = entry->depth; | ||||
| 		} | ||||
| 
 | ||||
| 		if (entry->depth != last) | ||||
| 			last = -1; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue