liblashgame

Pathfinder and path decision making library for 2D tile game
git clone git://holbrook.no/liblashgame.git
Log | Files | Refs

cartesianlinear.c (694B)


      1 // test of cartesian to linear
      2 
      3 #include <stdio.h>
      4 #include "../lash_game_standard.h"
      5 #include <stdlib.h>
      6 
      7 int main(int argc, char **argv) {
      8 	lash_game_coords_float_t testtarget;
      9 	lash_game_coords_float_t testsource;
     10 	lash_game_line_t lineresult;
     11 	
     12 	if (argc < 5) {
     13 		printf("Usage: %s src_x src_y target_x target_y\n", *argv);
     14 		return 1;
     15 	}
     16 	
     17 	testsource.x = atof(*(argv+1));
     18 	testsource.y = atof(*(argv+2));
     19 	testtarget.x = atof(*(argv+3));
     20 	testtarget.y = atof(*(argv+4));
     21 	
     22 	
     23 	lash_cartesianToLinear(testsource, testtarget, &lineresult);
     24 	
     25 	printf("src %f,%f target %f,%f line m%f,c%f\n", testsource.x, testsource.y, testtarget.x, testtarget.y, lineresult.m, lineresult.c);
     26 	
     27 	return 0;
     28 }