diff --git a/src/sconvcol.h b/src/sconvcol.h index 883706c..5451b6b 100644 --- a/src/sconvcol.h +++ b/src/sconvcol.h @@ -9,7 +9,7 @@ extern "C" { #include #include "vectorial/simd4x4f.h" -8 + inline bool sch_simd4f_equal(simd4f a, simd4f b) { return (simd4f_get_x(simd4f_length4_squared(simd4f_sub(a, b))) == 0.f); } @@ -101,9 +101,9 @@ SchHullResult sch_builder_create_hull(sch_hull_builder* builder, sch_hull* out_h // Calculations // -float sch_plane_distance(sch_plane* plane, simd4f* v); +float sch_plane_distance(const sch_plane* plane, const simd4f* v); -void sch_edge_get_dir(sch_edge* edge, simd4f* dir); +void sch_edge_get_dir(const sch_edge* edge, simd4f* out_dir); void sch_hull_free_memory (sch_hull* hull); @@ -127,7 +127,7 @@ void sch_create_face(int num_vert, simd4f* vertices, sch_face* out_face); #ifdef SCONVCOL_IMPLEMENTATION -float sch_plane_distance(sch_plane* plane, simd4f* v) { +float sch_plane_distance(const sch_plane* plane, const simd4f* v) { return simd4f_dot3_scalar(simd4f_sub(*v, plane->p), plane->n); } @@ -157,7 +157,7 @@ void sch_create_face(int num_vert, simd4f* vertices, sch_face* out_face) { out_face->edge = &f_edges[0]; } -void sch_edge_get_dir(sch_edge* edge, simd4f* out_dir) { +void sch_edge_get_dir(const sch_edge* edge, simd4f* out_dir) { *out_dir = simd4f_sub(edge->next->vert->p, edge->vert->p); float recip_len = 1.f / sqrtf(simd4f_dot3_scalar(*out_dir, *out_dir)); *out_dir = simd4f_mul(*out_dir, simd4f_splat(recip_len));