本文整理汇总了C++中BBox3f::grow方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox3f::grow方法的具体用法?C++ BBox3f::grow怎么用?C++ BBox3f::grow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox3f
的用法示例。
在下文中一共展示了BBox3f::grow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extract
BBox3f TriangleMeshFull::extract(size_t id, RTCTriangle* triangles_o, size_t& numTriangles, Vec3fa* positions_o, size_t& numVertices) const
{
BBox3f bounds = empty;
if (motion.size())
{
for (size_t j=0; j<triangles.size(); j++) {
const TriangleMeshFull::Triangle& tri = triangles[j];
triangles_o[numTriangles++] = RTCTriangle((int)numVertices+2*tri.v0,(int)numVertices+2*tri.v1,(int)numVertices+2*tri.v2,(int)(0x80000000 | id),(int)j);
}
for (size_t j=0; j<position.size(); j++) {
const Vector3f p = position[j];
const Vector3f dpdt = motion[j];
positions_o[numVertices++] = Vector3f(p.x,p.y,p.z);
positions_o[numVertices++] = Vector3f(dpdt.x,dpdt.y,dpdt.z);
bounds.grow(p);
bounds.grow(p+dpdt);
}
}
else
{
for (size_t j=0; j<triangles.size(); j++) {
const TriangleMeshFull::Triangle& tri = triangles[j];
triangles_o[numTriangles++] = RTCTriangle((int)numVertices+tri.v0,(int)numVertices+tri.v1,(int)numVertices+tri.v2,(int)id,(int)j);
}
for (size_t j=0; j<position.size(); j++) {
const Vector3f p = position[j];
positions_o[numVertices++] = Vector3f(p.x,p.y,p.z);
bounds.grow(p);
}
}
return bounds;
}
示例2: lheuristic
void FallBackSplitter<Heuristic,PrimRefBlockList>::split(size_t threadIndex, PrimRefAlloc* alloc,
const RTCGeometry* geom,
PrimRefBlockList& prims, const PrimInfo& pinfo,
PrimRefBlockList& lprims, PrimInfo& linfo, Split& lsplit,
PrimRefBlockList& rprims, PrimInfo& rinfo, Split& rsplit)
{
/* enforce split */
size_t lnum = 0; BBox3f lgeomBounds = empty; BBox3f lcentBounds = empty;
size_t rnum = 0; BBox3f rgeomBounds = empty; BBox3f rcentBounds = empty;
atomic_set<PrimRefBlock>::item* lblock = lprims.insert(alloc->malloc(threadIndex));
atomic_set<PrimRefBlock>::item* rblock = rprims.insert(alloc->malloc(threadIndex));
while (atomic_set<PrimRefBlock>::item* block = prims.take())
{
for (size_t i=0; i<block->size(); i++)
{
const PrimRef& prim = block->at(i);
const BBox3f bounds = prim.bounds();
if ((lnum+rnum)&1)
{
lnum++;
lgeomBounds.grow(bounds);
lcentBounds.grow(center2(bounds));
if (likely(lblock->insert(prim))) continue;
lblock = lprims.insert(alloc->malloc(threadIndex));
lblock->insert(prim);
} else {
rnum++;
rgeomBounds.grow(bounds);
rcentBounds.grow(center2(bounds));
if (likely(rblock->insert(prim))) continue;
rblock = rprims.insert(alloc->malloc(threadIndex));
rblock->insert(prim);
}
}
}
new (&linfo) PrimInfo(lnum,lgeomBounds,lcentBounds);
new (&rinfo) PrimInfo(rnum,rgeomBounds,rcentBounds);
/* perform binning of left side */
Heuristic lheuristic(linfo,geom);
typename PrimRefBlockList::iterator liter(lprims);
while (typename PrimRefBlockList::item* block = liter.next()) {
lheuristic.bin(block->base(),block->size());
}
lheuristic.best(lsplit);
/* perform binning of right side */
Heuristic rheuristic(rinfo,geom);
typename PrimRefBlockList::iterator riter(rprims);
while (typename PrimRefBlockList::item* block = riter.next()) {
rheuristic.bin(block->base(),block->size());
}
rheuristic.best(rsplit);
}
示例3: extract
int TriangleMeshWithNormals::extract(RTCScene scene, size_t id) const
{
unsigned mesh = rtcNewTriangleMesh (scene, RTC_GEOMETRY_STATIC, triangles.size(), vertices.size());
//if (mesh != id) throw std::runtime_error("ID does not match");
Vec3fa* vertices_o = (Vec3fa*) rtcMapBuffer(scene,mesh,RTC_VERTEX_BUFFER);
RTCTriangle* triangles_o = (RTCTriangle*) rtcMapBuffer(scene,mesh,RTC_INDEX_BUFFER);
for (size_t j=0; j<triangles.size(); j++) {
const TriangleMeshWithNormals::Triangle& tri = triangles[j];
triangles_o[j].v0 = tri.v0;
triangles_o[j].v1 = tri.v1;
triangles_o[j].v2 = tri.v2;
}
BBox3f bounds = empty;
for (size_t j=0; j<vertices.size(); j++) {
const Vector3f p = vertices[j].p;
vertices_o[j].x = p.x;
vertices_o[j].y = p.y;
vertices_o[j].z = p.z;
bounds.grow(p);
}
rtcUnmapBuffer(scene,mesh,RTC_VERTEX_BUFFER);
rtcUnmapBuffer(scene,mesh,RTC_INDEX_BUFFER);
return mesh;
}
示例4: while
void FallBackSplitter<Heuristic,PrimRefBlockList>::split(size_t threadIndex, PrimRefAlloc* alloc,
const RTCGeometry* geom,
PrimRefBlockList& prims, const PrimInfo& pinfo,
PrimRefBlockList& lprims, PrimInfo& linfo,
PrimRefBlockList& rprims, PrimInfo& rinfo)
{
/* enforce split */
size_t lnum = 0; BBox3f lgeomBounds = empty; BBox3f lcentBounds = empty;
size_t rnum = 0; BBox3f rgeomBounds = empty; BBox3f rcentBounds = empty;
atomic_set<PrimRefBlock>::item* lblock = lprims.insert(alloc->malloc(threadIndex));
atomic_set<PrimRefBlock>::item* rblock = rprims.insert(alloc->malloc(threadIndex));
while (atomic_set<PrimRefBlock>::item* block = prims.take())
{
for (size_t i=0; i<block->size(); i++)
{
const PrimRef& prim = block->at(i);
const BBox3f bounds = prim.bounds();
if ((lnum+rnum)&1)
{
lnum++;
lgeomBounds.grow(bounds);
lcentBounds.grow(center2(bounds));
if (likely(lblock->insert(prim))) continue;
lblock = lprims.insert(alloc->malloc(threadIndex));
lblock->insert(prim);
} else {
rnum++;
rgeomBounds.grow(bounds);
rcentBounds.grow(center2(bounds));
if (likely(rblock->insert(prim))) continue;
rblock = rprims.insert(alloc->malloc(threadIndex));
rblock->insert(prim);
}
}
}
new (&linfo) PrimInfo(lnum,lgeomBounds,lcentBounds);
new (&rinfo) PrimInfo(rnum,rgeomBounds,rcentBounds);
}
示例5: extract
BBox3f TriangleMeshWithNormals::extract(size_t id, RTCTriangle* triangles_o, size_t& numTriangles, Vec3fa* positions_o, size_t& numVertices) const
{
BBox3f bounds = empty;
for (size_t j=0; j<triangles.size(); j++) {
const TriangleMeshWithNormals::Triangle& tri = triangles[j];
triangles_o[numTriangles++] = RTCTriangle((int)numVertices+tri.v0,(int)numVertices+tri.v1,(int)numVertices+tri.v2,(int)id,(int)j);
}
for (size_t j=0; j<vertices.size(); j++) {
const Vector3f p = vertices[j].p;
positions_o[numVertices++] = Vector3f(p.x,p.y,p.z);
bounds.grow(p);
}
return bounds;
}