mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:52:45 +00:00 
			
		
		
		
	 1f346a490b
			
		
	
	
		1f346a490b
		
	
	
	
	
		
			
			Previously this was limited to integer triangles, but I want to use it with floats, so let's start by templatizing the class.
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			482 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			482 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Shannon Booth <shannon.ml.booth@gmail.com>
 | |
|  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <AK/String.h>
 | |
| #include <LibGfx/Triangle.h>
 | |
| 
 | |
| namespace Gfx {
 | |
| 
 | |
| template<>
 | |
| String Triangle<int>::to_string() const
 | |
| {
 | |
|     return String::formatted("({},{},{})", m_a, m_b, m_c);
 | |
| }
 | |
| 
 | |
| template<>
 | |
| String Triangle<float>::to_string() const
 | |
| {
 | |
|     return String::formatted("({},{},{})", m_a, m_b, m_c);
 | |
| }
 | |
| 
 | |
| }
 |