Macros | Functions | Variables
OPC_OptimizedTree.cpp File Reference
#include "Stdafx.h"
Include dependency graph for OPC_OptimizedTree.cpp:

Go to the source code of this file.

Macros

#define FIND_MAX_VALUES
 
#define INIT_QUANTIZATION
 
#define PERFORM_QUANTIZATION
 
#define REMAP_DATA(member)
 

Functions

static void _BuildCollisionTree (AABBCollisionNode *linear, const udword box_id, udword &current_id, const AABBTreeNode *current_node)
 
static void _BuildNoLeafTree (AABBNoLeafNode *linear, const udword box_id, udword &current_id, const AABBTreeNode *current_node)
 
inline_ void ComputeMinMax (Point &min, Point &max, const VertexPointers &vp)
 

Variables

static bool gFixQuantized = true
 

Detailed Description

Contains code for optimized trees. Implements 4 trees:

Author
Pierre Terdiman
Date
March, 20, 2001

Definition in file OPC_OptimizedTree.cpp.

Macro Definition Documentation

◆ FIND_MAX_VALUES

#define FIND_MAX_VALUES
Value:
/* Get max values */ \
Point CMax(MIN_FLOAT, MIN_FLOAT, MIN_FLOAT); \
Point EMax(MIN_FLOAT, MIN_FLOAT, MIN_FLOAT); \
for(udword i=0;i<mNbNodes;i++) \
{ \
if(fabsf(Nodes[i].mAABB.mCenter.x)>CMax.x) CMax.x = fabsf(Nodes[i].mAABB.mCenter.x); \
if(fabsf(Nodes[i].mAABB.mCenter.y)>CMax.y) CMax.y = fabsf(Nodes[i].mAABB.mCenter.y); \
if(fabsf(Nodes[i].mAABB.mCenter.z)>CMax.z) CMax.z = fabsf(Nodes[i].mAABB.mCenter.z); \
if(fabsf(Nodes[i].mAABB.mExtents.x)>EMax.x) EMax.x = fabsf(Nodes[i].mAABB.mExtents.x); \
if(fabsf(Nodes[i].mAABB.mExtents.y)>EMax.y) EMax.y = fabsf(Nodes[i].mAABB.mExtents.y); \
if(fabsf(Nodes[i].mAABB.mExtents.z)>EMax.z) EMax.z = fabsf(Nodes[i].mAABB.mExtents.z); \
}

Definition at line 490 of file OPC_OptimizedTree.cpp.

◆ INIT_QUANTIZATION

#define INIT_QUANTIZATION
Value:
udword nbc=15; /* Keep one bit for sign */ \
udword nbe=15; /* Keep one bit for fix */ \
if(!gFixQuantized) nbe++; \
\
/* Compute quantization coeffs */ \
Point CQuantCoeff, EQuantCoeff; \
CQuantCoeff.x = CMax.x!=0.0f ? float((1<<nbc)-1)/CMax.x : 0.0f; \
CQuantCoeff.y = CMax.y!=0.0f ? float((1<<nbc)-1)/CMax.y : 0.0f; \
CQuantCoeff.z = CMax.z!=0.0f ? float((1<<nbc)-1)/CMax.z : 0.0f; \
EQuantCoeff.x = EMax.x!=0.0f ? float((1<<nbe)-1)/EMax.x : 0.0f; \
EQuantCoeff.y = EMax.y!=0.0f ? float((1<<nbe)-1)/EMax.y : 0.0f; \
EQuantCoeff.z = EMax.z!=0.0f ? float((1<<nbe)-1)/EMax.z : 0.0f; \
/* Compute and save dequantization coeffs */ \
mCenterCoeff.x = CQuantCoeff.x!=0.0f ? 1.0f / CQuantCoeff.x : 0.0f; \
mCenterCoeff.y = CQuantCoeff.y!=0.0f ? 1.0f / CQuantCoeff.y : 0.0f; \
mCenterCoeff.z = CQuantCoeff.z!=0.0f ? 1.0f / CQuantCoeff.z : 0.0f; \
mExtentsCoeff.x = EQuantCoeff.x!=0.0f ? 1.0f / EQuantCoeff.x : 0.0f; \
mExtentsCoeff.y = EQuantCoeff.y!=0.0f ? 1.0f / EQuantCoeff.y : 0.0f; \
mExtentsCoeff.z = EQuantCoeff.z!=0.0f ? 1.0f / EQuantCoeff.z : 0.0f; \

Definition at line 504 of file OPC_OptimizedTree.cpp.

◆ PERFORM_QUANTIZATION

#define PERFORM_QUANTIZATION

Definition at line 525 of file OPC_OptimizedTree.cpp.

◆ REMAP_DATA

#define REMAP_DATA (   member)
Value:
/* Fix data */ \
Data = Nodes[i].member; \
if(!(Data&1)) \
{ \
/* Compute box number */ \
udword Nb = (Data - udword(Nodes))/Nodes[i].GetNodeSize(); \
Data = udword(&mNodes[Nb]); \
} \
/* ...remapped */ \
mNodes[i].member = Data;

Definition at line 573 of file OPC_OptimizedTree.cpp.

Function Documentation

◆ _BuildCollisionTree()

static void _BuildCollisionTree ( AABBCollisionNode linear,
const udword  box_id,
udword current_id,
const AABBTreeNode current_node 
)
related

Definition at line 99 of file OPC_OptimizedTree.cpp.

◆ _BuildNoLeafTree()

static void _BuildNoLeafTree ( AABBNoLeafNode linear,
const udword  box_id,
udword current_id,
const AABBTreeNode current_node 
)
related

Definition at line 158 of file OPC_OptimizedTree.cpp.

◆ ComputeMinMax()

inline_ void ComputeMinMax ( Point min,
Point max,
const VertexPointers vp 
)

Definition at line 364 of file OPC_OptimizedTree.cpp.

Variable Documentation

◆ gFixQuantized

bool gFixQuantized = true
static

Compilation flag:

  • true to fix quantized boxes (i.e. make sure they enclose the original ones)
  • false to see the effects of quantization errors (faster, but wrong results in some cases)

Definition at line 76 of file OPC_OptimizedTree.cpp.

MIN_FLOAT
#define MIN_FLOAT
min possible loat value
Definition: IceTypes.h:131
i
png_uint_32 i
Definition: png.h:2732
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
gFixQuantized
static bool gFixQuantized
Definition: OPC_OptimizedTree.cpp:76


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:05