195 lines
7.6 KiB
C
195 lines
7.6 KiB
C
/*
|
|
MODULE : COL (Intersection & Collision Library)
|
|
AUTHOR : Frederic PHILIPPE
|
|
UBI R&D
|
|
FILE : Box.h (Box utils)
|
|
*/
|
|
|
|
#ifndef COL_BOX_H
|
|
#define COL_BOX_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
#include "cpa_expt.h"
|
|
|
|
/* For Global declaration in C files : */
|
|
#ifdef COL_GLOBALS
|
|
#define COL_EXTERN extern
|
|
#else /* !COL_GLOBALS */
|
|
#define COL_EXTERN
|
|
#endif /* !COL_GLOBALS */
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
INCLUDES FILES
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "Futil.h"
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
CONSTANT DECLARATION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#define COL_C_xXMinYMinZMin 0
|
|
#define COL_C_xXMinYMinZMax 1
|
|
#define COL_C_xXMinYMaxZMin 2
|
|
#define COL_C_xXMinYMaxZMax 3
|
|
#define COL_C_xXMaxYMinZMin 4
|
|
#define COL_C_xXMaxYMinZMax 5
|
|
#define COL_C_xXMaxYMaxZMin 6
|
|
#define COL_C_xXMaxYMaxZMax 7
|
|
|
|
#define COL_C_xNbVerticesPerBox 8
|
|
|
|
#define COL_C_xXMin 0
|
|
#define COL_C_xXMax 1
|
|
#define COL_C_xYMin 2
|
|
#define COL_C_xYMax 3
|
|
#define COL_C_xZMin 4
|
|
#define COL_C_xZMax 5
|
|
|
|
#define COL_C_ulNullMask 0x00
|
|
#define COL_C_ulXMinMask 0x01
|
|
#define COL_C_ulXMaxMask 0x02
|
|
#define COL_C_ulYMinMask 0x04
|
|
#define COL_C_ulYMaxMask 0x08
|
|
#define COL_C_ulZMinMask 0x10
|
|
#define COL_C_ulZMaxMask 0x20
|
|
#define COL_C_ulAllPMask 0x3F
|
|
|
|
#define COL_C_ulFullMask 0x3F
|
|
#define COL_C_ulXMinInvMask 0x3E
|
|
#define COL_C_ulXMaxInvMask 0x3D
|
|
#define COL_C_ulYMinInvMask 0x3B
|
|
#define COL_C_ulYMaxInvMask 0x37
|
|
#define COL_C_ulZMinInvMask 0x2F
|
|
#define COL_C_ulZMaxInvMask 0x1F
|
|
|
|
#define COL_C_xNbSidesPerBox 6
|
|
|
|
#define COL_C_xYMinZMin 0
|
|
#define COL_C_xYMinZMax 1
|
|
#define COL_C_xYMaxZMin 2
|
|
#define COL_C_xYMaxZMax 3
|
|
#define COL_C_xXMinZMin 4
|
|
#define COL_C_xXMinZMax 5
|
|
#define COL_C_xXMaxZMin 6
|
|
#define COL_C_xXMaxZMax 7
|
|
#define COL_C_xXMinYMin 8
|
|
#define COL_C_xXMinYMax 9
|
|
#define COL_C_xXMaxYMin 10
|
|
#define COL_C_xXMaxYMax 11
|
|
|
|
#define COL_C_xNbEdgesPerBox 12
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
TYPES DEFINITION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
typedef MTH3D_tdstVector COL_tda8st8VerticesBox[COL_C_xNbVerticesPerBox];
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
GLOBAL VARIABLE DECLARATION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
extern MTH3D_tdstVector COL_g_a6_stBoxSidesNormal[COL_C_xNbSidesPerBox];
|
|
extern GEO_tdstDoubledIndex COL_g_a12_stBoxEdges[COL_C_xNbEdgesPerBox];
|
|
extern unsigned long COL_g_a6_ulBoxSideMask[COL_C_xNbSidesPerBox];
|
|
extern unsigned long COL_g_a6_ulBoxSideInvMask[COL_C_xNbSidesPerBox];
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
FUNCTIONS DECLARATION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
extern CPA_EXPORT void COL_fn_vMinMaxBox2VerticesBox ( COL_tda8st8VerticesBox a8_stBoxDest,
|
|
MTH3D_tdstVector *p_stMinPoint,
|
|
MTH3D_tdstVector *p_stMaxPoint );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfVertices ( MTH3D_tdstVector *p_stMinPoint,
|
|
MTH3D_tdstVector *p_stMaxPoint,
|
|
ACP_tdxIndex xNbVertices,
|
|
MTH3D_tdstVector *d_stListOfVertices );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfVerticesBoxes ( MTH3D_tdstVector *p_stMinPoint,
|
|
MTH3D_tdstVector *p_stMaxPoint,
|
|
COL_tda8st8VerticesBox a8_stBox1,
|
|
COL_tda8st8VerticesBox a8_stBox2 );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfBoxes ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stMinPoint1,
|
|
MTH3D_tdstVector *p_stMaxPoint1,
|
|
MTH3D_tdstVector *p_stMinPoint2,
|
|
MTH3D_tdstVector *p_stMaxPoint2 );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingSphereOfBox ( MTH3D_tdstVector *p_stSphereCenter,
|
|
MTH_tdxReal *p_xSphereRadius,
|
|
MTH3D_tdstVector *p_stMinPoint,
|
|
MTH3D_tdstVector *p_stMaxPoint );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfSphere ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stSphereCenter,
|
|
MTH_tdxReal xSphereRadius );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfSpheres ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stSphereCenter1,
|
|
MTH_tdxReal xSphereRadius1,
|
|
MTH3D_tdstVector *p_stSphereCenter2,
|
|
MTH_tdxReal xSphereRadius2 );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfSphereAndBox ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stSphereCenter,
|
|
MTH_tdxReal xSphereRadius,
|
|
MTH3D_tdstVector *p_stMinPoint,
|
|
MTH3D_tdstVector *p_stMaxPoint );
|
|
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfGeometricObject ( MTH3D_tdstVector *p_stMinPoint,
|
|
MTH3D_tdstVector *p_stMaxPoint,
|
|
GEO_tdstGeometricObject *p_stGeomObj );
|
|
|
|
/* ANNECY MT 25/02/98 {*/
|
|
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfSpheresWithSameRadius ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stSphereCenter1,
|
|
MTH3D_tdstVector *p_stSphereCenter2,
|
|
MTH_tdxReal xSphereRadius );
|
|
|
|
extern CPA_EXPORT void COL_fn_vUpdateBoundingBoxOfSpheresWithSameRadius ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stSphereCenter1,
|
|
MTH3D_tdstVector *p_stSphereCenter2,
|
|
MTH_tdxReal xSphereRadius );
|
|
|
|
extern CPA_EXPORT void COL_fn_vUpdateBoundingBoxOfSpheres ( MTH3D_tdstVector *p_stMinBounding,
|
|
MTH3D_tdstVector *p_stMaxBounding,
|
|
MTH3D_tdstVector *p_stSphereCenter1,
|
|
MTH_tdxReal xSphereRadius1,
|
|
MTH3D_tdstVector *p_stSphereCenter2,
|
|
MTH_tdxReal xSphereRadius2 );
|
|
|
|
extern CPA_EXPORT ACP_tdxBool COL_fn_bDetectCollisionBetweenTwoParallelBoxes(MTH3D_tdstVector * _p_stFirstBoxMaxPoint,
|
|
MTH3D_tdstVector * _p_stFirstBoxMinPoint,
|
|
MTH3D_tdstVector * _p_stSecondBoxMaxPoint,
|
|
MTH3D_tdstVector * _p_stSecondBoxMinPoint);
|
|
/* END ANNECY MT }*/
|
|
|
|
#ifdef __cplusplus
|
|
};
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* COL_BOX_H */
|