projects
/
physik
/
posic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nearly finished init stuff (probs with rand function!)
[physik/posic.git]
/
math
/
math.c
diff --git
a/math/math.c
b/math/math.c
index
6d707e9
..
9cfaff6
100644
(file)
--- a/
math/math.c
+++ b/
math/math.c
@@
-7,6
+7,8
@@
#include <string.h>
#include <string.h>
+#include <math.h>
+
#include "math.h"
int v3_add(t_3dvec *sum,t_3dvec *a,t_3dvec *b) {
#include "math.h"
int v3_add(t_3dvec *sum,t_3dvec *a,t_3dvec *b) {
@@
-64,3
+66,13
@@
int v3_cmp(t_3dvec *a,t_3dvec *b) {
return(memcmp(a,b,sizeof(t_3dvec)));
}
return(memcmp(a,b,sizeof(t_3dvec)));
}
+double v3_absolute_square(t_3dvec *a) {
+
+ return(a->x*a->x+a->y*a->y+a->z*a->z);
+}
+
+double v3_norm(t_3dvec *a) {
+
+ return(sqrt(v3_absolute_square(a)));
+}
+