Defines | 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.

Defines

#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.


Define Documentation

#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.

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.

Definition at line 525 of file OPC_OptimizedTree.cpp.

#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

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

Definition at line 99 of file OPC_OptimizedTree.cpp.

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

Definition at line 158 of file OPC_OptimizedTree.cpp.

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

Definition at line 364 of file OPC_OptimizedTree.cpp.


Variable Documentation

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.



openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:20