Skip to content

Instantly share code, notes, and snippets.

@laclefyoshi
Created September 8, 2012 11:42
Show Gist options
  • Save laclefyoshi/3674068 to your computer and use it in GitHub Desktop.
Save laclefyoshi/3674068 to your computer and use it in GitHub Desktop.
c code using libpuzzle
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2012/09/08
**/
#include<stdio.h>
#include<stdlib.h>
#include<puzzle.h>
int main(int argc, char *argv[]) {
PuzzleContext context;
PuzzleCvec cvec1, cvec2;
double distance;
puzzle_init_context(&context);
puzzle_init_cvec(&context, &cvec1);
puzzle_init_cvec(&context, &cvec2);
puzzle_fill_cvec_from_file(&context, &cvec1, argv[1]);
puzzle_fill_cvec_from_file(&context, &cvec2, argv[2]);
distance = puzzle_vector_normalized_distance(&context, &cvec1, &cvec2, 1);
printf("distance: %g\n", distance);
puzzle_free_cvec(&context, &cvec1);
puzzle_free_cvec(&context, &cvec2);
puzzle_free_context(&context);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment