Пример #1
0
void
StereoCalibration::initialize()
{
  Eigen::Quaterniond rotation_quat(_parameters.right_to_left_rotation[0],
                                   _parameters.right_to_left_rotation[1],
                                   _parameters.right_to_left_rotation[2],
                                   _parameters.right_to_left_rotation[3]);
  Eigen::Vector3d translation(_parameters.right_to_left_translation[0],
                              _parameters.right_to_left_translation[1],
                              _parameters.right_to_left_translation[2]);

  Eigen::Matrix3d left_rotation, right_rotation;
  stereo_rectify(_parameters.left_parameters, _parameters.right_parameters,
                 rotation_quat,
                 translation,
                 &left_rotation, &right_rotation, &_rectified_parameters);

  _left_rectification = new Rectification(_parameters.left_parameters,
                                          left_rotation,
                                          _rectified_parameters);

  _right_rectification = new Rectification(_parameters.right_parameters,
                                           right_rotation,
                                           _rectified_parameters);
}
Пример #2
0
Node *Model::node_map_create(Scene &scene, const aiNode &node, Node *parent, int level, unsigned int options)
{
  glm::mat4 transform_local;
  std::string key(node.mName.data);
  Node *node_internal = scene.node_create(key, parent);

  {
    aiVector3t<float> scaling;
    aiQuaterniont<float> rotation;
    aiVector3t<float> position;

    node.mTransformation.Decompose(scaling, rotation, position);
    glm::vec3 scale_vec(scaling.x, scaling.y, scaling.z);
    glm::vec3 position_vec(position.x, position.y, position.z);
    glm::quat rotation_quat(rotation.x, rotation.y, rotation.z, rotation.w);
    ai_mat_copy(&node.mTransformation, transform_local);


   // node_internal->transform_local_original_set(transform_local);
   // node_internal->transform_local_current_set(scene, transform_local);

    node_internal->import_options = options;

    {
     // glm::vec3 v(scaling.x, scaling.z, scaling.y);
      glm::vec3 v(scaling.x, scaling.y, scaling.z);
      node_internal->transform_scale_set(scale_vec);
    }

    {
    //  glm::quat q(rotation_quat.w, rotation_quat.x, rotation_quat.y, rotation_quat.z);
     glm::quat q(rotation_quat.x, rotation_quat.y, rotation_quat.z, rotation_quat.w);
     node_internal->transform_rotate_set(q);
    }

    {
     // glm::vec3 v(position.x, position.z, position.y);
      glm::vec3 v(position.x, position.y, position.z);
      node_internal->transform_translate_set(v);
      POLL_DEBUG(std::cout, "model transform " << node_internal->name_get() << " = " << glm::to_string(v));
    }

  }

  nodes[key] = node_internal;

  for (size_t i = 0; i < node.mNumChildren; i++) {
    node_map_create(scene, *node.mChildren[i], node_internal, level + 1, options);
  }

  return node_internal;
}