Moved files

This commit is contained in:
2023-01-25 12:03:07 +01:00
parent 8c5c9b4ec6
commit f1591bc9f1
21 changed files with 0 additions and 2 deletions
+46
View File
@@ -0,0 +1,46 @@
use std::f32::consts::PI;
use bevy::prelude::Vec2;
use bevy_prototype_lyon::prelude::{Path, PathBuilder};
use crate::general::Precision;
pub fn turtle() -> Path {
let polygon: &[[Precision; 2]; 23] = &[
[-2.5, 14.0],
[-1.25, 10.0],
[-4.0, 7.0],
[-7.0, 9.0],
[-9.0, 8.0],
[-6.0, 5.0],
[-7.0, 1.0],
[-5.0, -3.0],
[-8.0, -6.0],
[-6.0, -8.0],
[-4.0, -5.0],
[0.0, -7.0],
[4.0, -5.0],
[6.0, -8.0],
[8.0, -6.0],
[5.0, -3.0],
[7.0, 1.0],
[6.0, 5.0],
[9.0, 8.0],
[7.0, 9.0],
[4.0, 7.0],
[1.25, 10.0],
[2.5, 14.0],
];
let mut turtle_path = PathBuilder::new();
turtle_path.line_to(Vec2::new(1.0, 1.0));
turtle_path.line_to(Vec2::new(-1.0, 1.0));
turtle_path.line_to(Vec2::new(-1.0, -1.0));
turtle_path.line_to(Vec2::new(1.0, -1.0));
turtle_path.close();
turtle_path.move_to(Vec2::new(0.0, 16.0).rotate(Vec2::from_angle(-PI / 2.)));
for coord in polygon {
turtle_path.line_to(Vec2::from_array(*coord).rotate(Vec2::from_angle(-PI / 2.)));
}
turtle_path.close();
turtle_path.build()
}