lemon_engine/shapes/
triangle.rs1use super::vector2::{Vector2, Vertex};
2
3pub struct Triangle {
5 pub vertex1: Vector2,
6 pub vertex2: Vector2,
7 pub vertex3: Vector2
8}
9
10impl Triangle {
11 pub fn new(vertex1: Vec<i32>, vertex2: Vec<i32>, vertex3: Vec<i32>) -> Triangle {
13 return Triangle {
14 vertex1: Vector2::new(vertex1[0] as f32 / 100f32, vertex1[1] as f32 / 100f32),
15 vertex2: Vector2::new(vertex2[0] as f32 / 100f32, vertex2[1] as f32 / 100f32),
16 vertex3: Vector2::new(vertex3[0] as f32 / 100f32, vertex3[1] as f32 / 100f32),
17 }
18 }
19 pub fn to_vertices(self) -> Vec<Vertex> {
21 return vec![
22 self.vertex1.to_vertices(),
23 self.vertex2.to_vertices(),
24 self.vertex3.to_vertices()
25 ]
26 }
27}