当前位置: 首页>>代码示例>>C++>>正文


C++ Box3d类代码示例

本文整理汇总了C++中Box3d的典型用法代码示例。如果您正苦于以下问题:C++ Box3d类的具体用法?C++ Box3d怎么用?C++ Box3d使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Box3d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: meshUnderXformOut

//-*****************************************************************************
void meshUnderXformOut( const std::string &iName )
{
    OArchive archive( Alembic::AbcCoreHDF5::WriteArchive(), iName );

    TimeSamplingPtr ts( new TimeSampling( 1.0 / 24.0, 0.0 ) );

    OXform xfobj( archive.getTop(), "xf", ts );

    OPolyMesh meshobj( xfobj, "mesh", ts );

    OPolyMeshSchema::Sample mesh_samp(
        V3fArraySample( ( const V3f * )g_verts, g_numVerts ),
        Int32ArraySample( g_indices, g_numIndices ),
        Int32ArraySample( g_counts, g_numCounts ) );

    XformSample xf_samp;
    XformOp rotOp( kRotateYOperation );

    Box3d childBounds;
    childBounds.makeEmpty();
    childBounds.extendBy( V3d( 1.0, 1.0, 1.0 ) );
    childBounds.extendBy( V3d( -1.0, -1.0, -1.0 ) );

    xf_samp.setChildBounds( childBounds );

    double rotation = 0.0;

    for ( std::size_t i = 0 ; i < 100 ; ++i )
    {
        xf_samp.addOp( rotOp, rotation );
        xfobj.getSchema().set( xf_samp );
        meshobj.getSchema().set( mesh_samp );
        rotation += 30.0;
    }
}
开发者ID:oyaGG,项目名称:helgemathee-alembic-softimage,代码行数:36,代码来源:PolyMeshTest.cpp

示例2: sampleIntervalAtTime

