Nilorea Library

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros Groups
n_3d.h
Go to the documentation of this file.
1
8 #ifndef _N_3D_HEADER
9 #define _N_3D_HEADER
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
20 #include "n_log.h"
21 #include "n_common.h"
22 #include <sys/time.h>
23
25 #define MOVE_STOPPED 0
26
27 #define MOVE_INTER 1
28
29 #define MOVE_SIMU 2
30
32 #define VECTOR3D_DONT_INTERSECT -2
33
34 #define VECTOR3D_COLLINEAR -1
35
36 #define VECTOR3D_DO_INTERSECT 0
37
39 typedef double VECTOR3D[ 3 ]; /* x , y , z */
40
41
43 #define VECTOR3D_SET( VECTOR , X , Y , Z ) \
44 VECTOR[ 0 ] = (X) ; \
45 VECTOR[ 1 ] = (Y) ; \
46 VECTOR[ 2 ] = (Z) ;
47
49 typedef struct PHYSICS
50 {
52 time_t delta_t ;
54 VECTOR3D position ;
56 VECTOR3D speed ;
58 VECTOR3D acceleration ;
60 VECTOR3D orientation ;
62 VECTOR3D angular_speed ;
64 VECTOR3D angular_acceleration ;
65 } PHYSICS ;
66
67 /* distance between two points */
68 double distance( VECTOR3D p1 , VECTOR3D p2 );
69 /* update componant[ it ] of a VECTOR3D */
70 int update_physics_position_nb( PHYSICS *object , int it , double delta_t );
71 /* update componant[ it ] of a VECTOR3D, reversed time */
72 int update_physics_position_reverse_nb( PHYSICS *object , int it , double delta_t );
73 /* update the position of an object, using the delta time T to update positions */
74 int update_physics_position( PHYSICS *object , double delta_t );
75 /* update the position of an object, using the delta time T to reverse update positions */
76 int update_physics_position_reverse( PHYSICS *object , double delta_t );
77 /* compute if two vector are colliding, storing the resulting point in px */
78 int vector_intersect( VECTOR3D p0 , VECTOR3D p1 , VECTOR3D p2 , VECTOR3D p3 , VECTOR3D *px );
79
81 #define copy_point( __src_ , __dst_ ) \
82 memcpy( __dst_ , __src_ , sizeof( VECTOR3D ) );
83
86 #ifdef __cplusplus
87 }
88 #endif
89
90
91 #endif