Change coefficients to bare number type
This commit is contained in:
@ -1784,8 +1784,8 @@ async fn inner_subtract_2d(
|
||||
pub async fn elliptic_point(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let x = args.get_kw_arg_opt("x", &RuntimeType::length(), exec_state)?;
|
||||
let y = args.get_kw_arg_opt("y", &RuntimeType::length(), exec_state)?;
|
||||
let major_radius = args.get_kw_arg("majorRadius", &RuntimeType::count(), exec_state)?;
|
||||
let minor_radius = args.get_kw_arg("minorRadius", &RuntimeType::count(), exec_state)?;
|
||||
let major_radius = args.get_kw_arg("majorRadius", &RuntimeType::num_any(), exec_state)?;
|
||||
let minor_radius = args.get_kw_arg("minorRadius", &RuntimeType::num_any(), exec_state)?;
|
||||
|
||||
let elliptic_point = inner_elliptic_point(x, y, major_radius, minor_radius, &args).await?;
|
||||
|
||||
@ -1948,8 +1948,8 @@ pub(crate) async fn inner_elliptic(
|
||||
pub async fn hyperbolic_point(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let x = args.get_kw_arg_opt("x", &RuntimeType::length(), exec_state)?;
|
||||
let y = args.get_kw_arg_opt("y", &RuntimeType::length(), exec_state)?;
|
||||
let semi_major = args.get_kw_arg("semiMajor", &RuntimeType::count(), exec_state)?;
|
||||
let semi_minor = args.get_kw_arg("semiMinor", &RuntimeType::count(), exec_state)?;
|
||||
let semi_major = args.get_kw_arg("semiMajor", &RuntimeType::num_any(), exec_state)?;
|
||||
let semi_minor = args.get_kw_arg("semiMinor", &RuntimeType::num_any(), exec_state)?;
|
||||
|
||||
let hyperbolic_point = inner_hyperbolic_point(x, y, semi_major, semi_minor, &args).await?;
|
||||
|
||||
@ -2113,7 +2113,11 @@ pub(crate) async fn inner_hyperbolic(
|
||||
pub async fn parabolic_point(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let x = args.get_kw_arg_opt("x", &RuntimeType::length(), exec_state)?;
|
||||
let y = args.get_kw_arg_opt("y", &RuntimeType::length(), exec_state)?;
|
||||
let coefficients = args.get_kw_arg("coefficients", &RuntimeType::any_array(), exec_state)?;
|
||||
let coefficients = args.get_kw_arg(
|
||||
"coefficients",
|
||||
&RuntimeType::Array(Box::new(RuntimeType::num_any()), ArrayLen::Known(3)),
|
||||
exec_state,
|
||||
)?;
|
||||
|
||||
let parabolic_point = inner_parabolic_point(x, y, &coefficients, &args).await?;
|
||||
|
||||
@ -2149,7 +2153,11 @@ pub async fn parabolic(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
||||
exec_state.warn(crate::CompilationError { source_range: args.source_range, message: "Use of parabolic is currently experimental and the interface may change.".to_string(), suggestion: None, severity: crate::errors::Severity::Warning, tag: crate::errors::Tag::None });
|
||||
let sketch = args.get_unlabeled_kw_arg("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||
|
||||
let coefficients = args.get_kw_arg_opt("coefficients", &RuntimeType::any_array(), exec_state)?;
|
||||
let coefficients = args.get_kw_arg_opt(
|
||||
"coefficients",
|
||||
&RuntimeType::Array(Box::new(RuntimeType::num_any()), ArrayLen::Known(3)),
|
||||
exec_state,
|
||||
)?;
|
||||
let interior = args.get_kw_arg_opt("interior", &RuntimeType::point2d(), exec_state)?;
|
||||
let end = args.get_kw_arg_opt("end", &RuntimeType::point2d(), exec_state)?;
|
||||
let interior_absolute = args.get_kw_arg_opt("interiorAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||
@ -2336,7 +2344,11 @@ pub async fn conic(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
||||
let interior = args.get_kw_arg_opt("interior", &RuntimeType::point2d(), exec_state)?;
|
||||
let end_absolute = args.get_kw_arg_opt("endAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||
let interior_absolute = args.get_kw_arg_opt("interiorAbsolute", &RuntimeType::point2d(), exec_state)?;
|
||||
let coefficients = args.get_kw_arg_opt("coefficients", &RuntimeType::any_array(), exec_state)?;
|
||||
let coefficients = args.get_kw_arg_opt(
|
||||
"coefficients",
|
||||
&RuntimeType::Array(Box::new(RuntimeType::num_any()), ArrayLen::Known(6)),
|
||||
exec_state,
|
||||
)?;
|
||||
let tag = args.get_kw_arg_opt("tag", &RuntimeType::tag_decl(), exec_state)?;
|
||||
|
||||
let new_sketch = inner_conic(
|
||||
|
@ -1991,7 +1991,7 @@ export fn conic(
|
||||
/// Where should this segment end? This point is relative to the start point. Requires `interior`. Incompatible with `interiorAbsolute` or `endAbsolute`.
|
||||
end?: Point2d,
|
||||
/// The coefficients [a, b, c, d, e, f] of the generic conic equation ax^2 + by^2 + cxy + dx + ey + f = 0. If provided the start and end tangents will be calculated using this equation. Incompatible with `startTangent` and `endTangent`.
|
||||
coefficients?: [number(Count); 6],
|
||||
coefficients?: [number; 6],
|
||||
/// The tangent of the conic section at the start. If not provided the tangent of the previous path segment is used. Incompatible with `coefficients`.
|
||||
startTangent?: Point2d,
|
||||
/// The tangent of the conic section at the end. Incompatible with `coefficients`. Incompatible with `coefficients`.
|
||||
@ -2020,7 +2020,7 @@ export fn parabolic(
|
||||
/// Where should this segment end? Requires `interiorAbsolute`. Incompatible with `interior` or `end`.
|
||||
endAbsolute?: Point2d,
|
||||
/// The coefficients [a, b, c] of the parabolic equation y = ax^2 + bx + c. Incompatible with `interior`.
|
||||
coefficients?: [number(Count); 3],
|
||||
coefficients?: [number; 3],
|
||||
/// A point between the segment's start and end that lies on the parabola. Incompatible with `coefficients` or `interiorAbsolute` or `endAbsolute`.
|
||||
interior?: Point2d,
|
||||
/// Any point between the segment's start and end. Requires `endAbsolute`. Incompatible with `coefficients` or `interior` or `end`.
|
||||
@ -2040,7 +2040,7 @@ export fn parabolic(
|
||||
@(impl = std_rust)
|
||||
export fn parabolicPoint(
|
||||
/// The coefficients [a, b, c] of the parabolic equation y = ax^2 + bx + c.
|
||||
coefficients: [number(Count); 3],
|
||||
coefficients: [number; 3],
|
||||
/// The x value. Calculates y and returns (x, y). Incompatible with `y`.
|
||||
x?: number(Length),
|
||||
/// The y value. Calculates x and returns (x, y). Incompatible with `x`.
|
||||
@ -2088,9 +2088,9 @@ export fn hyperbolic(
|
||||
@(impl = std_rust)
|
||||
export fn hyperbolicPoint(
|
||||
/// The semi major value, a, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
|
||||
semiMajor: number(Count),
|
||||
semiMajor: number,
|
||||
/// The semi minor value, b, of the hyperbolic equation x^2 / a ^ 2 - y^2 / b^2 = 1.
|
||||
semiMinor: number(Count),
|
||||
semiMinor: number,
|
||||
/// The x value. Calculates y and returns (x, y). Incompatible with `y`.
|
||||
x?: number(Length),
|
||||
/// The y value. Calculates x and returns (x, y). Incompatible with `x`.
|
||||
@ -2144,9 +2144,9 @@ export fn elliptic(
|
||||
@(impl = std_rust)
|
||||
export fn ellipticPoint(
|
||||
/// The major radius, a, of the elliptic equation x^2 / a ^ 2 + y^2 / b^2 = 1.
|
||||
majorRadius: number(Count),
|
||||
majorRadius: number,
|
||||
/// The minor radius, b, of the hyperbolic equation x^2 / a ^ 2 + y^2 / b^2 = 1.
|
||||
minorRadius: number(Count),
|
||||
minorRadius: number,
|
||||
/// The x value. Calculates y and returns (x, y). Incompatible with `y`.
|
||||
x?: number(Length),
|
||||
/// The y value. Calculates x and returns (x, y). Incompatible with `x`.
|
||||
|
Reference in New Issue
Block a user