Sierpinski curve: Difference between revisions

Content added Content deleted
m (Rust - reformatted with rustfmt)
m (Rust - use to_radians method)
Line 654: Line 654:
}
}
fn draw_line(&mut self, data: Data) -> Data {
fn draw_line(&mut self, data: Data) -> Data {
let theta = (self.current_angle as f64).to_radians();
use std::f64::consts::PI;
let theta = (PI * self.current_angle as f64) / 180.0;
self.current_x += self.line_length * theta.cos();
self.current_x += self.line_length * theta.cos();
self.current_y -= self.line_length * theta.sin();
self.current_y -= self.line_length * theta.sin();