本文整理汇总了C++中Box3f::makeEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3f::makeEmpty方法的具体用法?C++ Box3f::makeEmpty怎么用?C++ Box3f::makeEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box3f
的用法示例。
在下文中一共展示了Box3f::makeEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadParticles
//-*****************************************************************************
void ReadParticles( const std::string &iFileName )
{
IArchive archive( Alembic::AbcCoreOgawa::ReadArchive(),
iFileName );
IObject topObj( archive, kTop );
IPoints points( topObj, "simpleParticles" );
IPointsSchema& pointsSchema = points.getSchema();
index_t numSamps = pointsSchema.getNumSamples();
std::cout << "\n\nReading points back in. Num frames: "
<< numSamps << std::endl;
IV3fArrayProperty velProp( pointsSchema, "velocity" );
IC3fArrayProperty rgbProp( pointsSchema, "Cs" );
IFloatArrayProperty ageProp( pointsSchema, "age" );
for ( index_t samp = 0; samp < numSamps; ++samp )
{
IPointsSchema::Sample psamp;
pointsSchema.get( psamp, samp );
Box3f bounds;
bounds.makeEmpty();
size_t numPoints = psamp.getPositions()->size();
for ( size_t p = 0; p < numPoints; ++p )
{
bounds.extendBy( (*(psamp.getPositions()))[p] );
}
std::cout << "Sample: " << samp << ", numPoints: " << numPoints
<< ", bounds: " << bounds.min
<< " to " << bounds.max << std::endl;
}
}
示例2: computeBounds
Imath::Box3f computeBounds(const float* vertices, size_t numVertices)
{
using namespace Imath;
Box3f bounds;
bounds.makeEmpty();
V3f vertex;
for(size_t v=0; v < numVertices; ++v)
{
vertex.x = vertices[3 * v + 0];
vertex.y = vertices[3 * v + 1];
vertex.z = vertices[3 * v + 2];
bounds.extendBy(vertex);
}
return bounds;
}
示例3: run
void run() {
PackageManagerPtr myPackageManager( new PackageManager );
ScenePtr myScene = Scene::createStubs(myPackageManager);
dom::NodePtr myMaterial = createColorMaterial(myScene, Vector4f(0.8f,0.8f,0.6f,1.0f));
Box3f myVoxelBox;
myVoxelBox.makeEmpty();
myVoxelBox.extendBy( Point3f(0.0f, 0.0f, 0.0f));
//myVoxelBox.extendBy( Point3f(10.0, 20.0, 30.0f)); // 10x20x30 voxels
myVoxelBox.extendBy( Point3f(1.0f, 1.0f, 1.0f)); // 1x2x4 voxels
Vector3i myVolumeSize(10, 10, 10);
Matrix4f myModelMatrix;
Matrix4f myCameraMatrix;
float mySampleRate = 1.0f;
VectorOfVector3f myReference;
VectorOfVector3f myCandidate;
myModelMatrix.makeIdentity();
myCameraMatrix.makeIdentity();
dom::NodePtr myShape = createVoxelProxyGeometry(myScene, myVoxelBox,
myModelMatrix, myCameraMatrix, myVolumeSize, mySampleRate,
myMaterial->getAttributeString(ID_ATTRIB), "VoxelProxy");
ENSURE(extractPositions(myShape, myReference));
myCameraMatrix.makeXRotating( static_cast<float>(asl::PI/2) );
myShape = createVoxelProxyGeometry(myScene, myVoxelBox, myModelMatrix, myCameraMatrix,
myVolumeSize, mySampleRate, myMaterial->getAttributeString(ID_ATTRIB),
"VoxelProxy");
ENSURE(extractPositions(myShape, myCandidate));
//ENSURE(positionsEqual(myCandidate, myReference, myCameraMatrixf));
//myModelViewMatrix.rotateY(asl::PI * 0.125);
//DPRINT( * myShape );
//dom::NodePtr myBody = createBody(myScene->getWorldRoot(), myShape->getAttributeString(ID_ATTRIBf));
//myScene->save("proxy.x60", false);
}
示例4: modifyTypedPrimitive
void MeshPrimitiveImplicitSurfaceOp::modifyTypedPrimitive( MeshPrimitive * typedPrimitive, const CompoundObject * operands )
{
const float threshold = m_thresholdParameter->getNumericValue();
bool automaticBound = static_cast<const BoolData *>( m_automaticBoundParameter->getValue() )->readable();
Box3f bound;
if (automaticBound)
{
bound.makeEmpty();
PrimitiveVariableMap::const_iterator it = typedPrimitive->variables.find("P");
if (it != typedPrimitive->variables.end())
{
const DataPtr &verticesData = it->second.data;
/// \todo Use depatchTypedData
if (runTimeCast<V3fVectorData>(verticesData))
{
ConstV3fVectorDataPtr p = runTimeCast<V3fVectorData>(verticesData);
for ( V3fVectorData::ValueType::const_iterator it = p->readable().begin();
it != p->readable().end(); ++it)
{
bound.extendBy( *it );
}
}
else if (runTimeCast<V3dVectorData>(verticesData))
{
ConstV3dVectorDataPtr p = runTimeCast<V3dVectorData>(verticesData);
for ( V3dVectorData::ValueType::const_iterator it = p->readable().begin();
it != p->readable().end(); ++it)
{
bound.extendBy( *it );
}
}
else
{
throw InvalidArgumentException("MeshPrimitive has no primitive variable \"P\" of type V3fVectorData/V3dVectorData in MeshPrimitiveImplicitSurfaceOp");
}
}
else
{
throw InvalidArgumentException("MeshPrimitive has no primitive variable \"P\" in MeshPrimitiveImplicitSurfaceOp");
}
}
else
{
bound = static_cast<const Box3fData *>( m_boundParameter->getValue() )->readable();
}
float boundExtend = m_boundExtendParameter->getNumericValue();
bound.min -= V3f( boundExtend, boundExtend, boundExtend );
bound.max += V3f( boundExtend, boundExtend, boundExtend );
V3i resolution;
int gridMethod = m_gridMethodParameter->getNumericValue();
if ( gridMethod == Resolution )
{
resolution = static_cast<const V3iData *>( m_resolutionParameter->getValue() )->readable();
}
else if ( gridMethod == DivisionSize )
{
V3f divisionSize = static_cast<const V3fData *>( m_divisionSizeParameter->getValue() )->readable();
resolution.x = (int)((bound.max.x - bound.min.x) / divisionSize.x);
resolution.y = (int)((bound.max.y - bound.min.y) / divisionSize.y);
resolution.z = (int)((bound.max.z - bound.min.z) / divisionSize.z);
}
else
{
assert( false );
}
resolution.x = std::max( 1, resolution.x );
resolution.y = std::max( 1, resolution.y );
resolution.z = std::max( 1, resolution.z );
/// Calculate a tolerance which is half the size of the smallest grid division
double cacheTolerance = ((bound.max.x - bound.min.x) / (double)resolution.x) / 2.0;
cacheTolerance = std::min(cacheTolerance, ((bound.max.y - bound.min.y) / (double)resolution.y) / 2.0 );
cacheTolerance = std::min(cacheTolerance, ((bound.max.z - bound.min.z) / (double)resolution.z) / 2.0 );
MeshPrimitiveBuilderPtr builder = new MeshPrimitiveBuilder();
typedef MarchingCubes< CachedImplicitSurfaceFunction< V3f, float > > Marcher ;
MeshPrimitiveImplicitSurfaceFunctionPtr fn = new MeshPrimitiveImplicitSurfaceFunction( typedPrimitive );
Marcher::Ptr m = new Marcher
(
new CachedImplicitSurfaceFunction< V3f, float >(
fn,
cacheTolerance
),
//.........这里部分代码省略.........