aux/math: C export paranoia

This commit is contained in:
Jakob Bornecrantz 2019-07-21 13:40:00 +01:00 committed by Jakob Bornecrantz
parent 776c46713f
commit 505d5cf5d6
3 changed files with 16 additions and 18 deletions

View file

@ -56,7 +56,7 @@ copy(const struct xrt_vec3* v)
* *
*/ */
bool extern "C" bool
math_vec3_validate(const struct xrt_vec3* vec3) math_vec3_validate(const struct xrt_vec3* vec3)
{ {
assert(vec3 != NULL); assert(vec3 != NULL);
@ -67,7 +67,7 @@ math_vec3_validate(const struct xrt_vec3* vec3)
return true; return true;
} }
void extern "C" void
math_vec3_accum(const struct xrt_vec3* additional, struct xrt_vec3* inAndOut) math_vec3_accum(const struct xrt_vec3* additional, struct xrt_vec3* inAndOut)
{ {
assert(additional != NULL); assert(additional != NULL);
@ -83,7 +83,7 @@ math_vec3_accum(const struct xrt_vec3* additional, struct xrt_vec3* inAndOut)
* *
*/ */
bool extern "C" bool
math_quat_validate(const struct xrt_quat* quat) math_quat_validate(const struct xrt_quat* quat)
{ {
assert(quat != NULL); assert(quat != NULL);
@ -105,14 +105,14 @@ math_quat_validate(const struct xrt_quat* quat)
return true; return true;
} }
void extern "C" void
math_quat_normalize(struct xrt_quat* inout) math_quat_normalize(struct xrt_quat* inout)
{ {
assert(inout != NULL); assert(inout != NULL);
map_quat(*inout).normalize(); map_quat(*inout).normalize();
} }
void extern "C" void
math_quat_rotate(const struct xrt_quat* left, math_quat_rotate(const struct xrt_quat* left,
const struct xrt_quat* right, const struct xrt_quat* right,
struct xrt_quat* result) struct xrt_quat* result)
@ -129,7 +129,7 @@ math_quat_rotate(const struct xrt_quat* left,
map_quat(*result) = q; map_quat(*result) = q;
} }
void extern "C" void
math_quat_rotate_vec3(const struct xrt_quat* left, math_quat_rotate_vec3(const struct xrt_quat* left,
const struct xrt_vec3* right, const struct xrt_vec3* right,
struct xrt_vec3* result) struct xrt_vec3* result)
@ -153,7 +153,7 @@ math_quat_rotate_vec3(const struct xrt_quat* left,
* *
*/ */
bool extern "C" bool
math_pose_validate(const struct xrt_pose* pose) math_pose_validate(const struct xrt_pose* pose)
{ {
assert(pose != NULL); assert(pose != NULL);
@ -162,7 +162,7 @@ math_pose_validate(const struct xrt_pose* pose)
math_quat_validate(&pose->orientation); math_quat_validate(&pose->orientation);
} }
void extern "C" void
math_pose_invert(const struct xrt_pose* pose, struct xrt_pose* outPose) math_pose_invert(const struct xrt_pose* pose, struct xrt_pose* outPose)
{ {
assert(pose != NULL); assert(pose != NULL);
@ -199,7 +199,7 @@ transform_pose(const xrt_pose& transform, const xrt_pose& pose)
return ret; return ret;
} }
void extern "C" void
math_pose_transform(const struct xrt_pose* transform, math_pose_transform(const struct xrt_pose* transform,
const struct xrt_pose* pose, const struct xrt_pose* pose,
struct xrt_pose* outPose) struct xrt_pose* outPose)
@ -212,7 +212,7 @@ math_pose_transform(const struct xrt_pose* transform,
memcpy(outPose, &newPose, sizeof(xrt_pose)); memcpy(outPose, &newPose, sizeof(xrt_pose));
} }
void extern "C" void
math_pose_openxr_locate(const struct xrt_pose* space_pose, math_pose_openxr_locate(const struct xrt_pose* space_pose,
const struct xrt_pose* relative_pose, const struct xrt_pose* relative_pose,
const struct xrt_pose* base_space_pose, const struct xrt_pose* base_space_pose,
@ -366,13 +366,13 @@ static const struct xrt_space_relation BLANK_RELATION = {
{0, 0, 0}, {0, 0, 0},
}; };
void extern "C" void
math_relation_reset(struct xrt_space_relation* out) math_relation_reset(struct xrt_space_relation* out)
{ {
*out = BLANK_RELATION; *out = BLANK_RELATION;
} }
void extern "C" void
math_relation_accumulate_transform(const struct xrt_pose* transform, math_relation_accumulate_transform(const struct xrt_pose* transform,
struct xrt_space_relation* in_out_relation) struct xrt_space_relation* in_out_relation)
{ {
@ -383,8 +383,7 @@ math_relation_accumulate_transform(const struct xrt_pose* transform,
transform_accumulate_pose(*transform, *in_out_relation); transform_accumulate_pose(*transform, *in_out_relation);
} }
extern "C" void
void
math_relation_accumulate_relation( math_relation_accumulate_relation(
const struct xrt_space_relation* additional_relation, const struct xrt_space_relation* additional_relation,
struct xrt_space_relation* in_out_relation) struct xrt_space_relation* in_out_relation)
@ -428,7 +427,7 @@ math_relation_accumulate_relation(
} }
} }
void extern "C" void
math_relation_openxr_locate(const struct xrt_pose* space_pose, math_relation_openxr_locate(const struct xrt_pose* space_pose,
const struct xrt_space_relation* relative_relation, const struct xrt_space_relation* relative_relation,
const struct xrt_pose* base_space_pose, const struct xrt_pose* base_space_pose,

View file

@ -119,7 +119,6 @@ math_solve_triangle(double w_total,
return true; return true;
} }
bool bool
math_compute_fovs(double w_total, math_compute_fovs(double w_total,
double w_1, double w_1,

View file

@ -131,7 +131,7 @@ quat_ln(Eigen::Quaternion<Scalar> const &quat)
} // namespace } // namespace
void extern "C" void
math_quat_integrate_velocity(const struct xrt_quat *quat, math_quat_integrate_velocity(const struct xrt_quat *quat,
const struct xrt_vec3 *ang_vel, const struct xrt_vec3 *ang_vel,
const float dt, const float dt,
@ -149,7 +149,7 @@ math_quat_integrate_velocity(const struct xrt_quat *quat,
map_quat(*result) = q * incremental_rotation; map_quat(*result) = q * incremental_rotation;
} }
void extern "C" void
math_quat_finite_difference(const struct xrt_quat *quat0, math_quat_finite_difference(const struct xrt_quat *quat0,
const struct xrt_quat *quat1, const struct xrt_quat *quat1,
const float dt, const float dt,