static void print_ptraccel_sequence(struct motion_filter *filter, int nevents, double *deltas) { struct normalized_coords motion; uint64_t time = 0; double *dx; int i; printf("# gnuplot:\n"); printf("# set xlabel \"event number\"\n"); printf("# set ylabel \"delta motion\"\n"); printf("# set style data lines\n"); printf("# plot \"gnuplot.data\" using 1:2 title \"dx out\", \\\n"); printf("# \"gnuplot.data\" using 1:3 title \"dx in\"\n"); printf("#\n"); dx = deltas; for (i = 0; i < nevents; i++, dx++) { motion.x = *dx; motion.y = 0; time += 12; /* pretend 80Hz data */ motion = filter_dispatch(filter, &motion, NULL, time); printf("%d %.3f %.3f\n", i, motion.x, *dx); } }
static void print_ptraccel_deltas(struct motion_filter *filter, double step) { struct normalized_coords motion; uint64_t time = 0; double i; printf("# gnuplot:\n"); printf("# set xlabel dx unaccelerated\n"); printf("# set ylabel dx accelerated\n"); printf("# set style data lines\n"); printf("# plot \"gnuplot.data\" using 1:2 title \"step %.2f\"\n", step); printf("#\n"); /* Accel flattens out after 15 and becomes linear */ for (i = 0.0; i < 15.0; i += step) { motion.x = i; motion.y = 0; time += 12; /* pretend 80Hz data */ motion = filter_dispatch(filter, &motion, NULL, time); printf("%.2f %.3f\n", i, motion.x); } }
int process(const tendrils& inputs, const tendrils& outputs) { xyz_cloud_variant_t input = input_->make_variant(); feature_cloud_variant_t normals = normals_->make_variant(); boost::apply_visitor(filter_dispatch(impl_, inputs, outputs), input, normals); return 0; }
static void filter_motion(struct touchpad_dispatch *touchpad, double *dx, double *dy, uint32_t time) { struct motion_params motion; motion.dx = *dx; motion.dy = *dy; filter_dispatch(touchpad->filter, &motion, touchpad, time); *dx = motion.dx; *dy = motion.dy; }
static void print_ptraccel_movement(struct motion_filter *filter, int nevents, double max_dx, double step) { struct normalized_coords motion; uint64_t time = 0; double dx; int i; printf("# gnuplot:\n"); printf("# set xlabel \"event number\"\n"); printf("# set ylabel \"delta motion\"\n"); printf("# set style data lines\n"); printf("# plot \"gnuplot.data\" using 1:2 title \"dx out\", \\\n"); printf("# \"gnuplot.data\" using 1:3 title \"dx in\"\n"); printf("#\n"); if (nevents == 0) { if (step > 1.0) nevents = max_dx; else nevents = 1.0 * max_dx/step + 0.5; /* Print more events than needed so we see the curve * flattening out */ nevents *= 1.5; } dx = 0; for (i = 0; i < nevents; i++) { motion.x = dx; motion.y = 0; time += 12; /* pretend 80Hz data */ motion = filter_dispatch(filter, &motion, NULL, time); printf("%d %.3f %.3f\n", i, motion.x, dx); if (dx < max_dx) dx += step; } }