Skip to content

Instantly share code, notes, and snippets.

View PeteBlackerThe3rd's full-sized avatar
💭
Cramming in a couple of extra hours each day

Pete Blacker PeteBlackerThe3rd

💭
Cramming in a couple of extra hours each day
View GitHub Profile
@PeteBlackerThe3rd
PeteBlackerThe3rd / quaternion_average.h
Last active March 25, 2024 13:57
Rotation quaternion average calculation function using Eigen
#include <Eigen/SVD>
/// Method to find the average of a set of rotation quaternions using Singular Value Decomposition
/*
* The algorithm used is described here:
* https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20070017872.pdf
*/
Eigen::Vector4f quaternionAverage(std::vector<Eigen::Vector4f> quaternions)
{
if (quaternions.size() == 0)
@PeteBlackerThe3rd
PeteBlackerThe3rd / getline_async.h
Last active May 6, 2023 23:53
drop in non-blocking replacement for std::getline
#include <iostream>
bool getline_async(std::istream& is, std::string& str, char delim = '\n') {
static std::string lineSoFar;
char inChar;
int charsRead = 0;
bool lineRead = false;
str = "";