本文整理汇总了C++中BBox::Volume方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::Volume方法的具体用法?C++ BBox::Volume怎么用?C++ BBox::Volume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::Volume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: b
TEST_F(BBoxTest, VolumeWorks) {
BBox b (Point (0, 0, 0), Point (2, 2, 2));
float area = b.Volume();
EXPECT_FLOAT_EQ (8.f, area);
}
示例2: Render
void SurfacePointsRenderer::Render(const Scene &scene) {
// Declare shared variables for Poisson point generation
BBox octBounds = scene.WorldBound();
octBounds.Expand(.001f * powf(octBounds.Volume(), 1.f/3.f));
Octree<SurfacePoint> pointOctree(octBounds);
// Create scene bounding sphere to catch rays that leave the scene
Point sceneCenter;
float sceneRadius;
scene.WorldBound().BoundingSphere(&sceneCenter, &sceneRadius);
Transform ObjectToWorld(Translate(sceneCenter - Point(0,0,0)));
Transform WorldToObject(Inverse(ObjectToWorld));
Reference<Shape> sph = new Sphere(&ObjectToWorld, &WorldToObject,
true, sceneRadius, -sceneRadius, sceneRadius, 360.f);
//Reference<Material> nullMaterial = Reference<Material>(NULL);
Material nullMaterial;
GeometricPrimitive sphere(sph, nullMaterial, NULL);
int maxFails = 2000, repeatedFails = 0, maxRepeatedFails = 0;
if (PbrtOptions.quickRender) maxFails = max(10, maxFails / 10);
int totalPathsTraced = 0, totalRaysTraced = 0, numPointsAdded = 0;
ProgressReporter prog(maxFails, "Depositing samples");
// Launch tasks to trace rays to find Poisson points
PBRT_SUBSURFACE_STARTED_RAYS_FOR_POINTS();
vector<Task *> tasks;
RWMutex *mutex = RWMutex::Create();
int nTasks = NumSystemCores();
for (int i = 0; i < nTasks; ++i)
tasks.push_back(new SurfacePointTask(scene, pCamera, time, i,
minDist, maxFails, *mutex, repeatedFails, maxRepeatedFails,
totalPathsTraced, totalRaysTraced, numPointsAdded, sphere, pointOctree,
points, prog));
EnqueueTasks(tasks);
WaitForAllTasks();
for (uint32_t i = 0; i < tasks.size(); ++i)
delete tasks[i];
RWMutex::Destroy(mutex);
prog.Done();
PBRT_SUBSURFACE_FINISHED_RAYS_FOR_POINTS(totalRaysTraced, numPointsAdded);
if (filename != "") {
// Write surface points to file
FILE *f = fopen(filename.c_str(), "w");
if (!f) {
Error("Unable to open output file \"%s\" (%s)", filename.c_str(),
strerror(errno));
return;
}
fprintf(f, "# points generated by SurfacePointsRenderer\n");
fprintf(f, "# position (x,y,z), normal (x,y,z), area, rayEpsilon\n");
for (u_int i = 0; i < points.size(); ++i) {
const SurfacePoint &sp = points[i];
fprintf(f, "%g %g %g %g %g %g %g %g\n", sp.p.x, sp.p.y, sp.p.z,
sp.n.x, sp.n.y, sp.n.z, sp.area, sp.rayEpsilon);
}
fclose(f);
}
}