Skip to content

Commit

Permalink
Added clu stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tingelst committed Aug 19, 2016
1 parent 4542a69 commit fe9de8d
Show file tree
Hide file tree
Showing 16 changed files with 1,043 additions and 1,262 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build
build_gcc
build-osx
build-clang
build2
build3
.idea
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ RUN apt-get update && apt-get -y install \
clang-3.8 \
&& rm -rf /var/lib/apt/lists/*

ENV CC clang-3.8
ENV CXX clang++-3.8

RUN pip install --upgrade \
pip \
virtualenv
Expand Down
3 changes: 3 additions & 0 deletions clu/benchmark.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
R = cos(theta / 2) - sin(theta / 2) * e1 * e2;
a = a1 * e1 + a2 * e2 + a3 * e3;
?b = R * a * ~R;
21 changes: 21 additions & 0 deletions clu/biv_exp.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


theta = sqrt( l1 * l1 + l2 * l2 + l3 * l3);

sin_theta = sin(theta);
sinc_theta = sin_theta / theta;
cos_theta = cos(theta);

biv = (l1 * e1 * e2 + l2 * e1 * e3 + l3 * e2 * e3) / theta;

t = l4 * e1 + l5 * e2 + l6 * e3;
tv = ((t . biv) / biv);
tw = ((t ^ biv) / biv);
?tt = cos_theta * tw + sinc_theta * tv;
ts = sin_theta * biv * tw;

m_delta = cos_theta + sin_theta * biv + cos_theta * tw * einf + sinc_theta * tv * einf + ts * einf;

m_x = m1 + m2 * e1 * e2 + m3 * e1 * e3 + m4 * e2 * e3 + m5 * e1 * einf + m6 * e2 * einf + m7 * e3 * einf + m8 * e1 * e2 * e3 * einf;

m = m_delta * m_x;
3 changes: 3 additions & 0 deletions clu/inner_product_vector_bivector.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vec = a1 * e1 + a2 * e2 + a3 * e3;
biv = b1 * e2 * e3 + b2 * e3 * e1 + b3 * e1 * e2;
?vec_ip_biv = vec . biv;
3 changes: 3 additions & 0 deletions clu/motor_rotate_point.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
M = m1 + m2 * e1 * e2 + m3 * e1 * e3 + m4 * e2 * e3 + m5 * e1 * einf + m6 * e2 * einf + m7 * e3 * einf + m8 * e1 * e2 * e3 * einf;
p = p1 * e1 + p2 * e2 + p3 * e3 + p4 * e0 + p5 * einf;
?q = M * p * ~M;
6 changes: 6 additions & 0 deletions clu/motor_rotate_point_cost.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
M = m1 + m2 * e1 * e2 + m3 * e1 * e3 + m4 * e2 * e3 + m5 * e1 * einf + m6 * e2 * einf + m7 * e3 * einf + m8 * e1 * e2 * e3 * einf;

a = a1 * e1 + a2 * e2 + a3 * e3 + a4 * e0 + a5 * einf;
b = b1 * e1 + b2 * e2 + b3 * e3 + b4 * e0 + b5 * einf;

? c= (M * a * ~M) - b;
3 changes: 3 additions & 0 deletions clu/rotor_rotate_vector.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
R = r1 + r2 * e1 * e2 + r3 * e1 * e3 + r4 * e2 * e3;
a = a1 * e1 + a2 * e2 + a3 * e3;
?b = R * a * ~R;
4 changes: 4 additions & 0 deletions clu/rotor_rotate_vector_cost.clu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
R = r1 + r2 * e1 * e2 + r3 * e1 * e3 + r4 * e2 * e3;
a = a1 * e1 + a2 * e2 + a3 * e3;
b = b1 * e1 + b2 * e2 + b3 * e3;
?c = (R * a * ~R) - b;
6 changes: 6 additions & 0 deletions clu/rotor_rotate_vector_cost.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void calculate(double a1, double a2, double a3, double b1, double b2, double b3, double r1, double r2, double r3, double r4, double c[8]) {

c[1] = (((a1 * r4 * r4 + (2.0 * a3 * r2 - 2.0 * a2 * r3) * r4) - a1 * r3 * r3 + 2.0 * a3 * r1 * r3) - a1 * r2 * r2 + 2.0 * a2 * r1 * r2 + a1 * r1 * r1) - b1; // e1
c[2] = (((-(a2 * r4 * r4)) + (2.0 * a3 * r1 - 2.0 * a1 * r3) * r4 + a2 * r3 * r3) - 2.0 * a3 * r2 * r3 - a2 * r2 * r2 - 2.0 * a1 * r1 * r2 + a2 * r1 * r1) - b2; // e2
c[3] = (((-(a3 * r4 * r4)) + (2.0 * a1 * r2 - 2.0 * a2 * r1) * r4) - a3 * r3 * r3 + ((-(2.0 * a1 * r1)) - 2.0 * a2 * r2) * r3 + a3 * r2 * r2 + a3 * r1 * r1) - b3; // e3
}
6 changes: 3 additions & 3 deletions include/game/vsr/cga_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,9 @@ Multivector<Algebra, B> Multivector<Algebra, B>::twist(
@ingroup cgaops
* @{ */

#define E1 e1(1)
#define E2 e2(1)
#define E3 e3(1)
// #define E1 e1(1)
// #define E2 e2(1)
// #define E3 e3(1)

/// A vsr::cga::Pnt at coordinates x,y,z
#define PT(x, y, z) vsr::cga::Round::null(vsr::cga::Vec(x, y, z))
Expand Down
Loading

0 comments on commit fe9de8d

Please sign in to comment.