nannou
nannou copied to clipboard
Ellipse is calculating the stroke tolerance using the draw 'size' rather than the pixel size
use nannou::{prelude::*, lyon::{geom::euclid::num::Round, lyon_tessellation::LineCap}};
use nannou::rand::rngs::StdRng;
use nannou::rand::{Rng, SeedableRng};
fn main() {
println!("{}", vec2(3.0, 3.0)/vec2(2.0, 4.0));
nannou::sketch(view).run();
}
struct Model{
act_random_seed: u64,
stroke_cap: LineCap,
mouse_pos: Point2,
}
fn view(app: &App, frame: Frame){
let mut draw = app.draw();
draw = draw.scale_axes((app.window_rect().wh()).extend(1.0));
draw.background().color(WHITE);
draw.ellipse().wh(vec2(1.0, 1.0)).no_fill().stroke_weight(0.1).stroke_color(BLACK);
draw.to_frame(app, &frame).unwrap();
}
This code produces a hexagon rather than a circle.
The reason for this is that I've changed the draw coordinates so that that they extend from -1.0 to +1.0 in both directions.