Source

kinect-viewer / utility.h

Diff from to

File utility.h

 
 #include "types.h"
 
-static inline void vector_subtract(const vec3f_t *a, const vec3f_t *b, vec3f_t *out) {
-	*out = (vec3f_t) {
-		a->x - b->x,
-		a->y - b->y,
-		a->z - b->z
+static inline vec3f_t vector_subtract(vec3f_t a, vec3f_t b) {
+	return (vec3f_t) {
+		a.x - b.x,
+		a.y - b.y,
+		a.z - b.z
 	};
 }
 
   };
 }
 
-static inline void cross_product(const vec3f_t *a, const vec3f_t *b, vec3f_t *out) {
-	*out = (vec3f_t) {
-		a->y * b->z - a->z * b->y,
-		a->z * b->x - a->x * b->z,
-		a->x * b->y - a->y * b->x
+static inline vec3f_t cross_product(vec3f_t a, vec3f_t b) {
+	return (vec3f_t) {
+		a.y * b.z - a.z * b.y,
+		a.z * b.x - a.x * b.z,
+		a.x * b.y - a.y * b.x
 	};		
 }
 
-static inline void compute_normal(const vec3f_t *p1, const vec3f_t *p2, const vec3f_t *p3, vec3f_t *out) {
-	vec3f_t a, b;
-	vector_subtract(p3, p2, &a);
-	vector_subtract(p1, p2, &b);
-	
-	cross_product(&a, &b, out);
+static inline vec3f_t compute_normal(vec3f_t p1, vec3f_t p2, vec3f_t p3) {
+	vec3f_t a = vector_subtract(p3, p2);
+  vec3f_t b = vector_subtract(p1, p2);
+	return cross_product(a, b);
 }
 
 // Converts depth image coordinates to color image coordinates