10 #ifndef INT3D_SOURCE_FILE 11 #define INT3D_INLINE inline 12 #else // If it's source file, declare extern inline 13 #define INT3D_INLINE extern inline 46 int dx = abs(a.
x - b.
x);
47 int dy = abs(a.
y - b.
y);
48 int dz = abs(a.
z - b.
z);
49 int sum = dx + dy + dz;
50 return sum == 1 ? true :
false;
56 if(a.
x != b.
x || a.
y != b.
y || a.
z != b.
z)
64 fprintf(fp,
"%d,%d,%d", a.
x, a.
y, a.
z);
struct int3d_ int3d
Type for representing a tridimensional coordinate.
INT3D_INLINE int3d int3d_add(int3d a, int3d b)
Adds two int3d objects.
Definition: int3d.h:35
int y
Coordinate y.
Definition: int3d.h:19
INT3D_INLINE bool int3d_equal(int3d a, int3d b)
Verifies if a and b are equal.
Definition: int3d.h:55
int x
Coordinate x.
Definition: int3d.h:18
INT3D_INLINE int3d int3d_make(int x, int y, int z)
Creates an int3d.
Definition: int3d.h:25
INT3D_INLINE void int3d_print(int3d a, FILE *fp)
Prints the given int3d object, without placing a newline.
Definition: int3d.h:63
Type for representing a tridimensional coordinate.
Definition: int3d.h:17
int z
Coordinate z.
Definition: int3d.h:20
INT3D_INLINE bool int3d_isDist1(int3d a, int3d b)
Verifies if a and b are within a distance of exactly 1 from each other.
Definition: int3d.h:45