Table of Contents
- PHYSICS: simple 3D movement simulation
- Structures
- Types
- Functions
- Defines
- Types Documentation
- Functions Documentation
- function vector_normalize
- function vector_intersect
- function vector_dot_product
- function vector_angle_between
- function update_physics_position_reverse_nb
- function update_physics_position_reverse
- function update_physics_position_nb
- function update_physics_position
- function distance
- Macros Documentation
PHYSICS: simple 3D movement simulation
Structures
| Name | |
|---|---|
| struct | PHYSICS structure of the physics of an object |
Types
| Name | |
|---|---|
| typedef double[3] | VECTOR3D struct of a point |
Functions
| Name | |
|---|---|
| double | vector_normalize(VECTOR3D * vec) vector normalize |
| int | vector_intersect(VECTOR3D * p1, VECTOR3D * p2, VECTOR3D * p3, VECTOR3D * p4, VECTOR3D * px) compute if two vector are colliding, storing the resulting point in px |
| double | vector_dot_product(VECTOR3D * vec1, VECTOR3D * vec2) dot product |
| double | vector_angle_between(VECTOR3D * vec1, VECTOR3D * vec2) vector angle with other vector |
| int | update_physics_position_reverse_nb(PHYSICS * object, int it, double delta_t) update component[ it ] of a VECTOR3D, reversed time |
| int | update_physics_position_reverse(PHYSICS * object, double delta_t) update the position of an object, using the delta time T to reverse update positions |
| int | update_physics_position_nb(PHYSICS * object, int it, double delta_t) update component[ it ] of a VECTOR3D |
| int | update_physics_position(PHYSICS * object, double delta_t) update the position of an object, using the delta time T to update positions |
| double | distance(VECTOR3D * p1, VECTOR3D * p2) distance between two points |
Defines
| Name | |
|---|---|
| copy_point(_src, _dst) VECTOR3D copy wrapper. |
|
| VECTOR3D_SET(VECTOR, X, Y, Z) helper to set a VECTOR3D position |
|
| VECTOR3D_DO_INTERSECT value when the two VECTOR3D are intersecting |
|
| VECTOR3D_DONT_INTERSECT value when the two VECTOR3D are not connected |
|
| VECTOR3D_COLLINEAR value when the two VECTOR3D are collinear |
|
| MOVE_STOPPED PHYSICS object state for STOPPED. |
|
| MOVE_SIMU PHYSICS object state for move simulated from latest update. |
|
| MOVE_INTER PHYSICS object state for move interpolated between two position. |
Types Documentation
typedef VECTOR3D
typedef double VECTOR3D[3];
struct of a point
Functions Documentation
function vector_normalize
double vector_normalize(
VECTOR3D * vec
)
vector normalize
Parameters:
- vec VECTOR3D to normalize
Return: normalized value of vec
Return the normalized value of vec.
vector normalize
function vector_intersect
int vector_intersect(
VECTOR3D * p1,
VECTOR3D * p2,
VECTOR3D * p3,
VECTOR3D * p4,
VECTOR3D * px
)
compute if two vector are colliding, storing the resulting point in px
Parameters:
- p1 First point of vector 1
- p2 Second point of vector 1
- p3 First point of vector 2
- p4 Second point of vector 2
- px Storage for the eventual point
Return: VECTOR3D_DONT_INTERSECT , VECTOR3D_COLLINEAR or VECTOR3D_DO_INTERSECT
Compute if two vectors are intersecting or not.
compute if two vector are colliding, storing the resulting point in px
function vector_dot_product
double vector_dot_product(
VECTOR3D * vec1,
VECTOR3D * vec2
)
dot product
Parameters:
Return: dot product value
Compute the dot product of two VECTOR3D.
dot product
function vector_angle_between
double vector_angle_between(
VECTOR3D * vec1,
VECTOR3D * vec2
)
vector angle with other vector
Parameters:
Return: angle between vectors in rad (todeg = returnval * 180/PI_2)
Compute angle between two VECTOR3D.
vector angle with other vector
function update_physics_position_reverse_nb
int update_physics_position_reverse_nb(
PHYSICS * object,
int it,
double delta_t
)
update component[ it ] of a VECTOR3D, reversed time
Parameters:
- object The object physics to update
- it component of VECTOR3D to update. it values : 0 -> x, 1 -> y , 2 -> z
- delta_t Elapsed time since last call for component update computing
Return: TRUE or FALSE
Update object position component, reversed.
update component[ it ] of a VECTOR3D, reversed time
function update_physics_position_reverse
int update_physics_position_reverse(
PHYSICS * object,
double delta_t
)
update the position of an object, using the delta time T to reverse update positions
Parameters:
- object The object physics to update
- delta_t Elapsed time since last call for component update computing
Return: TRUE or FALSE
Update object position, reversed.
update the position of an object, using the delta time T to reverse update positions
Wrapper of update_physics_position_reverse_nb to update each component.
function update_physics_position_nb
int update_physics_position_nb(
PHYSICS * object,
int it,
double delta_t
)
update component[ it ] of a VECTOR3D
Parameters:
- object The object physics to update
- it component of VECTOR3D to update. it values : 0 -> x, 1 -> y , 2 -> z
- delta_t Elapsed time since last call for component update computing
Return: TRUE or FALSE
Update object position component.
update component[ it ] of a VECTOR3D
function update_physics_position
int update_physics_position(
PHYSICS * object,
double delta_t
)
update the position of an object, using the delta time T to update positions
Parameters:
- object The object physics to update
- delta_t Elapsed time since last call for component update computing
Return: TRUE or FALSE
Update object position.
update the position of an object, using the delta time T to update positions
Wrapper of update_physics_position_nb to update each component.
function distance
double distance(
VECTOR3D * p1,
VECTOR3D * p2
)
distance between two points
Parameters:
- p1 The first point
- p2 The second point
Return: The computed distance
compute the distance between two VECTOR3D points
distance between two points
Macros Documentation
define copy_point
#define copy_point(
__src_,
__dst_
)
memcpy(__dst_, __src_, sizeof(VECTOR3D));
VECTOR3D copy wrapper.
define VECTOR3D_SET
#define VECTOR3D_SET(
VECTOR,
X,
Y,
Z
)
do { \
VECTOR[0] = (X); \
VECTOR[1] = (Y); \
VECTOR[2] = (Z); \
} while (0)
helper to set a VECTOR3D position
define VECTOR3D_DO_INTERSECT
#define VECTOR3D_DO_INTERSECT 0
value when the two VECTOR3D are intersecting
define VECTOR3D_DONT_INTERSECT
#define VECTOR3D_DONT_INTERSECT -2
value when the two VECTOR3D are not connected
define VECTOR3D_COLLINEAR
#define VECTOR3D_COLLINEAR -1
value when the two VECTOR3D are collinear
define MOVE_STOPPED
#define MOVE_STOPPED 0
PHYSICS object state for STOPPED.
define MOVE_SIMU
#define MOVE_SIMU 2
PHYSICS object state for move simulated from latest update.
define MOVE_INTER
#define MOVE_INTER 1
PHYSICS object state for move interpolated between two position.
Modules
- AABB3D
- ACCEPT_POOL
- ALLEGRO4
- ALLEGRO5
- ANIM_LIB
- ASTAR
- ATLAS_LIB
- AVRO
- CLOCK_SYNC
- COMMONS
- CONFIGFILE
- CYPHER_BASE64
- CYPHER_VIGENERE
- DEAD_RECKONING
- ENUMS
- EXCEPTIONS
- GAME_ENV
- GIT
- GUI
- HASH_TABLE
- ISOMETRIC_ENGINE
- LIST
- LOG
- LOGNODUP
- LZ4
- NETWORKING
- NETWORK_MSG
- N_COOKIES
- N_DIFF
- N_DIGEST
- N_DISK_CACHE
- N_DNS
- N_ECC
- N_ENTROPY
- N_FILES
- N_FLUIDS
- N_GUI_COLOR
- N_GUI_COLORWHEEL
- N_GUI_CURVE
- N_GUI_GRID
- N_GUI_POPUP
- N_HEX
- N_HTTP3
- N_HTTP_COOKIE
- N_HTTP_FORM
- N_HTTP_MIME
- N_HTTP_REQ
- N_HTTP_RESP
- N_HTTP_ROUTER
- N_HTTP_SERVER
- N_ICC
- N_JSON
- N_KAFKA
- N_LINALG
- N_MODULE
- N_OPENSSL_COMPAT
- N_PRETTY
- N_PTH
- N_QUERY
- N_RANDOM
- N_SHA256
- N_STR
- N_TIFF
- N_TIME
- N_USER
- N_X509
- N_ZIP
- PARTICLES
- PCRE
- PHYSICS
- SIGNALS
- STACK
- THREADS
- TRAJECTORY
- TREE
- ZLIB