[ create a new paste ] login | about

Link: http://codepad.org/Z5JUG4s8    [ raw code | fork ]

C, pasted on Aug 18:
#include <math.h>
#include "danStuff.h"

/*******************************

  all angles are in rads less polar, which is in degs

 for cartesian, X is amplitude, and Y is the angle in degrees

*******************************/

#define pt(X,Y) ((point2d_t){X,Y})



typedef struct point2d_s {
  double x, y;
} point2d_t;

typedef struct lineGF_s {
  double A, B, C;
} lineGF_t;

typedef struct line_s {
  point2d_t p1;
  point2d_t p2;
} line_t;

point2d_t * setPoint(point2d_t *p, point2d_t to);
point2d_t * translate(point2d_t *p, point2d_t by) ;
point2d_t * rotatez(point2d_t *p, double by) ;
point2d_t * rotateZAround(point2d_t *p, point2d_t *around, double by) ;
point2d_t * scale(point2d_t *p, point2d_t by) ;
char      * point2s(char *s, int bl, point2d_t * this) ;

point2d_t * cart2polar(point2d_t *p, point2d_t cart);
point2d_t * polar2cart(point2d_t *p, point2d_t polar);

line_t    * initLine(line_t *l) ;
line_t    * setLine(line_t *l, double x1, double y1, double x2, double y2) ;
line_t    * transLine(line_t *l, point2d_t by) ;
line_t    * rotLine(line_t *l, double by) ;
line_t    * rotLineAround(line_t *l, point2d_t * around, double by) ;
line_t    * scaleLine(line_t *l, point2d_t by) ;
char      * line2s(char *s, int bl, line_t * this) ;

point2d_t * getMidPoint(point2d_t *mp, line_t *l);
point2d_t * getIntersection(point2d_t * is, line_t * this, line_t * that);
point2d_t * getIntersection2(point2d_t * is, line_t * this, line_t * that);


Create a new paste based on this one


Comments: