lj_templates_rust/src/draw.rs

20 lines
505 B
Rust

// This is where you can put your custom code
use crate::{Color, Point};
const RADIUS: f32 = 2000.0;
const X_CENTER: f32 = 2047.0;
const Y_CENTER: f32 = 2047.0;
pub fn draw() -> Result<Vec<Point>, Box<dyn std::error::Error>> {
let mut v: Vec<Point> = vec![];
for i in 0..128 {
let a = i as f32 / 128.0 * std::f32::consts::PI * 2.0;
v.push(Point {
x: (X_CENTER + a.cos() * RADIUS) as f32,
y: (Y_CENTER + a.sin() * RADIUS) as f32,
color: Color { r: 255, g: 255, b: 255 },
});
}
Ok(v)
}