Commit d9707758 authored by POLLIEN Baptiste's avatar POLLIEN Baptiste
Browse files

Reducing nb of multiplication in rmat_of_quat

parent 1e2d688a
......@@ -4,8 +4,10 @@
"pattern": "separated$rm9$q4" },
"children": { "WrongBase": [ { "prover": "CVC4:1.9-prerelease:strings+counterexamples",
"verdict": "valid", "time": 0.73 } ],
"OnLeft": [ { "prover": "CVC4:1.9-prerelease:strings+counterexamples",
"verdict": "valid", "time": 4.1 } ],
"OnRight": [ { "prover": "CVC4:1.9-prerelease:strings+counterexamples",
"verdict": "valid", "time": 4.36 } ],
"OnLeft": [ { "prover": "Z3:4.8.6:counterexamples",
"verdict": "valid", "time": 0.15,
"steps": 645982 } ],
"OnRight": [ { "prover": "Z3:4.8.6:counterexamples",
"verdict": "valid", "time": 0.14,
"steps": 602575 } ],
"OverLap": [ { "prover": "qed", "verdict": "valid" } ] } } ]
......@@ -258,17 +258,20 @@ void float_rmat_of_quat(struct FloatRMat *rm, struct FloatQuat *q)
RMAT_ELMT(*rm, 2, 2) = a2_1 + _d * _d;
#else
const float _a = q->qi;
const float _2a = 2 * _a;
const float _b = q->qx;
const float _2b = 2 * _b;
const float _c = q->qy;
const float _d = q->qz;
const float a2_1 = 2 * _a * _a - 1;
const float ab = 2 * _a * _b;
const float ac = 2 * _a * _c;
const float ad = 2 * _a * _d;
const float bc = 2 * _b * _c;
const float bd = 2 * _b * _d;
const float cd = 2 * _c * _d;
RMAT_ELMT(*rm, 0, 0) = a2_1 + 2 * _b * _b;
const float _2d = 2 * _d;
const float a2_1 = _2a * _a - 1;
const float ab = _2a * _b;
const float ac = _2a * _c;
const float ad = _2a * _d;
const float bc = _2b * _c;
const float bd = _2b * _d;
const float cd = _c * _2d;
RMAT_ELMT(*rm, 0, 0) = a2_1 + _2b * _b;
RMAT_ELMT(*rm, 0, 1) = bc + ad;
RMAT_ELMT(*rm, 0, 2) = bd - ac;
RMAT_ELMT(*rm, 1, 0) = bc - ad;
......@@ -276,7 +279,7 @@ void float_rmat_of_quat(struct FloatRMat *rm, struct FloatQuat *q)
RMAT_ELMT(*rm, 1, 2) = cd + ab;
RMAT_ELMT(*rm, 2, 0) = bd + ac;
RMAT_ELMT(*rm, 2, 1) = cd - ab;
RMAT_ELMT(*rm, 2, 2) = a2_1 + 2 * _d * _d;
RMAT_ELMT(*rm, 2, 2) = a2_1 + _2d * _d;
//@assert \at(q->qi, Pre) == q->qi;
//@assert \at(q->qx, Pre) == q->qx;
//@assert \at(q->qy, Pre) == q->qy;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment