![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#include <stdio.h>#include <string.h>#include <math.h>#include "nilorea/n_common.h"#include "nilorea/n_log.h"#include "nilorea/n_trajectory.h"#include <allegro5/allegro.h>#include <allegro5/allegro_primitives.h>#include <allegro5/allegro_font.h>
Include dependency graph for ex_trajectory.c:Go to the source code of this file.
Data Structures | |
| struct | WAYPOINT3D |
Macros | |
| #define | ALLEGRO_UNSTABLE 1 |
| #define | DT (1.0 / FPS) |
| #define | FPS 60.0 |
| #define | HEIGHT 600 |
| #define | M_PI 3.14159265358979323846 |
| #define | MAX_TRAIL 300 |
| #define | MAX_WP2D 50 |
| #define | NUM_WP3D 7 |
| #define | PANEL_W 400 |
| #define | WIDTH 800 |
Functions | |
| static void | draw_2d_panel (ALLEGRO_FONT *font) |
| static void | draw_3d_axes (ALLEGRO_FONT *font) |
| static void | draw_3d_panel (ALLEGRO_FONT *font) |
| static void | draw_arrow (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color, float thickness) |
| static void | draw_full_path_2d (void) |
| static void | draw_full_path_3d (void) |
| static void | draw_ground_grid (void) |
| static void | draw_trail (float trail[][2], int count, int head, ALLEGRO_COLOR base_color) |
| static void | handle_click_2d (float mx, float my) |
| static void | init_3d (void) |
| static void | init_physics_2d (PHYSICS *p, double px, double py, double vx, double vy) |
| static void | init_physics_3d (PHYSICS *p, double px, double py, double pz, double vx, double vy, double vz) |
| int | main (int argc, char *argv[]) |
| static void | project_3d (double x, double y, double z, float *sx, float *sy) |
| static void | rebuild_2d_trajectory (void) |
| static void | reset_2d (void) |
| static void | trail_push_2d (float x, float y) |
| static void | trail_push_3d (float x, float y) |
| static void | update_3d_logic (void) |
Variables | |
| static int | running_2d = 0 |
| static double | time_2d = 0.0 |
| static double | time_3d = 0.0 |
| static double | time_3d_end = 0.0 |
| static float | trail_2d [300][2] |
| static int | trail_2d_count = 0 |
| static int | trail_2d_head = 0 |
| static float | trail_3d [300][2] |
| static int | trail_3d_count = 0 |
| static int | trail_3d_head = 0 |
| static TRAJECTORY * | traj_2d = NULL |
| static TRAJECTORY * | traj_3d = NULL |
| static const WAYPOINT3D | waypoints_3d [7] |
| static int | wp2d_count = 0 |
| static const double | WP2D_SPEED = 80.0 |
| static double | wp2d_t [50] |
| static double | wp2d_x [50] |
| static double | wp2d_y [50] |
| static const double | WP3D_DUR = 4.0 |
| struct WAYPOINT3D |
Definition at line 90 of file ex_trajectory.c.
Collaboration diagram for WAYPOINT3D:| Data Fields | ||
|---|---|---|
| double | vx | |
| double | vy | |
| double | vz | |
| double | x | |
| double | y | |
| double | z | |
| #define ALLEGRO_UNSTABLE 1 |
Definition at line 40 of file ex_trajectory.c.
| #define DT (1.0 / FPS) |
Definition at line 46 of file ex_trajectory.c.
| #define FPS 60.0 |
Definition at line 45 of file ex_trajectory.c.
| #define HEIGHT 600 |
Definition at line 43 of file ex_trajectory.c.
| #define M_PI 3.14159265358979323846 |
Definition at line 62 of file ex_trajectory.c.
| #define MAX_TRAIL 300 |
Definition at line 47 of file ex_trajectory.c.
| #define MAX_WP2D 50 |
Definition at line 71 of file ex_trajectory.c.
| #define NUM_WP3D 7 |
Definition at line 94 of file ex_trajectory.c.
| #define PANEL_W 400 |
Definition at line 44 of file ex_trajectory.c.
| #define WIDTH 800 |
Definition at line 42 of file ex_trajectory.c.
|
static |
Definition at line 286 of file ex_trajectory.c.
References TRAJECTORY::current, TRAJECTORY::current_segment, draw_arrow(), draw_full_path_2d(), draw_trail(), HEIGHT, mode, TRAJECTORY::mode, TRAJECTORY::nb_points, PANEL_W, PHYSICS::position, running_2d, PHYSICS::speed, time_2d, trail_2d, trail_2d_count, trail_2d_head, traj_2d, TRAJECTORY_BEFORE, trajectory_compute(), TRAJECTORY_EXTRAP, TRAJECTORY_INTERP, wp2d_count, wp2d_x, and wp2d_y.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 430 of file ex_trajectory.c.
References draw_arrow(), and project_3d().
Referenced by draw_3d_panel().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 487 of file ex_trajectory.c.
References TRAJECTORY::current, TRAJECTORY::current_segment, draw_3d_axes(), draw_arrow(), draw_full_path_3d(), draw_ground_grid(), draw_trail(), HEIGHT, TRAJECTORY::nb_points, NUM_WP3D, PANEL_W, PHYSICS::position, project_3d(), PHYSICS::speed, time_3d, trail_3d, trail_3d_count, trail_3d_head, traj_3d, trajectory_compute(), waypoints_3d, and WIDTH.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 147 of file ex_trajectory.c.
Referenced by draw_2d_panel(), draw_3d_axes(), and draw_3d_panel().
Here is the caller graph for this function:
|
static |
Definition at line 249 of file ex_trajectory.c.
References TRAJECTORY::nb_points, TRAJECTORY::points, TRAJECTORY_POINT::time_val, traj_2d, and trajectory_get_position().
Referenced by draw_2d_panel().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 463 of file ex_trajectory.c.
References TRAJECTORY::nb_points, TRAJECTORY::points, project_3d(), TRAJECTORY_POINT::time_val, traj_3d, and trajectory_get_position().
Referenced by draw_3d_panel().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 450 of file ex_trajectory.c.
References project_3d().
Referenced by draw_3d_panel().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 159 of file ex_trajectory.c.
References MAX_TRAIL.
Referenced by draw_2d_panel(), and draw_3d_panel().
Here is the caller graph for this function:
|
static |
Definition at line 221 of file ex_trajectory.c.
References MAX_WP2D, PANEL_W, rebuild_2d_trajectory(), wp2d_count, WP2D_SPEED, wp2d_t, wp2d_x, and wp2d_y.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 391 of file ex_trajectory.c.
References init_physics_3d(), NUM_WP3D, time_3d, time_3d_end, trail_3d_count, trail_3d_head, traj_3d, TRAJECTORY_3D, trajectory_add_point(), trajectory_new(), WAYPOINT3D::vx, WAYPOINT3D::vy, WAYPOINT3D::vz, waypoints_3d, WP3D_DUR, WAYPOINT3D::x, WAYPOINT3D::y, and WAYPOINT3D::z.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 108 of file ex_trajectory.c.
References PHYSICS::position, PHYSICS::speed, and VECTOR3D_SET.
Referenced by rebuild_2d_trajectory().
Here is the caller graph for this function:
|
static |
Definition at line 114 of file ex_trajectory.c.
References PHYSICS::position, PHYSICS::speed, and VECTOR3D_SET.
Referenced by init_3d().
Here is the caller graph for this function:| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 584 of file ex_trajectory.c.
References TRAJECTORY::current, display, done, draw_2d_panel(), draw_3d_panel(), DT, FPS, handle_click_2d(), HEIGHT, init_3d(), LOG_ERR, LOG_NOTICE, n_abort(), n_log, TRAJECTORY::nb_points, PANEL_W, PHYSICS::position, reset_2d(), running_2d, set_log_level(), time_2d, trail_push_2d(), traj_2d, traj_3d, trajectory_compute(), trajectory_delete(), update_3d_logic(), and WIDTH.
Here is the call graph for this function:
|
static |
Definition at line 136 of file ex_trajectory.c.
References HEIGHT, M_PI, and PANEL_W.
Referenced by draw_3d_axes(), draw_3d_panel(), draw_full_path_3d(), draw_ground_grid(), and update_3d_logic().
Here is the caller graph for this function:
|
static |
Definition at line 179 of file ex_trajectory.c.
References init_physics_2d(), running_2d, traj_2d, trajectory_add_point(), trajectory_clear_points(), wp2d_count, wp2d_t, wp2d_x, and wp2d_y.
Referenced by handle_click_2d().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 211 of file ex_trajectory.c.
References running_2d, time_2d, trail_2d_count, trail_2d_head, traj_2d, TRAJECTORY_2D, trajectory_delete(), trajectory_new(), and wp2d_count.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 120 of file ex_trajectory.c.
References MAX_TRAIL, trail_2d, trail_2d_count, and trail_2d_head.
Referenced by main().
Here is the caller graph for this function:
|
static |
Definition at line 127 of file ex_trajectory.c.
References MAX_TRAIL, trail_3d, trail_3d_count, and trail_3d_head.
Referenced by update_3d_logic().
Here is the caller graph for this function:
|
static |
Definition at line 410 of file ex_trajectory.c.
References TRAJECTORY::current, DT, TRAJECTORY::nb_points, PHYSICS::position, project_3d(), time_3d, time_3d_end, trail_3d_count, trail_3d_head, trail_push_3d(), traj_3d, and trajectory_compute().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 68 of file ex_trajectory.c.
Referenced by draw_2d_panel(), main(), rebuild_2d_trajectory(), and reset_2d().
|
static |
Definition at line 67 of file ex_trajectory.c.
Referenced by draw_2d_panel(), main(), and reset_2d().
|
static |
Definition at line 82 of file ex_trajectory.c.
Referenced by draw_3d_panel(), init_3d(), and update_3d_logic().
|
static |
Definition at line 83 of file ex_trajectory.c.
Referenced by init_3d(), and update_3d_logic().
|
static |
Definition at line 76 of file ex_trajectory.c.
Referenced by draw_2d_panel(), and trail_push_2d().
|
static |
Definition at line 77 of file ex_trajectory.c.
Referenced by draw_2d_panel(), reset_2d(), and trail_push_2d().
|
static |
Definition at line 78 of file ex_trajectory.c.
Referenced by draw_2d_panel(), reset_2d(), and trail_push_2d().
|
static |
Definition at line 85 of file ex_trajectory.c.
Referenced by draw_3d_panel(), and trail_push_3d().
|
static |
Definition at line 86 of file ex_trajectory.c.
Referenced by draw_3d_panel(), init_3d(), trail_push_3d(), and update_3d_logic().
|
static |
Definition at line 87 of file ex_trajectory.c.
Referenced by draw_3d_panel(), init_3d(), trail_push_3d(), and update_3d_logic().
|
static |
Definition at line 66 of file ex_trajectory.c.
Referenced by draw_2d_panel(), draw_full_path_2d(), main(), rebuild_2d_trajectory(), and reset_2d().
|
static |
Definition at line 81 of file ex_trajectory.c.
Referenced by draw_3d_panel(), draw_full_path_3d(), init_3d(), main(), and update_3d_logic().
|
static |
Definition at line 95 of file ex_trajectory.c.
Referenced by draw_3d_panel(), and init_3d().
|
static |
Definition at line 73 of file ex_trajectory.c.
Referenced by draw_2d_panel(), handle_click_2d(), rebuild_2d_trajectory(), and reset_2d().
|
static |
Definition at line 74 of file ex_trajectory.c.
Referenced by handle_click_2d().
|
static |
Definition at line 72 of file ex_trajectory.c.
Referenced by handle_click_2d(), and rebuild_2d_trajectory().
|
static |
Definition at line 72 of file ex_trajectory.c.
Referenced by draw_2d_panel(), handle_click_2d(), and rebuild_2d_trajectory().
|
static |
Definition at line 72 of file ex_trajectory.c.
Referenced by draw_2d_panel(), handle_click_2d(), and rebuild_2d_trajectory().
|
static |