Advertisement
Guest User

C point and vector structs/types

a guest
Jan 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.54 KB | None | 0 0
  1. typedef struct {
  2.   int16_t    x, y;
  3. } p2i16_t;   //  structure holding the x and y coordinates of a 2d point
  4.  
  5. typedef struct {
  6.   float_t    x, y;
  7. } p2f_t;   //  structure holding the x and y coordinates of a 2d point
  8.  
  9. typedef struct {
  10.   double_t    x, y;
  11. } p2d_t;   //  structure holding the x and y coordinates of a 2d point
  12.  
  13. typedef struct {
  14.   quad_t    x, y;
  15. } p2q_t;   //  structure holding the x and y coordinates of a 2d point
  16.  
  17.  
  18. typedef struct {
  19.   int16_t    x, y, z;
  20. } p3i16_t;   //  structure holding the x, y, and z coordinates of a int16_t precision 3d point
  21.  
  22. typedef struct {
  23.   float_t    x, y, z;
  24. } p3f_t;   //  structure holding the x, y, and z coordinates of a single precision 3d point
  25.  
  26. typedef struct {
  27.   double_t    x, y, z;
  28. } p3d_t;   //  structure holding the x, y, and z coordinates of a double precision 3d point
  29.  
  30. typedef struct {
  31.   quad_t    x, y, z;
  32. } p3q_t;   //  structure holding the x and y coordinates of a quad precision 3d point
  33.  
  34.  
  35. typedef struct {
  36.   p2i16_t   p1, p2;
  37. } l2i16_t;   //  structure holding Starting point p1 and endpoint p2 of a 2d line int16_t precision
  38.  
  39. typedef struct {
  40.   p2f_t    p1, p2;
  41. } l2f_t;   //  structure holding Starting point p1 and endpoint p2 of a 2d line float precision
  42.  
  43. typedef struct {
  44.   p2d_t    p1, p2;
  45. } l2d_t;   //  structure holding Starting point p1 and endpoint p2 of a 2d line double precision
  46.  
  47. typedef struct {
  48.   p2q_t    p1, p2;
  49. } l2q_t;   //  structure holding Starting point p1 and endpoint p2 of a 2d line quad precision
  50.  
  51.  
  52. typedef struct {
  53.   p3i16_t   p1, p2;
  54. } l3i16_t;   //  structure holding Starting point p1 and endpoint p2 of a 3d line float precision
  55.  
  56. typedef struct {
  57.   p3f_t   p1, p2;
  58. } l3f_t;   //  structure holding Starting point p1 and endpoint p2 of a 3d line float precision
  59.  
  60. typedef struct {
  61.   p3d_t   p1, p2;
  62. } l3d_t;   //  structure holding Starting point p1 and endpoint p2 of a 3d line double precision
  63.  
  64. typedef struct {
  65.   p3q_t   p1, p2;
  66. } l3q_t;   //  structure holding Starting point p1 and endpoint p2 of a 3d line quad precision
  67.  
  68.  
  69. typedef struct {
  70.   double_t    radius, theta;
  71. } v2d_t;    //    a 2d vector with radius and angle
  72.  
  73. //  a vector with offset
  74. typedef struct {
  75.     p2d_t       o;  //  origo / offset
  76.     double_t    radius, theta;  //  vector component
  77. } v2do_t;    //    a 2d vector with radius and angle
  78.  
  79. typedef struct {
  80.   float_t    radius, theta;
  81. } v2f_t;    //    a 2d vector with radius and angle
  82.  
  83. typedef struct {
  84.   double_t    radius, thetax, thetay, thetaz;
  85. } v3d_t;    //    a 3d vector with radius and 3 angles
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement