Nilorea Library

- Main Page
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Macros Groups
Data Structures | Macros | Typedefs | Functions
3D PHYSICS: 3D movement simulations

## Data Structures

struct | PHYSICS

## Macros

#define | MOVE_STOPPED 0
#define | MOVE_INTER 1
#define | MOVE_SIMU 2
#define | VECTOR3D_DONT_INTERSECT -2
#define | VECTOR3D_COLLINEAR -1
#define | VECTOR3D_DO_INTERSECT 0
#define | VECTOR3D_SET(VECTOR, X, Y, Z)
#define | copy_point(__src_, __dst_) memcpy( __dst_ , __src_ , sizeof( VECTOR3D ) );

## Typedefs

typedef double | VECTOR3D [3]
typedef struct PHYSICS | PHYSICS

## Functions

double | distance (VECTOR3D p1, VECTOR3D p2)
| compute the distance between two VECTOR3D points More...
int | update_physics_position_nb (PHYSICS *object, int it, double delta_t)
| Update object position componant. More...
int | update_physics_position_reverse_nb (PHYSICS *object, int it, double delta_t)
| Update object position componant, reversed. More...
int | update_physics_position (PHYSICS *object, double delta_t)
| Update object position, reversed. Wrapper of update_physics_position_reverse_nb to update each componants. More...
int | update_physics_position_reverse (PHYSICS *object, double delta_t)
| Update object position, reversed. Wrapper of update_physics_position_reverse_nb to update each componants. More...
int | vector_intersect (VECTOR3D p0, VECTOR3D p1, VECTOR3D p2, VECTOR3D p3, VECTOR3D *px)
| Compute if two vectors are intersecting or not. More...

## Detailed Description

## Macro Definition Documentation

#define copy_point | ( |  | __src_,
|  |  | __dst_
| ) |  | memcpy( __dst_ , __src_ , sizeof( VECTOR3D ) );

VECTOR3D copy wrapper

Definition at line 81 of file n_3d.h.

#define MOVE_INTER 1

PHYSICS object state for move interpolated between two position

Definition at line 27 of file n_3d.h.

#define MOVE_SIMU 2

PHYSICS object state for move simulated from latest update

Definition at line 29 of file n_3d.h.

#define MOVE_STOPPED 0

PHYSICS object state for STOPPED

Definition at line 25 of file n_3d.h.

#define VECTOR3D_COLLINEAR -1

value when the two VECTOR3D are collinear

Definition at line 34 of file n_3d.h.

#define VECTOR3D_DO_INTERSECT 0

value when the two VECTOR3D are intersecting

Definition at line 36 of file n_3d.h.

#define VECTOR3D_DONT_INTERSECT -2

value when the two VECTOR3D are not connected

Definition at line 32 of file n_3d.h.

#define VECTOR3D_SET | ( |  | VECTOR,
|  |  | X,
|  |  | Y,
|  |  | Z
| ) |  |

Value:
VECTOR[ 0 ] = (X) ; \
VECTOR[ 1 ] = (Y) ; \
VECTOR[ 2 ] = (Z) ;

helper to set a VECTOR3D position

Definition at line 43 of file n_3d.h.

## Typedef Documentation

typedef struct PHYSICS PHYSICS

structure of the physics of an object

typedef double VECTOR3D[3]

struct of a point

Definition at line 39 of file n_3d.h.

## Function Documentation

double distance | ( | VECTOR3D | p1,
|  | VECTOR3D | p2
| ) |  |

compute the distance between two VECTOR3D points

Parameters

  p1 | The first point
  p2 | The second point

Returns
  The computed distance

Definition at line 18 of file n_3d.c.

int update_physics_position | ( | PHYSICS * | object,
|  | double | delta_t
| ) |  |

Update object position, reversed. Wrapper of update_physics_position_reverse_nb to update each componants.

Parameters

  object | The object physics to update
  delta_t | Elapsed time since last call for componant update computing

Returns
  TRUE or FALSE

Definition at line 92 of file n_3d.c.

Here is the call graph for this function:

int update_physics_position_nb | ( | PHYSICS * | object,
|  | int | it,
|  | double | delta_t
| ) |  |

Update object position componant.

Parameters

  object | The object physics to update
  it | Componant of VECTOR3D to update. it values : 0 -> x, 1 -> y , 2 -> z
  delta_t | Elapsed time since last call for componant update computing

Returns
  TRUE or FALSE

Definition at line 32 of file n_3d.c.

Here is the caller graph for this function:

int update_physics_position_reverse | ( | PHYSICS * | object,
|  | double | delta_t
| ) |  |

Update object position, reversed. Wrapper of update_physics_position_reverse_nb to update each componants.

Parameters

  object | The object physics to update
  delta_t | Elapsed time since last call for componant update computing

Returns
  TRUE or FALSE

Definition at line 69 of file n_3d.c.

Here is the call graph for this function:

int update_physics_position_reverse_nb | ( | PHYSICS * | object,
|  | int | it,
|  | double | delta_t
| ) |  |

Update object position componant, reversed.

Parameters

  object | The object physics to update
  it | Componant of VECTOR3D to update. it values : 0 -> x, 1 -> y , 2 -> z
  delta_t | Elapsed time since last call for componant update computing

Returns
  TRUE or FALSE

Definition at line 51 of file n_3d.c.

int vector_intersect | ( | VECTOR3D | p1,
|  | VECTOR3D | p2,
|  | VECTOR3D | p3,
|  | VECTOR3D | p4,
|  | VECTOR3D * | px
| ) |  |

Compute if two vectors are intersecting or not.

Parameters

  p1 | First point of vector 1
  p2 | Second poinf of vector 1
  p3 | First point of vector 2
  p4 | Second point of vector 2
  px | Storage for the eventual point

Returns
  VECTOR3D_DONT_INTERSECT , VECTOR3D_COLLINEAR or VECTOR3D_DO_INTERSECT

Definition at line 126 of file n_3d.c.