fix: gravity node
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m35s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m35s
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use nodarium_macros::include_definition_file;
|
||||
use nodarium_utils::{
|
||||
encode_float, evaluate_float, geometry::calculate_normals, set_panic_hook, split_args, wrap_arg,
|
||||
encode_float, evaluate_float, geometry::calculate_normals, log, set_panic_hook, split_args,
|
||||
wrap_arg,
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::console;
|
||||
|
||||
include_definition_file!("src/input.json");
|
||||
|
||||
@@ -15,7 +15,7 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
|
||||
let args = split_args(input);
|
||||
|
||||
console::log_1(&format!("WASM(cube): input: {:?} -> {:?}", input, args ).into());
|
||||
log!("WASM(cube): input: {:?} -> {:?}", input, args);
|
||||
|
||||
let size = evaluate_float(args[0]);
|
||||
|
||||
@@ -79,6 +79,10 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
|
||||
calculate_normals(&mut cube_geometry);
|
||||
|
||||
wrap_arg(&cube_geometry)
|
||||
let res = wrap_arg(&cube_geometry);
|
||||
|
||||
log!("WASM(cube): output: {:?}", res);
|
||||
|
||||
res
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
}
|
||||
|
||||
// Correct midpoint length
|
||||
mid_point *= mid_point.length() / length;
|
||||
mid_point *= length / mid_point.length();
|
||||
|
||||
let final_end_point = start_point + mid_point;
|
||||
let offset_end_point = end_point + offset_vec;
|
||||
|
||||
@@ -2,7 +2,7 @@ use nodarium_macros::include_definition_file;
|
||||
use nodarium_utils::{
|
||||
concat_args, evaluate_int,
|
||||
geometry::{extrude_path, wrap_path},
|
||||
log, split_args,
|
||||
log, set_panic_hook, split_args,
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
@@ -10,16 +10,17 @@ include_definition_file!("src/inputs.json");
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
utils::set_panic_hook();
|
||||
set_panic_hook();
|
||||
|
||||
let args = split_args(input);
|
||||
|
||||
log!("WASM(output) args: {:?}", args);
|
||||
|
||||
assert_eq!(args.len(), 2, "Expected 2 arguments, got {}", args.len());
|
||||
let inputs = split_args(args[0]);
|
||||
|
||||
let resolution = evaluate_int(args[1]) as usize;
|
||||
|
||||
log!("output inputs: {:?}", inputs);
|
||||
log!("inputs: {}, resolution: {}", inputs.len(), resolution);
|
||||
|
||||
let mut output: Vec<Vec<i32>> = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user