Initial LinuxCNC WebAssembly workspace snapshot

This commit is contained in:
2026-08-20 18:21:15 +08:00
commit 5dd614c335
92 changed files with 200203 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#include "sim_posemath.h"
#include <assert.h>
#include <math.h>
int main(void) {
sim_posemath_cartesian input = {3.0, 4.0, 0.0};
sim_posemath_cartesian output = {0};
sim_posemath_cartesian end = {10.0, 10.0, 10.0};
double dot = 0;
assert(sim_posemath_normalize(&input, &output) == SIM_POSEMATH_OK);
assert(fabs(output.x - 0.6) < 1e-12 && fabs(output.y - 0.8) < 1e-12);
assert(sim_posemath_dot(&input, &end, &dot) == SIM_POSEMATH_OK && dot == 70.0);
assert(sim_posemath_line_point(&input, &end, 0.5, &output) == SIM_POSEMATH_OK);
assert(output.x == 6.5 && output.y == 7.0 && output.z == 5.0);
assert(sim_posemath_line_point(&input, &end, 1.1, &output) == SIM_POSEMATH_ERR_RANGE);
input.x = NAN;
assert(sim_posemath_normalize(&input, &output) == SIM_POSEMATH_ERR_ARGUMENT);
input.x = 0.0; input.y = 0.0; input.z = 0.0;
assert(sim_posemath_normalize(&input, &output) == SIM_POSEMATH_ERR_DEGENERATE);
return 0;
}