Compare commits
1 Commits
mike/relat
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
b2a2c487e1 |
@ -57,7 +57,7 @@
|
|||||||
"zustand": "^4.1.4"
|
"zustand": "^4.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "BROWSER=none vite",
|
"start": "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": "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:local": "vite build",
|
||||||
"build:both": "vite build",
|
"build:both": "vite build",
|
||||||
|
25
src/wasm-lib/Cargo.lock
generated
25
src/wasm-lib/Cargo.lock
generated
@ -220,6 +220,20 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bigdecimal"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "454bca3db10617b88b566f205ed190aedb0e0e6dd4cad61d3988a72e8c5594cb"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"libm",
|
||||||
|
"num-bigint",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bincode"
|
name = "bincode"
|
||||||
version = "1.3.3"
|
version = "1.3.3"
|
||||||
@ -1316,10 +1330,12 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad"
|
name = "kittycad"
|
||||||
version = "0.2.25"
|
version = "0.2.25"
|
||||||
|
source = "git+https://github.com/KittyCAD/kittycad.rs?branch=achalmers/relative-path-segments#4aa3cf1ed0b817e21b1676e3618e192a5acf3ed7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.21.4",
|
"base64 0.21.4",
|
||||||
|
"bigdecimal 0.4.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@ -1381,6 +1397,12 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libm"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
version = "0.5.6"
|
version = "0.5.6"
|
||||||
@ -2311,7 +2333,8 @@ version = "0.8.15"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c"
|
checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bigdecimal",
|
"bigdecimal 0.3.1",
|
||||||
|
"bigdecimal 0.4.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"dyn-clone",
|
"dyn-clone",
|
||||||
|
@ -11,8 +11,7 @@ crate-type = ["cdylib"]
|
|||||||
bson = { version = "2.7.0", features = ["uuid-1", "chrono"] }
|
bson = { version = "2.7.0", features = ["uuid-1", "chrono"] }
|
||||||
gloo-utils = "0.2.0"
|
gloo-utils = "0.2.0"
|
||||||
kcl-lib = { path = "kcl" }
|
kcl-lib = { path = "kcl" }
|
||||||
#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"] }
|
||||||
kittycad = { git = "https://github.com/KittyCAD/kittycad.rs", branch = "achalmers/relative-path-segments" }
|
|
||||||
serde_json = "1.0.107"
|
serde_json = "1.0.107"
|
||||||
uuid = { version = "1.4.1", features = ["v4", "js", "serde"] }
|
uuid = { version = "1.4.1", features = ["v4", "js", "serde"] }
|
||||||
wasm-bindgen = "0.2.87"
|
wasm-bindgen = "0.2.87"
|
||||||
@ -21,7 +20,6 @@ wasm-bindgen-futures = "0.4.37"
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
image = "0.24.7"
|
image = "0.24.7"
|
||||||
#kittycad = "0.2.25"
|
|
||||||
kittycad = { git = "https://github.com/KittyCAD/kittycad.rs", branch = "achalmers/relative-path-segments" }
|
kittycad = { git = "https://github.com/KittyCAD/kittycad.rs", branch = "achalmers/relative-path-segments" }
|
||||||
pretty_assertions = "1.4.0"
|
pretty_assertions = "1.4.0"
|
||||||
reqwest = { version = "0.11.20", default-features = false }
|
reqwest = { version = "0.11.20", default-features = false }
|
||||||
@ -39,10 +37,10 @@ wasm-streams = "0.3.0"
|
|||||||
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
|
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
|
||||||
version = "0.3.57"
|
version = "0.3.57"
|
||||||
features = [
|
features = [
|
||||||
"console",
|
"console",
|
||||||
"HtmlTextAreaElement",
|
"HtmlTextAreaElement",
|
||||||
"ReadableStream",
|
"ReadableStream",
|
||||||
"WritableStream",
|
"WritableStream",
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
@ -51,8 +49,8 @@ debug = true
|
|||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"derive-docs",
|
"derive-docs",
|
||||||
"kcl",
|
"kcl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
|
@ -67,7 +67,6 @@ fn inner_line_to(
|
|||||||
y: to[1],
|
y: to[1],
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
},
|
},
|
||||||
relative: false,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
@ -202,7 +201,6 @@ fn inner_line(data: LineData, sketch_group: Box<SketchGroup>, args: &mut Args) -
|
|||||||
LineData::Point(to) => *to,
|
LineData::Point(to) => *to,
|
||||||
};
|
};
|
||||||
|
|
||||||
let delta = inner_args;
|
|
||||||
let to = [from.x + inner_args[0], from.y + inner_args[1]];
|
let to = [from.x + inner_args[0], from.y + inner_args[1]];
|
||||||
|
|
||||||
let id = uuid::Uuid::new_v4();
|
let id = uuid::Uuid::new_v4();
|
||||||
@ -213,11 +211,10 @@ fn inner_line(data: LineData, sketch_group: Box<SketchGroup>, args: &mut Args) -
|
|||||||
path: sketch_group.id,
|
path: sketch_group.id,
|
||||||
segment: kittycad::types::PathSegment::Line {
|
segment: kittycad::types::PathSegment::Line {
|
||||||
end: Point3D {
|
end: Point3D {
|
||||||
x: delta[0],
|
x: to[0],
|
||||||
y: delta[1],
|
y: to[1],
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
},
|
},
|
||||||
relative: true
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
@ -352,17 +349,9 @@ fn inner_angled_line(
|
|||||||
AngledLineData::AngleWithTag { angle, length, .. } => (*angle, *length),
|
AngledLineData::AngleWithTag { angle, length, .. } => (*angle, *length),
|
||||||
AngledLineData::AngleAndLength(angle_and_length) => (angle_and_length[0], angle_and_length[1]),
|
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] = [
|
let to: [f64; 2] = [
|
||||||
from.x + delta[0],
|
from.x + length * f64::cos(angle.to_radians()),
|
||||||
from.y + delta[1],
|
from.y + length * f64::sin(angle.to_radians()),
|
||||||
];
|
];
|
||||||
|
|
||||||
let id = uuid::Uuid::new_v4();
|
let id = uuid::Uuid::new_v4();
|
||||||
@ -389,11 +378,10 @@ fn inner_angled_line(
|
|||||||
path: sketch_group.id,
|
path: sketch_group.id,
|
||||||
segment: kittycad::types::PathSegment::Line {
|
segment: kittycad::types::PathSegment::Line {
|
||||||
end: Point3D {
|
end: Point3D {
|
||||||
x: delta[0],
|
x: to[0],
|
||||||
y: delta[1],
|
y: to[1],
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
},
|
},
|
||||||
relative: relative,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
@ -844,14 +832,9 @@ fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: &mut Args) ->
|
|||||||
angle_end: angle_end.degrees(),
|
angle_end: angle_end.degrees(),
|
||||||
center: center.into(),
|
center: center.into(),
|
||||||
radius,
|
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.
|
// Move the path pen to the end of the arc.
|
||||||
// Since that is where we want to draw the next path.
|
// 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.
|
// TODO: the engine should automatically move the pen to the end of the arc.
|
||||||
@ -944,8 +927,6 @@ fn inner_bezier_curve(
|
|||||||
BezierData::Points { to, control1, control2 } => (to, control1, control2),
|
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 to = [from.x + to[0], from.y + to[1]];
|
||||||
|
|
||||||
let id = uuid::Uuid::new_v4();
|
let id = uuid::Uuid::new_v4();
|
||||||
@ -956,21 +937,20 @@ fn inner_bezier_curve(
|
|||||||
path: sketch_group.id,
|
path: sketch_group.id,
|
||||||
segment: kittycad::types::PathSegment::Bezier {
|
segment: kittycad::types::PathSegment::Bezier {
|
||||||
control1: Point3D {
|
control1: Point3D {
|
||||||
x: control1[0],
|
x: from.x + control1[0],
|
||||||
y: control1[1],
|
y: from.y + control1[1],
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
},
|
},
|
||||||
control2: Point3D {
|
control2: Point3D {
|
||||||
x: control2[0],
|
x: from.x + control2[0],
|
||||||
y: control2[1],
|
y: from.y + control2[1],
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
},
|
},
|
||||||
end: Point3D {
|
end: Point3D {
|
||||||
x: delta[0],
|
x: to[0],
|
||||||
y: delta[1],
|
y: to[1],
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
},
|
},
|
||||||
relative: relative
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
Reference in New Issue
Block a user