Geometry Types

Vectors

3-dimensional vectors are represented as a 3-tuple. For example:

#include <iostream>
#include <tuple>
#include <krpc.hpp>
#include <krpc/services/space_center.hpp>

int main() {
  krpc::Client conn = krpc::connect();
  krpc::services::SpaceCenter sc(&conn);
  std::tuple<double, double, double> v = sc.active_vessel().flight().prograde();
  std::cout << std::get<0>(v) << " "
            << std::get<1>(v) << " "
            << std::get<2>(v) << std::endl;
}

Quaternions

Quaternions (rotations in 3-dimensional space) are encoded as a 4-tuple containing the x, y, z and w components. For example:

#include <iostream>
#include <tuple>
#include <krpc.hpp>
#include <krpc/services/space_center.hpp>

int main() {
  krpc::Client conn = krpc::connect();
  krpc::services::SpaceCenter sc(&conn);
  std::tuple<double, double, double, double> q = sc.active_vessel().flight().rotation();
  std::cout << std::get<0>(q) << " "
            << std::get<1>(q) << " "
            << std::get<2>(q) << " "
            << std::get<3>(q) << std::endl;
}