Basic optimize value
This commit is contained in:
parent
5a44143a75
commit
2b8aa08367
3 changed files with 22 additions and 5 deletions
|
@ -190,15 +190,30 @@ void AtomicRotationTransform::optimize_value(const Vec3 &local_vector, const Vec
|
||||||
|
|
||||||
// optimize this that: target = this->calculate_matrix() * local_vector;
|
// 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)
|
if (inverse)
|
||||||
result = -result;
|
result = -result;
|
||||||
|
|
||||||
result = clamp(result, lower_limit, upper_limit);
|
result = clamp(result, lower_limit, upper_limit);
|
||||||
|
|
||||||
|
|
||||||
|
//std::cout << "angle after bounds check: " << result << std::endl;
|
||||||
|
|
||||||
set_value(result);
|
set_value(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,6 +218,8 @@ void IKViewer::optimize()
|
||||||
/*Task 3.3: Implement CCD */
|
/*Task 3.3: Implement CCD */
|
||||||
for (int i = 0; i < max_iterations; i++)
|
for (int i = 0; i < max_iterations; i++)
|
||||||
{
|
{
|
||||||
|
std::cout << "iteration: " << i << std::endl;
|
||||||
|
|
||||||
int kc_size = kinematic_vector.size();
|
int kc_size = kinematic_vector.size();
|
||||||
|
|
||||||
// reverse iterate through kinematic chain
|
// reverse iterate through kinematic chain
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This source code is property of the Computer Graphics and Visualization
|
// This source code is property of the Computer Graphics and Visualization
|
||||||
// chair of the TU Dresden. Do not distribute!
|
// chair of the TU Dresden. Do not distribute!
|
||||||
// Copyright (C) CGV TU Dresden - All Rights Reserved
|
// Copyright (C) CGV TU Dresden - All Rights Reserved
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -61,7 +61,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The constructor of this class
|
// The constructor of this class
|
||||||
SkeletonViewer(DataStore*);
|
SkeletonViewer(DataStore*);
|
||||||
|
|
||||||
// Create the gui elements
|
// Create the gui elements
|
||||||
void create_gui();
|
void create_gui();
|
||||||
|
|
Loading…
Reference in a new issue