Skip to content

Instantly share code, notes, and snippets.

@Hincoin
Hincoin / constexpr_string.cpp
Created December 10, 2016 17:13 — forked from ericniebler/constexpr_string.cpp
An almost perfect design for a hybrid constexpr/runtime string
// Copyright Eric Niebler 2016
#include <cstddef>
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <utility>
#include <type_traits>
#define REQUIRES(X) \
@Hincoin
Hincoin / Resample
Created August 15, 2014 02:30
Resampling step with pose sampling
vector<particle> resample(const vector<particle>& prior,double slow, double fast,int correspondence)
{
auto r = robot;
vector<particle> posterior;
vector<double> importance_weights;
for(const auto& x : prior)
importance_weights.push_back(x.importance_weight);
std::uniform_real_distribution<double> add_random(0,1);
std::uniform_real_distribution<double> yeta_dist(0,2*PI);
std::normal_distribution<double> range_dist(0.0,prior[0].range_noise);
vector<particle> resample(const vector<particle>& prior,double slow, double fast,int correspondence)
{
auto r = robot;
vector<particle> posterior;
vector<double> importance_weights;
for(const auto& x : prior)
importance_weights.push_back(x.importance_weight);
std::uniform_real_distribution<double> add_random(0,1);
std::uniform_real_distribution<double> yeta_dist(0,2*PI);
std::normal_distribution<double> range_dist(0.0,prior[0].range_noise);