diff --git a/CGII/src/AtomicTransform.cpp b/CGII/src/AtomicTransform.cpp index 55c0f8f..0f7d420 100644 --- a/CGII/src/AtomicTransform.cpp +++ b/CGII/src/AtomicTransform.cpp @@ -190,15 +190,30 @@ void AtomicRotationTransform::optimize_value(const Vec3 &local_vector, const Vec // optimize this that: target = this->calculate_matrix() * local_vector; - float first_guess = angle(local_vector, target); + double result = 0.0; - double result = least_squares(local_vector, target, first_guess); + Vec3 lp = local_vector - (dot(local_vector, axis) * axis); + Vec3 tp = target - (dot(target, axis) * axis); + + result = (double)angle(lp, tp); + + result = result * 180 / PI; + + //std::cout << "angle before bounds check: " << result << std::endl; + + + //float first_guess = angle(local_vector, target); + + //double result = least_squares(local_vector, target, first_guess); if (inverse) result = -result; result = clamp(result, lower_limit, upper_limit); + + //std::cout << "angle after bounds check: " << result << std::endl; + set_value(result); } diff --git a/CGII/src/IKViewer.cpp b/CGII/src/IKViewer.cpp index 4141d2d..f296af2 100644 --- a/CGII/src/IKViewer.cpp +++ b/CGII/src/IKViewer.cpp @@ -218,6 +218,8 @@ void IKViewer::optimize() /*Task 3.3: Implement CCD */ for (int i = 0; i < max_iterations; i++) { + std::cout << "iteration: " << i << std::endl; + int kc_size = kinematic_vector.size(); // reverse iterate through kinematic chain diff --git a/CGII/src/SkeletonViewer.h b/CGII/src/SkeletonViewer.h index 0dab858..84a8b87 100644 --- a/CGII/src/SkeletonViewer.h +++ b/CGII/src/SkeletonViewer.h @@ -1,5 +1,5 @@ -// This source code is property of the Computer Graphics and Visualization -// chair of the TU Dresden. Do not distribute! +// This source code is property of the Computer Graphics and Visualization +// chair of the TU Dresden. Do not distribute! // Copyright (C) CGV TU Dresden - All Rights Reserved // #pragma once @@ -61,7 +61,7 @@ private: public: // The constructor of this class - SkeletonViewer(DataStore*); + SkeletonViewer(DataStore*); // Create the gui elements void create_gui();