gem-graph-client/include/base.h

85 lines
2.5 KiB
C
Raw Normal View History

/**
* @file
* base header
*
* This file is part of Gem-graph.
*
* @cond LICENSE
* Copyright © 2021 Libre en Communs <contact@a-lec.org>
* Copyright © 2021-2024 Adrien Bourmault <neox@a-lec.org>
* Copyright © 2021-2024 Jean Sirmai <jean@a-lec.org>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* @endcond
*/
#pragma once
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h> /* Defines NULL. */
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <glib-2.0/glib.h>
#include <gtk-4.0/gtk/gtk.h>
// #define G_APPLICATION_DEFAULT_FLAGS 0 TODO What was this declaration for ?
/******************************************************************************/
/* S P A C E S T R U C T U R E S */
/******************************************************************************/
2024-10-20 01:05:12 +02:00
/** used by graphics.h */
enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS };
2024-10-20 01:05:12 +02:00
/** defines an arrow address */
struct arrow_t {
2024-10-20 01:05:12 +02:00
uint load; /**< load (or weight): the number of superimposed arrows */
uint site; /**< site one site per neighbouring target cell */
uint x; /**< x origin cell coord */
uint y; /**< y origin cell coord */
uint z; /**< z origin cell coord */
};
2024-10-20 01:05:12 +02:00
/**
If I'm standing on Earth (or any spinning spheroid),
looking towards its North pole.
Then :
X - X = EAST - WEST = red - cyan
Y - Y = ZENITH - NADIR = green - magenta (fuschia)
Z - Z = NORTH - SOUTH = blue - yellow
*/
2024-10-20 01:05:12 +02:00
#define EAST 0 /**< + x red */
#define WEST 1 /**< - x cyan */
#define ZENITH 2 /**< + y green */
#define NADIR 3 /**< - y magenta */
#define SOUTH 4 /**< + z blue */
#define NORTH 5 /**< - z yellow */