Compare commits
7 Commits
kurt-reduc
...
mike/relat
Author | SHA1 | Date | |
---|---|---|---|
b4cadd8cbb | |||
219a0b7a88 | |||
da9117c8a4 | |||
0d038f5717 | |||
da6e158524 | |||
c1d2cd5f51 | |||
93d36796df |
@ -57,7 +57,7 @@
|
||||
"zustand": "^4.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"start": "BROWSER=none vite",
|
||||
"build": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source \"$HOME/.cargo/env\" && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y && yarn build:wasm && vite build",
|
||||
"build:local": "vite build",
|
||||
"build:both": "vite build",
|
||||
|
2
src/wasm-lib/Cargo.lock
generated
2
src/wasm-lib/Cargo.lock
generated
@ -1316,8 +1316,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kittycad"
|
||||
version = "0.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9cf962b1e81a0b4eb923a727e761b40672cbacc7f5f0b75e13579d346352bc7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -11,7 +11,8 @@ crate-type = ["cdylib"]
|
||||
bson = { version = "2.7.0", features = ["uuid-1", "chrono"] }
|
||||
gloo-utils = "0.2.0"
|
||||
kcl-lib = { path = "kcl" }
|
||||
kittycad = { version = "0.2.25", default-features = false, features = ["js"] }
|
||||
#kittycad = { version = "0.2.25", default-features = false, features = ["js"] }
|
||||
kittycad = { git = "https://github.com/KittyCAD/kittycad.rs", branch = "achalmers/relative-path-segments" }
|
||||
serde_json = "1.0.107"
|
||||
uuid = { version = "1.4.1", features = ["v4", "js", "serde"] }
|
||||
wasm-bindgen = "0.2.87"
|
||||
@ -20,7 +21,8 @@ wasm-bindgen-futures = "0.4.37"
|
||||
[dev-dependencies]
|
||||
anyhow = "1"
|
||||
image = "0.24.7"
|
||||
kittycad = "0.2.25"
|
||||
#kittycad = "0.2.25"
|
||||
kittycad = { git = "https://github.com/KittyCAD/kittycad.rs", branch = "achalmers/relative-path-segments" }
|
||||
pretty_assertions = "1.4.0"
|
||||
reqwest = { version = "0.11.20", default-features = false }
|
||||
tokio = { version = "1.32.0", features = ["rt-multi-thread", "macros", "time"] }
|
||||
|
@ -14,7 +14,7 @@ clap = { version = "4.4.3", features = ["cargo", "derive", "env", "unicode"], op
|
||||
dashmap = "5.5.3"
|
||||
#derive-docs = { version = "0.1.4" }
|
||||
derive-docs = { path = "../derive-docs" }
|
||||
kittycad = { version = "0.2.25", default-features = false, features = ["js"] }
|
||||
kittycad = { git = "https://github.com/KittyCAD/kittycad.rs", branch = "achalmers/relative-path-segments", default-features = false, features = ["js"] }
|
||||
lazy_static = "1.4.0"
|
||||
parse-display = "0.8.2"
|
||||
regex = "1.7.1"
|
||||
|
@ -67,6 +67,7 @@ fn inner_line_to(
|
||||
y: to[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative: false,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
@ -201,6 +202,7 @@ fn inner_line(data: LineData, sketch_group: Box<SketchGroup>, args: &mut Args) -
|
||||
LineData::Point(to) => *to,
|
||||
};
|
||||
|
||||
let delta = inner_args;
|
||||
let to = [from.x + inner_args[0], from.y + inner_args[1]];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
@ -211,10 +213,11 @@ fn inner_line(data: LineData, sketch_group: Box<SketchGroup>, args: &mut Args) -
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Line {
|
||||
end: Point3D {
|
||||
x: to[0],
|
||||
y: to[1],
|
||||
x: delta[0],
|
||||
y: delta[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative: true
|
||||
},
|
||||
},
|
||||
)?;
|
||||
@ -349,9 +352,17 @@ fn inner_angled_line(
|
||||
AngledLineData::AngleWithTag { angle, length, .. } => (*angle, *length),
|
||||
AngledLineData::AngleAndLength(angle_and_length) => (angle_and_length[0], angle_and_length[1]),
|
||||
};
|
||||
|
||||
//double check me on this one - mike
|
||||
let delta: [f64; 2] = [
|
||||
length * f64::cos(angle.to_radians()),
|
||||
length * f64::sin(angle.to_radians()),
|
||||
];
|
||||
let relative = true;
|
||||
|
||||
let to: [f64; 2] = [
|
||||
from.x + length * f64::cos(angle.to_radians()),
|
||||
from.y + length * f64::sin(angle.to_radians()),
|
||||
from.x + delta[0],
|
||||
from.y + delta[1],
|
||||
];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
@ -378,10 +389,11 @@ fn inner_angled_line(
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Line {
|
||||
end: Point3D {
|
||||
x: to[0],
|
||||
y: to[1],
|
||||
x: delta[0],
|
||||
y: delta[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative: relative,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
@ -832,9 +844,14 @@ fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: &mut Args) ->
|
||||
angle_end: angle_end.degrees(),
|
||||
center: center.into(),
|
||||
radius,
|
||||
relative: false,
|
||||
},
|
||||
},
|
||||
)?;
|
||||
|
||||
// TODO: Dont do this (move path pen) - mike
|
||||
// lets review what the needs are here and see if any existing arc endpoints can accomplish this
|
||||
|
||||
// Move the path pen to the end of the arc.
|
||||
// Since that is where we want to draw the next path.
|
||||
// TODO: the engine should automatically move the pen to the end of the arc.
|
||||
@ -927,6 +944,8 @@ fn inner_bezier_curve(
|
||||
BezierData::Points { to, control1, control2 } => (to, control1, control2),
|
||||
};
|
||||
|
||||
let relative = true;
|
||||
let delta = to;
|
||||
let to = [from.x + to[0], from.y + to[1]];
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
@ -937,20 +956,21 @@ fn inner_bezier_curve(
|
||||
path: sketch_group.id,
|
||||
segment: kittycad::types::PathSegment::Bezier {
|
||||
control1: Point3D {
|
||||
x: from.x + control1[0],
|
||||
y: from.y + control1[1],
|
||||
x: control1[0],
|
||||
y: control1[1],
|
||||
z: 0.0,
|
||||
},
|
||||
control2: Point3D {
|
||||
x: from.x + control2[0],
|
||||
y: from.y + control2[1],
|
||||
x: control2[0],
|
||||
y: control2[1],
|
||||
z: 0.0,
|
||||
},
|
||||
end: Point3D {
|
||||
x: to[0],
|
||||
y: to[1],
|
||||
x: delta[0],
|
||||
y: delta[1],
|
||||
z: 0.0,
|
||||
},
|
||||
relative: relative
|
||||
},
|
||||
},
|
||||
)?;
|
||||
|
Reference in New Issue
Block a user