本文整理汇总了C++中AABB::expand方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::expand方法的具体用法?C++ AABB::expand怎么用?C++ AABB::expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawCircle
void drawCircle(glm::vec2 c, float r)
{
float hr = 0.5f * r;
glBindTexture(GL_TEXTURE_2D, circleTexture);
AABB bounds;
bounds.include(c);
bounds.expand(hr);
drawSprite(bounds);
}
示例2: CM_CalculateWidestBoundingBox
/**
* @brief Calculates the worst case bounding box for the given bsp model
* @param[in] model The model to calculate the bbox for
* @param[out] box The bbox to fill
*/
static void CM_CalculateWidestBoundingBox (const cBspModel_t* model, AABB& box)
{
/* Quickly calculate the bounds of this model to see if they can overlap. */
box.set(model->cbmBox);
box.shift(model->origin);
if (VectorNotEmpty(model->angles)) {
const float offset = std::max(std::max(box.getWidthX(), box.getWidthY()), box.getWidthZ()) / 2.0;
box.expand(offset); /* expand the whole box by the highest extent we found */
}
}
示例3: ProcessSubModel
/**
* @sa ProcessModels
*/
static void ProcessSubModel (int entityNum)
{
const entity_t* e;
int start, end;
tree_t* tree;
bspbrush_t* list;
AABB aabb;
BeginModel(entityNum);
e = &entities[entityNum];
#if 0
Com_Printf("Processing entity: %i into model %i (%s:%s)\n", entityNum, curTile->nummodels, e->epairs->key, e->epairs->value);
#endif
start = e->firstbrush;
end = start + e->numbrushes;
aabb.reset();
aabb.expand(MAX_WORLD_WIDTH);
/* every level (-1) */
list = MakeBspBrushList(start, end, -1, aabb);
if (!config.nocsg)
list = ChopBrushes(list);
tree = BuildTree(list, aabb.mins, aabb.maxs);
assert(tree);
assert(tree->headnode);
if (tree->headnode->planenum == PLANENUM_LEAF)
Sys_Error("No head node bmodel of %s (%i)\n", ValueForKey(e, "classname"), entityNum);
MakeTreePortals(tree);
MarkVisibleSides(tree, start, end);
MakeFaces(tree->headnode);
FixTjuncs(tree->headnode);
curTile->models[curTile->nummodels].headnode = WriteBSP(tree->headnode);
FreeTree(tree);
EndModel();
}
示例4: syncForceModel
bool Deformable::syncForceModel() {
if(m_lpVolMesh == NULL)
return false;
//recompute AABB for volume mesh
AABB aabb = m_lpVolMesh->computeAABB();
aabb.expand(1.0);
setAABB(aabb);
//degrees of freedom
m_dof = 3 * m_lpVolMesh->countNodes();
//fetch vertices
vector<double> vertices;
vertices.resize(m_dof);
U32 ctNodes = m_lpVolMesh->countNodes();
for(U32 i = 0; i < ctNodes; i++) {
vec3d pos = m_lpVolMesh->const_nodeAt(i).pos;
pos.store(&vertices[i * 3]);
}
vector<int> elements;
elements.resize(m_lpVolMesh->countCells() * 4);
U32 ctCells = m_lpVolMesh->countCells();
for(U32 i = 0; i < ctCells; i++) {
const CELL& cell = m_lpVolMesh->const_cellAt(i);
for(U32 j=0; j < 4; j++)
elements[i * 4 + j] = cell.nodes[j];
}
//recompute Volume
m_restVolume = computeVolume();
//cleanup
SAFE_DELETE(m_lpIntegrator);
SAFE_DELETE(m_lpMassMatrix);
SAFE_DELETE(m_lpDeformableForceModel);
SAFE_DELETE(m_lpDeformable);
SAFE_DELETE(m_lpForceModelTetMesh);
SAFE_DELETE(m_q);
SAFE_DELETE(m_qVel);
SAFE_DELETE(m_qAcc);
SAFE_DELETE(m_arrExtForces);
//build temp tet mesh
SAFE_DELETE(m_lpForceModelTetMesh);
m_lpForceModelTetMesh = new TetMesh(ctNodes, &vertices[0], ctCells, &elements[0], 1E7, 0.46, 1000);
//Setup Deformable Model
SAFE_DELETE(m_lpDeformable);
m_lpDeformable = new CorotationalLinearFEM(m_lpForceModelTetMesh);
//Setup Force Model
SAFE_DELETE(m_lpDeformableForceModel);
m_lpDeformableForceModel = new CorotationalLinearFEMForceModel(m_lpDeformable);
//Compute Mass Matrix
SAFE_DELETE(m_lpMassMatrix);
GenerateMassMatrix::computeMassMatrix(m_lpForceModelTetMesh, &m_lpMassMatrix, true);
//values
m_q = new double[m_dof];
m_qVel = new double[m_dof];
m_qAcc = new double[m_dof];
m_arrExtForces = new double[m_dof];
//reset solver
//Update DOFS
FixedVerticesToFixedDOF(m_vFixedVertices, m_vFixedDofs);
//Rebuilt Integrator
int ctThreads = tbb::task_scheduler_init::default_num_threads();
LogInfoArg1("Setup Integrator with %d threads.", ctThreads);
// initialize the Integrator
m_lpIntegrator = new VolumeConservingIntegrator(m_dof, m_timeStep,
m_lpMassMatrix,
m_lpDeformableForceModel,
m_positiveDefiniteSolver,
m_vFixedDofs.size(),
&m_vFixedDofs[0],
m_dampingMassCoeff,
m_dampingStiffnessCoeff,
1, 1E-6, ctThreads);
return true;
}