The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/math: Organize base and api file [NFC]

+37 -21
+16 -8
src/xrt/auxiliary/math/m_api.h
··· 155 155 math_vec3_cross(const struct xrt_vec3 *l, const struct xrt_vec3 *r, struct xrt_vec3 *result); 156 156 157 157 /*! 158 - * Cross product of a vector. 158 + * Get translation vector from isometry matrix (col-major). 159 159 * 160 160 * @relates xrt_vec3 161 161 * @ingroup aux_math 162 162 */ 163 163 void 164 - math_vec3_f64_cross(const struct xrt_vec3_f64 *l, const struct xrt_vec3_f64 *r, struct xrt_vec3_f64 *result); 164 + math_vec3_translation_from_isometry(const struct xrt_matrix_4x4 *isometry, struct xrt_vec3 *result); 165 165 166 166 /*! 167 - * Get translation vector from isometry matrix (col-major). 167 + * Normalize a vec3 in place. 168 168 * 169 169 * @relates xrt_vec3 170 170 * @ingroup aux_math 171 171 */ 172 172 void 173 - math_vec3_translation_from_isometry(const struct xrt_matrix_4x4 *isometry, struct xrt_vec3 *result); 173 + math_vec3_normalize(struct xrt_vec3 *in); 174 + 175 + 176 + /* 177 + * 178 + * 64 bit vector functions. 179 + * 180 + */ 174 181 175 182 /*! 176 - * Normalize a vec3 in place. 183 + * Cross product of a vec3_f64. 177 184 * 178 - * @relates xrt_vec3 185 + * @relates xrt_vec3_f64 179 186 * @ingroup aux_math 180 187 */ 181 188 void 182 - math_vec3_normalize(struct xrt_vec3 *in); 189 + math_vec3_f64_cross(const struct xrt_vec3_f64 *l, const struct xrt_vec3_f64 *r, struct xrt_vec3_f64 *result); 183 190 184 191 /*! 185 192 * Normalize a vec3_f64 in place. 186 193 * 187 - * @relates xrt_vec3 194 + * @relates xrt_vec3_f64 188 195 * @ingroup aux_math 189 196 */ 190 197 void 191 198 math_vec3_f64_normalize(struct xrt_vec3_f64 *in); 199 + 192 200 193 201 /* 194 202 *
+21 -13
src/xrt/auxiliary/math/m_base.cpp
··· 173 173 } 174 174 175 175 extern "C" void 176 + math_vec3_translation_from_isometry(const struct xrt_matrix_4x4 *transform, struct xrt_vec3 *result) 177 + { 178 + Eigen::Isometry3f isometry{map_matrix_4x4(*transform)}; 179 + map_vec3(*result) = isometry.translation(); 180 + } 181 + 182 + 183 + /* 184 + * 185 + * Exported 64 bit vector functions. 186 + * 187 + */ 188 + 189 + extern "C" void 190 + math_vec3_f64_cross(const struct xrt_vec3_f64 *l, const struct xrt_vec3_f64 *r, struct xrt_vec3_f64 *result) 191 + { 192 + map_vec3_f64(*result) = map_vec3_f64(*l).cross(map_vec3_f64(*r)); 193 + } 194 + 195 + extern "C" void 176 196 math_vec3_f64_normalize(struct xrt_vec3_f64 *in) 177 197 { 178 198 map_vec3_f64(*in) = map_vec3_f64(*in).normalized(); 179 199 } 200 + 180 201 181 202 /* 182 203 * ··· 787 808 Eigen::Matrix4d r = map_matrix_4x4_f64(*right); 788 809 789 810 map_matrix_4x4_f64(*result) = l * r; 790 - } 791 - 792 - extern "C" void 793 - math_vec3_f64_cross(const struct xrt_vec3_f64 *l, const struct xrt_vec3_f64 *r, struct xrt_vec3_f64 *result) 794 - { 795 - map_vec3_f64(*result) = map_vec3_f64(*l).cross(map_vec3_f64(*r)); 796 - } 797 - 798 - extern "C" void 799 - math_vec3_translation_from_isometry(const struct xrt_matrix_4x4 *transform, struct xrt_vec3 *result) 800 - { 801 - Eigen::Isometry3f isometry{map_matrix_4x4(*transform)}; 802 - map_vec3(*result) = isometry.translation(); 803 811 } 804 812 805 813 extern "C" void