fix a bug with global rotation
This commit is contained in:
@@ -52,8 +52,9 @@ impl MyApp {
|
|||||||
teta: 0.0,
|
teta: 0.0,
|
||||||
polygons: vec![
|
polygons: vec![
|
||||||
//Polygon::n_gon(0.0, 12),
|
//Polygon::n_gon(0.0, 12),
|
||||||
Polygon::triangle(0.0),
|
//Polygon::triangle(0.0),
|
||||||
Polygon::square(PI / 4.0),
|
//Polygon::square(PI / 4.0),
|
||||||
|
Polygon::nr_6_in_30(1.5),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -76,7 +77,6 @@ impl MyApp {
|
|||||||
* (1.0 / self.nb_sec_for_rev as f32)
|
* (1.0 / self.nb_sec_for_rev as f32)
|
||||||
* (time_btw.as_millis() as f32 / 1_000.0);
|
* (time_btw.as_millis() as f32 / 1_000.0);
|
||||||
self.polys.teta %= 2.0 * PI;
|
self.polys.teta %= 2.0 * PI;
|
||||||
//println!("Teta : {}", self.polys.teta);
|
|
||||||
if self
|
if self
|
||||||
.polys
|
.polys
|
||||||
.have_point_polygon_btw(teta_temp, self.polys.teta)
|
.have_point_polygon_btw(teta_temp, self.polys.teta)
|
||||||
@@ -84,7 +84,6 @@ impl MyApp {
|
|||||||
self.audio_manager
|
self.audio_manager
|
||||||
.play(self.default_sound.clone())
|
.play(self.default_sound.clone())
|
||||||
.expect("Error to play sound");
|
.expect("Error to play sound");
|
||||||
//do_sound("assets/tick.mp3");
|
|
||||||
}
|
}
|
||||||
self.time_last_frame = Instant::now();
|
self.time_last_frame = Instant::now();
|
||||||
}
|
}
|
||||||
@@ -109,7 +108,7 @@ impl MyApp {
|
|||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
fn subscription(&self) -> iced::Subscription<Message> {
|
fn subscription(&self) -> iced::Subscription<Message> {
|
||||||
time::every(Duration::from_millis(1)).map(|_| Message::Tick)
|
time::every(Duration::from_millis(16)).map(|_| Message::Tick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -115,13 +115,10 @@ impl Polygon {
|
|||||||
}
|
}
|
||||||
let mut p_g;
|
let mut p_g;
|
||||||
for p in self.points_teta.clone() {
|
for p in self.points_teta.clone() {
|
||||||
p_g = p + self.global_teta;
|
p_g = (p + self.global_teta) % (2.0 * PI);
|
||||||
if before <= p_g && p_g <= after {
|
if before <= p_g && p_g <= after {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if p_g > after {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user