Imath::Box3d AlembicInput::boundAtTime( double time ) const
{
	if( hasStoredBound() )
	{
		size_t index0, index1;
		double lerpFactor = sampleIntervalAtTime( time, index0, index1 );
		if( index0 == index1 )
		{
			return boundAtSample( index0 );
		}
		else
		{
			Box3d bound0 = boundAtSample( index0 );
			Box3d bound1 = boundAtSample( index1 );		
			Box3d result;
			result.min = lerp( bound0.min, bound1.min, lerpFactor );	
			result.max = lerp( bound0.max, bound1.max, lerpFactor );
			return result;
		}
	}
	else
	{
		Box3d result;
		for( size_t i=0, n=numChildren(); i<n; i++ )
		{
			AlembicInputPtr c = child( i );
			Box3d childBound = c->boundAtTime( time );
			childBound = Imath::transform( childBound, c->transformAtTime( time ) );
			result.extendBy( childBound );
		}
		return result;
	}
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:33,代码来源:AlembicInput.cpp

示例3: AddLine

  int AdFront2 :: AddLine (int pi1, int pi2,
                           const PointGeomInfo & gi1, const PointGeomInfo & gi2)
  {
    int minfn;
    int li;

    FrontPoint2 & p1 = points[pi1];
    FrontPoint2 & p2 = points[pi2];


    nfl++;

    p1.AddLine();
    p2.AddLine();

    minfn = min2 (p1.FrontNr(), p2.FrontNr());
    p1.DecFrontNr (minfn+1);
    p2.DecFrontNr (minfn+1);

    if (dellinel.Size() != 0)
      {
	li = dellinel.Last();
	dellinel.DeleteLast ();
	lines[li] = FrontLine (INDEX_2(pi1, pi2));
      }
    else
      {
	li = lines.Append(FrontLine (INDEX_2(pi1, pi2))) - 1;
      }

  
    if (!gi1.trignum || !gi2.trignum)
      {
	cout << "ERROR: in AdFront::AddLine, illegal geominfo" << endl;
      }
  
    lines[li].SetGeomInfo (gi1, gi2);

    Box3d lbox;
    lbox.SetPoint(p1.P());
    lbox.AddPoint(p2.P());

    linesearchtree.Insert (lbox.PMin(), lbox.PMax(), li);

    if (allflines)
      {
	if (allflines->Used (INDEX_2 (GetGlobalIndex (pi1), 
				      GetGlobalIndex (pi2))))
	  {
	    cerr << "ERROR Adfront2::AddLine: line exists" << endl;
	    (*testout) << "ERROR Adfront2::AddLine: line exists" << endl;
	  }

	allflines->Set (INDEX_2 (GetGlobalIndex (pi1), 
				 GetGlobalIndex (pi2)), 1);
      }

    return li;
  }
开发者ID:Resistancerus,项目名称:Netgen,代码行数:59,代码来源:adfront2.cpp

示例4: Example1_MeshOut

//-*****************************************************************************
//-*****************************************************************************
// WRITING OUT AN ANIMATED MESH
//
// Here we'll create an "Archive", which is Alembic's term for the actual
// file on disk containing all of the scene geometry. The Archive will contain
// a single animated Transform with a single static PolyMesh as its child.
//-*****************************************************************************
//-*****************************************************************************
void Example1_MeshOut()
{
    // Create an OArchive.
    // Like std::iostreams, we have a completely separate-but-parallel class
    // hierarchy for output and for input (OArchive, IArchive, and so on). This
    // maintains the important abstraction that Alembic is for storage,
    // representation, and archival. (as opposed to being a dynamic scene
    // manipulation framework).
    OArchive archive(

        // The hard link to the implementation.
        Alembic::AbcCoreHDF5::WriteArchive(),

        // The file name.
        // Because we're an OArchive, this is creating (or clobbering)
        // the archive with this filename.
        "polyMesh1.abc" );

    // Create a PolyMesh class.
    OPolyMesh meshyObj( OObject( archive, kTop ), "meshy" );
    OPolyMeshSchema &mesh = meshyObj.getSchema();

    // UVs and Normals use GeomParams, which can be written or read
    // as indexed or not, as you'd like.
    OV2fGeomParam::Sample uvsamp( V2fArraySample( (const V2f *)g_uvs,
                                                  g_numUVs ),
                                  kFacevaryingScope );
    // indexed normals
    ON3fGeomParam::Sample nsamp( N3fArraySample( (const N3f *)g_normals,
                                                 g_numNormals ),
                                 kFacevaryingScope );

    // Set a mesh sample.
    // We're creating the sample inline here,
    // but we could create a static sample and leave it around,
    // only modifying the parts that have changed.
    OPolyMeshSchema::Sample mesh_samp(
        V3fArraySample( ( const V3f * )g_verts, g_numVerts ),
        Int32ArraySample( g_indices, g_numIndices ),
        Int32ArraySample( g_counts, g_numCounts ),
        uvsamp, nsamp );

    // not actually the right data; just making it up
    Box3d cbox;
    cbox.extendBy( V3d( 1.0, -1.0, 0.0 ) );
    cbox.extendBy( V3d( -1.0, 1.0, 3.0 ) );
    mesh_samp.setChildBounds( cbox );

    // Set the sample twice
    mesh.set( mesh_samp );
    mesh.set( mesh_samp );


    // Alembic objects close themselves automatically when they go out
    // of scope. So - we don't have to do anything to finish
    // them off!
    std::cout << "Writing: " << archive.getName() << std::endl;
}
开发者ID:oyaGG,项目名称:helgemathee-alembic-softimage,代码行数:67,代码来源:PolyMeshTest.cpp

示例5: ss

//-*****************************************************************************
void ISubDDrw::setTime( chrono_t iSeconds )
{
    IObjectDrw::setTime( iSeconds );
    if ( !valid() )
    {
        m_drwHelper.makeInvalid();
        return;
    }

    // Use nearest for now.
    ISampleSelector ss( iSeconds, ISampleSelector::kNearIndex );
    ISubDSchema::Sample psamp;

    if ( m_subD.getSchema().isConstant() )
    {
        psamp = m_samp;
    }
    else if ( m_subD.getSchema().getNumSamples() > 0 )
    {
        m_subD.getSchema().get( psamp, ss );
    }

    // Get the stuff.
    P3fArraySamplePtr P = psamp.getPositions();
    Int32ArraySamplePtr indices = psamp.getFaceIndices();
    Int32ArraySamplePtr counts = psamp.getFaceCounts();

    Box3d bounds;
    bounds.makeEmpty();

    if ( m_boundsProp && m_boundsProp.getNumSamples() > 0 )
    { bounds = m_boundsProp.getValue( ss ); }

    // Update the mesh hoo-ha.
    m_drwHelper.update( P, V3fArraySamplePtr(),
                        indices, counts, bounds );

    if ( !m_drwHelper.valid() )
    {
        m_subD.reset();
        return;
    }

    // The Object update computed child bounds.
    // Extend them by this.
    if ( !m_drwHelper.getBounds().isEmpty() )
    {
        m_bounds.extendBy( m_drwHelper.getBounds() );
    }
}
开发者ID:BlueBolt,项目名称:bb_alembicArchiveNode,代码行数:51,代码来源:ISubDDrw.cpp

示例6: scene

Imath::Box3f SceneReader::computeBound( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
	ConstSceneInterfacePtr s = scene( path );
	if( !s )
	{
		return Box3f();
	}
	
	Box3d b = s->readBound( context->getFrame() / g_frameRate );
	
	if( b.isEmpty() )
	{
		return Box3f();
	}
	
	return Box3f( b.min, b.max );
}
开发者ID:dboogert,项目名称:gaffer,代码行数:17,代码来源:SceneReader.cpp

示例7: setBoundary

void BulletWorld::setBoundary(const Box3d<float>& box)
{
	btBoxShape* worldBoxShape = new btBoxShape( BulletConverter::convert( box.getLength() * 0.5 ));

	///create 6 planes/half spaces
	for (int i = 0; i < 6; i++)
	{
		btTransform groundTransform;
		groundTransform.setIdentity();
		groundTransform.setOrigin(BulletConverter::convert( box.getCenter()) );
		btVector4 planeEq;
		worldBoxShape->getPlaneEquation(planeEq, i);

		btCollisionShape* shape = new btStaticPlaneShape(-planeEq, planeEq[3]);
		btDefaultMotionState* state = new btDefaultMotionState(groundTransform);
		btRigidBody::btRigidBodyConstructionInfo plain_body_ci(0.0f, state, shape);
		btRigidBody* body = new btRigidBody(plain_body_ci);
		world->addRigidBody(body);
	}
	/*
	{
		btStaticPlaneShape* shape = new btBoxShape(BulletConverter::convert(box));
		btDefaultMotionState* state = new btDefaultMotionState();
		btRigidBody::btRigidBodyConstructionInfo plain_body_ci(0.0f, state, shape);
		btRigidBody* body = new btRigidBody(plain_body_ci);
		world->addRigidBody(body);
	}

	{
		btStaticPlaneShape* shape = new btStaticPlaneShape(btVector3(1.0f, 0.0f, 0.0f), box.getMinX());
		btDefaultMotionState* state = new btDefaultMotionState();
		btRigidBody::btRigidBodyConstructionInfo plain_body_ci(0.0f, state, shape);
		btRigidBody* body = new btRigidBody(plain_body_ci);
		world->addRigidBody(body);
	}

	{
		btCollisionShape* shape = new btStaticPlaneShape(btVector3(0.0f, 0.0f, 1.0f), box.getMinZ());
		btDefaultMotionState* state = new btDefaultMotionState();
		btRigidBody::btRigidBodyConstructionInfo plain_body_ci(0.0f, state, shape);
		btRigidBody* body = new btRigidBody(plain_body_ci);
		world->addRigidBody(body);
	}
	*/
}
开发者ID:SatoshiMabuchi,项目名称:CGLib,代码行数:45,代码来源:BulletWorld.cpp

示例8: BuildScene

  void VisualSceneSpecPoints :: BuildScene (int zoomall)
  {
    if (!mesh) 
      {
	VisualScene::BuildScene(zoomall);
	return;
      }
  
    Box3d box;
  
    if (mesh->GetNSeg())
      {
	box.SetPoint (mesh->Point (mesh->LineSegment(1)[0]));
	for (int i = 1; i <= mesh->GetNSeg(); i++)
	  {
	    box.AddPoint (mesh->Point (mesh->LineSegment(i)[0]));
	    box.AddPoint (mesh->Point (mesh->LineSegment(i)[1]));
	  }
      }
    else if (specpoints.Size() >= 2)
      {
	box.SetPoint (specpoints.Get(1).p);
	for (int i = 2; i <= specpoints.Size(); i++)
	  box.AddPoint (specpoints.Get(i).p);
      }
    else
      {
	box = Box3d (Point3d (0,0,0), Point3d (1,1,1));
      }
  
    if (zoomall == 2 && ((vispar.centerpoint >= 1 && vispar.centerpoint <= mesh->GetNP()) ||
			 vispar.use_center_coords))
      {
	if (vispar.use_center_coords)
	  {
	    center.X() = vispar.centerx; center.Y() = vispar.centery; center.Z() = vispar.centerz; 
	  }
	else
	  center = mesh->Point (vispar.centerpoint);
      }
    else
      center = Center (box.PMin(), box.PMax());
        

    rad = 0.5 * Dist (box.PMin(), box.PMax());
  
  
    CalcTransformationMatrices();
  }
开发者ID:liangcheng,项目名称:netgen,代码行数:49,代码来源:vscsg.cpp

示例9: SPHParticle

PhysicsObject::PhysicsObject(const Box3d<float>& box, const float divideLength, const SPHConstant& constant):
	constant(constant),
	nextId(0)
{
	const auto points = box.toPoints(divideLength);
	for (const auto& pos : points) {
		SPHParticle* p = new SPHParticle(pos, divideLength*0.5f, &this->constant, nextId++);
		particles.push_back(p);
	}
}
开发者ID:SatoshiMabuchi,项目名称:CGLib,代码行数:10,代码来源:PhysicsObject.cpp

示例10: fileNamePlug

Imath::Box3f SceneReader::computeBound( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
	std::string fileName = fileNamePlug()->getValue();
	if( !fileName.size() )
	{
		return Box3f();
	}
	
	ConstSceneInterfacePtr s = SharedSceneInterfaces::get( fileName );
	s = s->scene( path );
	
	Box3d b = s->readBound( context->getFrame() / g_frameRate );
	
	if( b.isEmpty() )
	{
		return Box3f();
	}
	
	return Box3f( b.min, b.max );
}
开发者ID:7on7on,项目名称:gaffer,代码行数:20,代码来源:SceneReader.cpp

示例11: scene

Imath::Box3f SceneReader::computeBound( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
	ConstSceneInterfacePtr s = scene( path );
	if( !s )
	{
		return Box3f();
	}

	if( s->hasBound() )
	{
		const Box3d b = s->readBound( context->getTime() );
		if( b.isEmpty() )
		{
			return Box3f();
		}
		return Box3f( b.min, b.max );
	}
	else
	{
		return unionOfTransformedChildBounds( path, parent );
	}
}
开发者ID:mattigruener,项目名称:gaffer,代码行数:22,代码来源:SceneReader.cpp

示例12: InitMov

/*
Funzione chiamata dalla Align ad ogni ciclo
Riempie i vettori <MovVert> e <MovNorm> con i coordinate e normali presi dal vettore di vertici mov 
della mesh da muovere trasformata secondo la matrice <In>
Calcola anche il nuovo bounding box di tali vertici trasformati.
*/
bool AlignPair::InitMov(
		vector< Point3d > &MovVert,
		vector< Point3d > &MovNorm,
		Box3d &trgbox,
		const Matrix44d &in	)				// trasformazione Iniziale (che porta i punti di trg su src)
{
	Point3d pp,nn;

	MovVert.clear();
	MovNorm.clear();
	trgbox.SetNull();

	A2Mesh::VertexIterator vi;
	for(vi=mov->begin(); vi!=mov->end(); vi++) {
		pp=in*(*vi).P();
		nn=in*Point3d((*vi).P()+(*vi).N())-pp;
		nn.Normalize();
		MovVert.push_back(pp);
		MovNorm.push_back(nn);
		trgbox.Add(pp);
	}
	return true;
}
开发者ID:Jerdak,项目名称:meshlab,代码行数:29,代码来源:AlignPair.cpp

示例13: Intervald

Intervald Sphere::proc(const Box<double>& x) 
{
  Box3d x1;
  Box3d center;
  Box3d diff;
  Intervald m_rtemp;

  if (x.size() == 3)
    {
      x1 = x;
      center = Box<double>(convert(m_x));
      m_rtemp = Intervald(m_r);
    }
  else
    {
      x1 = Box3d(x[0],x[1],x[2]);
      center =  m_xlrp(x[3]);
      m_rtemp = m_rlrp(x[3]);
    }

  diff = x1 - center;
  return diff.length() - m_rtemp;
} 
开发者ID:Seashell2011,项目名称:Wickbert,代码行数:23,代码来源:Sphere.cpp

示例14: worldToVoxel

void worldToVoxel(const Field3D::FieldMapping* mapping,
                  const Box3d &wsBounds,
                  Box3d &vsBounds)
{
  V3d test1, test2;
  mapping->worldToVoxel(test1, test2);
  //! \todo Make this integrate over time
  V3d wsVerts[] = {
    V3d(wsBounds.min.x, wsBounds.min.y, wsBounds.min.z),
    V3d(wsBounds.max.x, wsBounds.min.y, wsBounds.min.z),
    V3d(wsBounds.min.x, wsBounds.max.y, wsBounds.min.z),
    V3d(wsBounds.max.x, wsBounds.max.y, wsBounds.min.z),
    V3d(wsBounds.min.x, wsBounds.min.y, wsBounds.max.z),
    V3d(wsBounds.max.x, wsBounds.min.y, wsBounds.max.z),
    V3d(wsBounds.min.x, wsBounds.max.y, wsBounds.max.z),
    V3d(wsBounds.max.x, wsBounds.max.y, wsBounds.max.z)
  };
  vsBounds.makeEmpty();
  V3d vsP;
  for (int i = 0; i < 8; i++) {
    mapping->worldToVoxel(wsVerts[i], vsP);
    vsBounds.extendBy(vsP);
  }
}
开发者ID:Scyzm2,项目名称:Field3D,代码行数:24,代码来源:FieldMapping.cpp

示例15: Box3d

Box3d Sphere::grad(const Box<double>& x)
{
  Box3d x1;
  Box3d center;
  Box3d g;

  if (x.size() == 3)
    {
      x1 = x;
      center = Box<double>(convert(m_x));
    }
  else
    {
      x1 = Box3d(x[0],x[1],x[2]);
      center = m_xlrp(x[3]);
    }

  g = x1 - center;
  Intervald l = g.lengthSquared();
  if (l.isZero())
    return Box3d(0.0);
  else
    return g / l.sqrt();
}
开发者ID:Seashell2011,项目名称:Wickbert,代码行数:24,代码来源:Sphere.cpp


注:本文中的Box3d类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。