Skip to content

Commit

Permalink
Updated wasm crate; Removed old file
Browse files Browse the repository at this point in the history
  • Loading branch information
gammelalf committed Jun 10, 2022
1 parent f256396 commit b628def
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 194 deletions.
189 changes: 0 additions & 189 deletions src/polynomial.rs

This file was deleted.

1 change: 1 addition & 0 deletions wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ serde = { version = "1.0", features = ["derive"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
js-sys = "0.3"
web-sys = { version = "0.3", features = ["CanvasRenderingContext2d"] }
nalgebra = "0.31"
gammalg = { version = "0.1.0", path = ".." }
10 changes: 5 additions & 5 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Deserialize;
use wasm_bindgen::prelude::*;
use js_sys::Array;
use web_sys::CanvasRenderingContext2d;
use gammalg::vector::Vector;
use nalgebra::Vector2;
use gammalg::bezier::BezierCurve;
use gammalg::bounding_box::BoundingBox;
use gammalg::graham_scan::convex_hull;
Expand All @@ -12,9 +12,9 @@ pub struct Point {
pub x: f64,
pub y: f64,
}
impl From<Point> for Vector<f64, 2> {
impl From<Point> for Vector2<f64> {
fn from(p: Point) -> Self {
Vector([p.x, p.y])
Vector2::new(p.x, p.y)
}
}

Expand Down Expand Up @@ -151,9 +151,9 @@ impl Curve {
let width = ctx.line_width();
let fill = ctx.fill_style();
let points = self.0.get_intersections(&other.0);
for Vector([x, y]) in points.into_iter() {
for v in points.into_iter() {
ctx.begin_path();
ctx.arc(x, y, width, 0.0, 6.28);
ctx.arc(v.x, v.y, width, 0.0, 6.28);
ctx.set_fill_style(color);
ctx.fill();
ctx.set_fill_style(&fill);
Expand Down

0 comments on commit b628def

Please sign in to comment.