Typo: tangental should be tangential (#842)

* Typo: tangental should be tangential

* Run executor tests in serial

* Fix typo in image file names
This commit is contained in:
Adam Chalmers
2023-10-12 11:50:54 -05:00
committed by GitHub
parent 396a994fe6
commit 5af9c6b22d
10 changed files with 61 additions and 61 deletions

View File

@ -17481,16 +17481,16 @@
"deprecated": false "deprecated": false
}, },
{ {
"name": "tangentalArc", "name": "tangentialArc",
"summary": "Draw an arc.", "summary": "Draw an arc.",
"description": "", "description": "",
"tags": [], "tags": [],
"args": [ "args": [
{ {
"name": "data", "name": "data",
"type": "TangentalArcData", "type": "TangentialArcData",
"schema": { "schema": {
"description": "Data to draw a tangental arc.", "description": "Data to draw a tangential arc.",
"anyOf": [ "anyOf": [
{ {
"type": "object", "type": "object",
@ -18432,16 +18432,16 @@
"deprecated": false "deprecated": false
}, },
{ {
"name": "tangentalArcTo", "name": "tangentialArcTo",
"summary": "Draw an arc.", "summary": "Draw an arc.",
"description": "", "description": "",
"tags": [], "tags": [],
"args": [ "args": [
{ {
"name": "data", "name": "data",
"type": "TangentalArcToData", "type": "TangentialArcToData",
"schema": { "schema": {
"description": "Data to draw a tangental arc to a specific point.", "description": "Data to draw a tangential arc to a specific point.",
"anyOf": [ "anyOf": [
{ {
"description": "A point with a tag.", "description": "A point with a tag.",

View File

@ -52,8 +52,8 @@
* [`startSketchAt`](#startSketchAt) * [`startSketchAt`](#startSketchAt)
* [`startSketchOn`](#startSketchOn) * [`startSketchOn`](#startSketchOn)
* [`tan`](#tan) * [`tan`](#tan)
* [`tangentalArc`](#tangentalArc) * [`tangentialArc`](#tangentialArc)
* [`tangentalArcTo`](#tangentalArcTo) * [`tangentialArcTo`](#tangentialArcTo)
* [`tau`](#tau) * [`tau`](#tau)
* [`xLine`](#xLine) * [`xLine`](#xLine)
* [`xLineTo`](#xLineTo) * [`xLineTo`](#xLineTo)
@ -3520,19 +3520,19 @@ tan(num: number) -> number
### tangentalArc ### tangentialArc
Draw an arc. Draw an arc.
``` ```
tangentalArc(data: TangentalArcData, sketch_group: SketchGroup) -> SketchGroup tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup
``` ```
#### Arguments #### Arguments
* `data`: `TangentalArcData` - Data to draw a tangental arc. * `data`: `TangentialArcData` - Data to draw a tangential arc.
``` ```
{ {
// Offset of the arc, in degrees. // Offset of the arc, in degrees.
@ -3684,19 +3684,19 @@ tangentalArc(data: TangentalArcData, sketch_group: SketchGroup) -> SketchGroup
### tangentalArcTo ### tangentialArcTo
Draw an arc. Draw an arc.
``` ```
tangentalArcTo(data: TangentalArcToData, sketch_group: SketchGroup) -> SketchGroup tangentialArcTo(data: TangentialArcToData, sketch_group: SketchGroup) -> SketchGroup
``` ```
#### Arguments #### Arguments
* `data`: `TangentalArcToData` - Data to draw a tangental arc to a specific point. * `data`: `TangentialArcToData` - Data to draw a tangential arc to a specific point.
``` ```
{ {
// The tag. // The tag.

View File

@ -11,14 +11,14 @@ const wallMountL = 8
const bracket = startSketchOn('XY') const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0, wallMountL], %) |> line([0, wallMountL], %)
|> tangentalArc({ |> tangentialArc({
radius: filletR, radius: filletR,
offset: 90 offset: 90
}, %) }, %)
|> line([-shelfMountL, 0], %) |> line([-shelfMountL, 0], %)
|> line([0, -thickness], %) |> line([0, -thickness], %)
|> line([shelfMountL, 0], %) |> line([shelfMountL, 0], %)
|> tangentalArc({ |> tangentialArc({
radius: filletR - thickness, radius: filletR - thickness,
offset: -90 offset: -90
}, %) }, %)

View File

@ -1682,7 +1682,7 @@ const mySk1 = startSketchAt([0, 0])"#;
for (i, test_program) in [ for (i, test_program) in [
r#"const boxSketch = startSketchAt([0, 0]) r#"const boxSketch = startSketchAt([0, 0])
|> line([0, 10], %) |> line([0, 10], %)
|> tangentalArc([-5, 5], %) |> tangentialArc([-5, 5], %)
|> line([5, -15], %) |> line([5, -15], %)
|> extrude(10, %) |> extrude(10, %)
"#, "#,

View File

@ -63,8 +63,8 @@ impl StdLib {
Box::new(crate::std::sketch::StartProfileAt), Box::new(crate::std::sketch::StartProfileAt),
Box::new(crate::std::sketch::Close), Box::new(crate::std::sketch::Close),
Box::new(crate::std::sketch::Arc), Box::new(crate::std::sketch::Arc),
Box::new(crate::std::sketch::TangentalArc), Box::new(crate::std::sketch::TangentialArc),
Box::new(crate::std::sketch::TangentalArcTo), Box::new(crate::std::sketch::TangentialArcTo),
Box::new(crate::std::sketch::BezierCurve), Box::new(crate::std::sketch::BezierCurve),
Box::new(crate::std::math::Cos), Box::new(crate::std::math::Cos),
Box::new(crate::std::math::Sin), Box::new(crate::std::math::Sin),

View File

@ -1080,11 +1080,11 @@ async fn inner_arc(data: ArcData, sketch_group: Box<SketchGroup>, args: Args) ->
Ok(new_sketch_group) Ok(new_sketch_group)
} }
/// Data to draw a tangental arc. /// Data to draw a tangential arc.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)]
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase", untagged)] #[serde(rename_all = "camelCase", untagged)]
pub enum TangentalArcData { pub enum TangentialArcData {
RadiusAndOffset { RadiusAndOffset {
/// Radius of the arc. /// Radius of the arc.
/// Not to be confused with Raiders of the Lost Ark. /// Not to be confused with Raiders of the Lost Ark.
@ -1103,20 +1103,20 @@ pub enum TangentalArcData {
Point([f64; 2]), Point([f64; 2]),
} }
/// Draw a tangental arc. /// Draw a tangential arc.
pub async fn tangental_arc(args: Args) -> Result<MemoryItem, KclError> { pub async fn tangential_arc(args: Args) -> Result<MemoryItem, KclError> {
let (data, sketch_group): (TangentalArcData, Box<SketchGroup>) = args.get_data_and_sketch_group()?; let (data, sketch_group): (TangentialArcData, Box<SketchGroup>) = args.get_data_and_sketch_group()?;
let new_sketch_group = inner_tangental_arc(data, sketch_group, args).await?; let new_sketch_group = inner_tangential_arc(data, sketch_group, args).await?;
Ok(MemoryItem::SketchGroup(new_sketch_group)) Ok(MemoryItem::SketchGroup(new_sketch_group))
} }
/// Draw an arc. /// Draw an arc.
#[stdlib { #[stdlib {
name = "tangentalArc", name = "tangentialArc",
}] }]
async fn inner_tangental_arc( async fn inner_tangential_arc(
data: TangentalArcData, data: TangentialArcData,
sketch_group: Box<SketchGroup>, sketch_group: Box<SketchGroup>,
args: Args, args: Args,
) -> Result<Box<SketchGroup>, KclError> { ) -> Result<Box<SketchGroup>, KclError> {
@ -1125,7 +1125,7 @@ async fn inner_tangental_arc(
let id = uuid::Uuid::new_v4(); let id = uuid::Uuid::new_v4();
let to = match &data { let to = match &data {
TangentalArcData::RadiusAndOffset { radius, offset } => { TangentialArcData::RadiusAndOffset { radius, offset } => {
// Calculate the end point from the angle and radius. // Calculate the end point from the angle and radius.
let end_angle = Angle::from_degrees(*offset); let end_angle = Angle::from_degrees(*offset);
let start_angle = Angle::from_degrees(0.0); let start_angle = Angle::from_degrees(0.0);
@ -1147,7 +1147,7 @@ async fn inner_tangental_arc(
.await?; .await?;
to.into() to.into()
} }
TangentalArcData::PointWithTag { to, .. } => { TangentialArcData::PointWithTag { to, .. } => {
args.send_modeling_cmd( args.send_modeling_cmd(
id, id,
ModelingCmd::ExtendPath { ModelingCmd::ExtendPath {
@ -1166,7 +1166,7 @@ async fn inner_tangental_arc(
*to *to
} }
TangentalArcData::Point(to) => { TangentialArcData::Point(to) => {
args.send_modeling_cmd( args.send_modeling_cmd(
id, id,
ModelingCmd::ExtendPath { ModelingCmd::ExtendPath {
@ -1207,11 +1207,11 @@ async fn inner_tangental_arc(
Ok(new_sketch_group) Ok(new_sketch_group)
} }
/// Data to draw a tangental arc to a specific point. /// Data to draw a tangential arc to a specific point.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)]
#[ts(export)] #[ts(export)]
#[serde(rename_all = "camelCase", untagged)] #[serde(rename_all = "camelCase", untagged)]
pub enum TangentalArcToData { pub enum TangentialArcToData {
/// A point with a tag. /// A point with a tag.
PointWithTag { PointWithTag {
/// Where the arc should end. Must lie in the same plane as the current path pen position. Must not be colinear with current path pen position. /// Where the arc should end. Must lie in the same plane as the current path pen position. Must not be colinear with current path pen position.
@ -1223,27 +1223,27 @@ pub enum TangentalArcToData {
Point([f64; 2]), Point([f64; 2]),
} }
/// Draw a tangental arc to a specific point. /// Draw a tangential arc to a specific point.
pub async fn tangental_arc_to(args: Args) -> Result<MemoryItem, KclError> { pub async fn tangential_arc_to(args: Args) -> Result<MemoryItem, KclError> {
let (data, sketch_group): (TangentalArcToData, Box<SketchGroup>) = args.get_data_and_sketch_group()?; let (data, sketch_group): (TangentialArcToData, Box<SketchGroup>) = args.get_data_and_sketch_group()?;
let new_sketch_group = inner_tangental_arc_to(data, sketch_group, args).await?; let new_sketch_group = inner_tangential_arc_to(data, sketch_group, args).await?;
Ok(MemoryItem::SketchGroup(new_sketch_group)) Ok(MemoryItem::SketchGroup(new_sketch_group))
} }
/// Draw an arc. /// Draw an arc.
#[stdlib { #[stdlib {
name = "tangentalArcTo", name = "tangentialArcTo",
}] }]
async fn inner_tangental_arc_to( async fn inner_tangential_arc_to(
data: TangentalArcToData, data: TangentialArcToData,
sketch_group: Box<SketchGroup>, sketch_group: Box<SketchGroup>,
args: Args, args: Args,
) -> Result<Box<SketchGroup>, KclError> { ) -> Result<Box<SketchGroup>, KclError> {
let from: Point2d = sketch_group.get_coords_from_paths()?; let from: Point2d = sketch_group.get_coords_from_paths()?;
let to = match &data { let to = match &data {
TangentalArcToData::PointWithTag { to, .. } => to, TangentialArcToData::PointWithTag { to, .. } => to,
TangentalArcToData::Point(to) => to, TangentialArcToData::Point(to) => to,
}; };
let delta = [to[0] - from.x, to[1] - from.y]; let delta = [to[0] - from.x, to[1] - from.y];
@ -1270,7 +1270,7 @@ async fn inner_tangental_arc_to(
base: BasePath { base: BasePath {
from: from.into(), from: from.into(),
to: *to, to: *to,
name: if let TangentalArcToData::PointWithTag { tag, .. } = data { name: if let TangentialArcToData::PointWithTag { tag, .. } = data {
tag.to_string() tag.to_string()
} else { } else {
"".to_string() "".to_string()

View File

@ -173,14 +173,14 @@ const wallMountL = 8
const bracket = startSketchAt([0, 0]) const bracket = startSketchAt([0, 0])
|> line([0, wallMountL], %) |> line([0, wallMountL], %)
|> tangentalArc({ |> tangentialArc({
radius: filletR, radius: filletR,
offset: 90 offset: 90
}, %) }, %)
|> line([-shelfMountL, 0], %) |> line([-shelfMountL, 0], %)
|> line([0, -thickness], %) |> line([0, -thickness], %)
|> line([shelfMountL, 0], %) |> line([shelfMountL, 0], %)
|> tangentalArc({ |> tangentialArc({
radius: filletR - thickness, radius: filletR - thickness,
offset: -90 offset: -90
}, %) }, %)
@ -231,7 +231,7 @@ async fn serial_test_execute_kittycad_svg() {
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_member_expression_sketch_group() { async fn serial_test_member_expression_sketch_group() {
let code = r#"fn cube = (pos, scale) => { let code = r#"fn cube = (pos, scale) => {
const sg = startSketchOn('XY') const sg = startSketchOn('XY')
|> startProfileAt(pos, %) |> startProfileAt(pos, %)
@ -260,7 +260,7 @@ show(b2)"#;
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_close_arc() { async fn serial_test_close_arc() {
let code = r#"const center = [0,0] let code = r#"const center = [0,0]
const radius = 40 const radius = 40
const height = 3 const height = 3
@ -278,7 +278,7 @@ show(body)"#;
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_negative_args() { async fn serial_test_negative_args() {
let code = r#"const width = 5 let code = r#"const width = 5
const height = 10 const height = 10
const length = 12 const length = 12
@ -304,46 +304,46 @@ box(-20, -5, 10)"#;
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_basic_tangental_arc() { async fn serial_test_basic_tangential_arc() {
let code = r#"const boxSketch = startSketchAt([0, 0]) let code = r#"const boxSketch = startSketchAt([0, 0])
|> line([0, 10], %) |> line([0, 10], %)
|> tangentalArc({radius: 5, offset: 90}, %) |> tangentialArc({radius: 5, offset: 90}, %)
|> line([5, -15], %) |> line([5, -15], %)
|> extrude(10, %) |> extrude(10, %)
"#; "#;
let result = execute_and_snapshot(code).await.unwrap(); let result = execute_and_snapshot(code).await.unwrap();
twenty_twenty::assert_image("tests/executor/outputs/tangental_arc.png", &result, 0.999); twenty_twenty::assert_image("tests/executor/outputs/tangential_arc.png", &result, 0.999);
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_basic_tangental_arc_with_point() { async fn serial_test_basic_tangential_arc_with_point() {
let code = r#"const boxSketch = startSketchAt([0, 0]) let code = r#"const boxSketch = startSketchAt([0, 0])
|> line([0, 10], %) |> line([0, 10], %)
|> tangentalArc([-5, 5], %) |> tangentialArc([-5, 5], %)
|> line([5, -15], %) |> line([5, -15], %)
|> extrude(10, %) |> extrude(10, %)
"#; "#;
let result = execute_and_snapshot(code).await.unwrap(); let result = execute_and_snapshot(code).await.unwrap();
twenty_twenty::assert_image("tests/executor/outputs/tangental_arc_with_point.png", &result, 0.999); twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_with_point.png", &result, 0.999);
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_basic_tangental_arc_to() { async fn serial_test_basic_tangential_arc_to() {
let code = r#"const boxSketch = startSketchAt([0, 0]) let code = r#"const boxSketch = startSketchAt([0, 0])
|> line([0, 10], %) |> line([0, 10], %)
|> tangentalArcTo([-5, 15], %) |> tangentialArcTo([-5, 15], %)
|> line([5, -15], %) |> line([5, -15], %)
|> extrude(10, %) |> extrude(10, %)
"#; "#;
let result = execute_and_snapshot(code).await.unwrap(); let result = execute_and_snapshot(code).await.unwrap();
twenty_twenty::assert_image("tests/executor/outputs/tangental_arc_to.png", &result, 0.999); twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_to.png", &result, 0.999);
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_different_planes_same_drawing() { async fn serial_test_different_planes_same_drawing() {
let code = r#"const width = 5 let code = r#"const width = 5
const height = 10 const height = 10
const length = 12 const length = 12
@ -374,7 +374,7 @@ box(-20, -5, 10, 'xy')"#;
} }
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn test_lots_of_planes() { async fn serial_test_lots_of_planes() {
let code = r#"const sigmaAllow = 15000 // psi let code = r#"const sigmaAllow = 15000 // psi
const width = 11 // inch const width = 11 // inch
const p = 150 // Force on shelf - lbs const p = 150 // Force on shelf - lbs
@ -388,11 +388,11 @@ const wallMountL = 8
const bracket = startSketchOn('XY') const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0, wallMountL], %) |> line([0, wallMountL], %)
|> tangentalArc({ radius: filletR, offset: 90 }, %) |> tangentialArc({ radius: filletR, offset: 90 }, %)
|> line([-shelfMountL, 0], %) |> line([-shelfMountL, 0], %)
|> line([0, -thickness], %) |> line([0, -thickness], %)
|> line([shelfMountL, 0], %) |> line([shelfMountL, 0], %)
|> tangentalArc({ |> tangentialArc({
radius: filletR - thickness, radius: filletR - thickness,
offset: -90 offset: -90
}, %) }, %)

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB