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


C++ Vector3F函数代码示例

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


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

示例1: setColorScale

bool AdaptiveGridTest::init()
{
	float gz = 128.f;
	setColorScale(.43f / gz);
	setNodeDrawSize(gz * .008f);
	m_msh.fillBox(BoundingBox(-250.f, -50.f, -250.f,
								 250.f,  50.f,  250.f), gz);
	
	m_distFunc.addSphere(Vector3F(    9.f, 17.f, -1.f), 27.f );
	m_distFunc.addSphere(Vector3F(-54.f, -13.f, -1.f), 64.f );
	m_distFunc.addSphere(Vector3F(38.f, -10.f, -22.f), 21.1f );
	m_distFunc.addSphere(Vector3F(-100.f, -3420.1f, -100.f), 3400.f );
	
#define MAX_BUILD_LEVEL 5
#define MAX_BUILD_ERROR .5f
	m_msh.adaptiveBuild<BDistanceFunction>(&m_distFunc, MAX_BUILD_LEVEL, MAX_BUILD_ERROR);
	std::cout<<"\n triangulating"<<std::endl;
	m_msh.triangulateFront();
	
#if 0
	checkTetraVolumeExt<DistanceNode, ITetrahedron>(m_msh.nodes(), m_msh.numTetrahedrons(),
						m_msh.tetrahedrons() );
#endif

	std::cout.flush();
	return true;
}
开发者ID:spinos,项目名称:aphid,代码行数:27,代码来源:AdaptiveGridTest.cpp

示例2: getFarPlane

bool FlyingCamera::onSimCameraQuery(SimCameraQuery *query)
{
   SimObjectTransformQuery tquery;

   query->cameraInfo.fov       = g_rDefaultFOV;
   query->cameraInfo.nearPlane = DEFAULT_NEAR_PLANE;
   query->cameraInfo.farPlane  = getFarPlane();

   if (objFollow && objFollow->processQuery(&tquery))
   {
      Point3F  objPos = tquery.tmat.p;
      Vector3F x, y, z;
      RMat3F   rmat(EulerF(rotation.x - M_PI / 2, rotation.y, -rotation.z));

      tquery.tmat.p   += m_mul(Vector3F(0.0f, rDistance, 0.0f), rmat, &y);
      tquery.tmat.p.z += 2.0f;

      y.neg();
      y.normalize();
      m_cross(y, Vector3F(0.0f, 0.0f, 1.0f), &x);
      x.normalize();
      m_cross(x, y, &z);

      tquery.tmat.setRow(0, x);
      tquery.tmat.setRow(1, y);
      tquery.tmat.setRow(2, z);

      // Set our position
      findLOSPosition(tquery.tmat, objPos);
   }

   query->cameraInfo.tmat = getTransform();
   return (true);
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:34,代码来源:FlyingCamera.cpp

示例3: addNode

LinearSpline::LinearSpline()
{
	addNode();
	addNode();
	mNodes[0]->position = mNodes[0]->position.value() + Vector3F(-0.5, 0.0, 0.0);
	mNodes[1]->position = mNodes[1]->position.value() + Vector3F(+0.5, 0.0, 0.0);
	new RenderLinearSpline(getID());
}
开发者ID:bnagybalint,项目名称:SceneBuilder,代码行数:8,代码来源:LinearSpline.cpp

示例4: Vector3F

float MlRachis::bouncing(const Vector3F & a, const Vector3F & b, const Vector3F & c)
{
	float alpha = Vector3F(a, b).normal().dot(Vector3F(a, c).normal());
	if(alpha < 0.f) return 0.f;
	float lac = Vector3F(a, c).length() * alpha - Vector3F(a, b).length();
	float beta = asin(lac / Vector3F(a, c).length());
	return 2.f - beta - alpha;
}
开发者ID:ahmidou,项目名称:aphid,代码行数:8,代码来源:MlRachis.cpp

示例5: Qx

/////////////////////////////////////////////////////////////
/// Construit le quaternion à partir de 3 angles d'Euler
///
/// \param X : Angle autour de X
/// \param Y : Angle autour de Y
/// \param Z : Angle autour de Z
///
////////////////////////////////////////////////////////////
void Quaternion::FromEulerAngles(float X, float Y, float Z)
{
    Quaternion Qx(Vector3F(1, 0, 0), X);
    Quaternion Qy(Vector3F(0, 1, 0), Y);
    Quaternion Qz(Vector3F(0, 0, 1), Z);

    *this = Qx * Qy * Qz;
}
开发者ID:xcasadio,项目名称:casaengine,代码行数:16,代码来源:Quaternion.cpp

示例6: frameAll

void BaseView::frameAll()
{
    m_centerOfInterest.setZero();
    m_space.setIdentity();
	m_space.setTranslation(Vector3F(0.f, 0.f, 100.f) );
	m_invSpace.setIdentity();
	m_invSpace.setTranslation(Vector3F(0.f, 0.f, -100.f) );
}
开发者ID:spinos,项目名称:aphid,代码行数:8,代码来源:ViewCull.cpp

示例7: sqrt

Vector3F Vector3F::Normalize()
{
	double mag = sqrt(x*x + y*y + z*z); 
	if (mag == 0) return Vector3F(0, 0, 0);
	//Assert(mag != 0, "Vector3F::Normalize vector of magnitude 0 was requested to be normalized.");
	
	mag = 1.0/mag;
	return Vector3F(x*mag, y*mag, z*mag);
}
开发者ID:djia,项目名称:gravitron,代码行数:9,代码来源:PhysUtVector.cpp

示例8: atan

BaseView::BaseView() 
{
	m_centerOfInterest.set(0.f, 0.f, 0.f);
	m_space.setIdentity();
	m_space.setTranslation(Vector3F(0.f, 0.f, 100.f) );
	m_invSpace.setIdentity();
	m_invSpace.setTranslation(Vector3F(0.f, 0.f, -100.f) );
	
/// 35mm Academy
	std::cout<<"\n angle of view "<<180.f/3.14f*2.f * atan(21.9456f/2.f/35.f)<<" deg";
	setFrustum(.864f, .63f, 35.f, -1.f, -20000.f);
	
}
开发者ID:spinos,项目名称:aphid,代码行数:13,代码来源:ViewCull.cpp

示例9: Vector3F

const Vector3F BoundingBox::corner(const int & i) const
{
    const int iz = i / 4;
    const int iy = (i - iz * 4) / 2;
    const int ix = i - iy * 2 - iz * 4;
    return Vector3F(m_data[3 * ix], m_data[1 + 3 * iy], m_data[2 + 3 * iz]);
}
开发者ID:kkaushalp,项目名称:aphid,代码行数:7,代码来源:BoundingBox.cpp

示例10: Vector3F

Vector3F operator*(Matrix4x4F & A, Vector3F & v)
{
	return Vector3F(
		A.m[0][0]*v.x + A.m[0][1]*v.y + A.m[0][2]*v.z + A.m[0][3],
		A.m[1][0]*v.x + A.m[1][1]*v.y + A.m[1][2]*v.z + A.m[1][3],
		A.m[2][0]*v.x + A.m[2][1]*v.y + A.m[2][2]*v.z + A.m[2][3]);
}
开发者ID:djia,项目名称:gravitron,代码行数:7,代码来源:PhysUtVector.cpp

示例11: origin

void QuatJulia::generate()
{
/// eval at uniform grid
	int i, j, k;
	const float grid = 1.f / (float)m_numGrid;
	const Vector3F origin(-.5f+grid * .5f, 
							-.5f+grid * .5f, 
							-.5f+grid * .5f);
	int n = 0;
	for(k=0; k<m_numGrid; ++k ) {
		for(j=0; j<m_numGrid; ++j ) {
			for(i=0; i<m_numGrid; ++i ) {
				Vector3F sample = origin + Vector3F(grid * i, grid * j, grid * k);
				if( evalAt( sample*3.2f ) > 0.f ) {
					n++;
					cvx::Sphere sp;
					sample *= m_scaling;
					sp.set(sample, .001f);
					m_tree->insert((const float *)&sample, sp);
				}
			}
		}
	}
	m_tree->finishInsert();
}
开发者ID:spinos,项目名称:aphid,代码行数:25,代码来源:QuatJulia.cpp

示例12: while

void UniformGrid::refine(KdTree * tree)
{    
	int level1;
	float hh;
    Vector3F sample, subs;
	int u;
	unsigned k;
	BoundingBox box;
	m_cellsToRefine->begin();
	while (!m_cellsToRefine->end()) {
		sdb::CellValue * parentCell = m_cellsToRefine->value();
		if(parentCell->visited > 0) {
        
			k = m_cellsToRefine->key();
			
			level1 = parentCell->level + 1;
			hh = cellSizeAtLevel(level1) * .5f;
			sample = cellCenter(k);
			removeCell(k);
			for(u = 0; u < 8; u++) {
				subs = sample + Vector3F(hh * Cell8ChildOffset[u][0], 
				hh * Cell8ChildOffset[u][1], 
				hh * Cell8ChildOffset[u][2]);
				box.setMin(subs.x - hh, subs.y - hh, subs.z - hh);
                box.setMax(subs.x + hh, subs.y + hh, subs.z + hh);
				if(tree->intersectBox(box)) 
					addCell(subs, level1);
			}
		}
		
		m_cellsToRefine->next();
    }
}
开发者ID:spinos,项目名称:aphid,代码行数:33,代码来源:UniformGrid.cpp

示例13: mortonEncode

void BccLattice::add24Tetrahedron(const Vector3F & center, float h)
{
    const unsigned ccenter = mortonEncode(center);
    unsigned cgreen;
	Vector3F corner;
	unsigned vOctahedron[6];
	int i;
	for(i=0; i < 6; i++) {
        corner = center + Vector3F(h * HexHeighborOffset[i][0], 
        h * HexHeighborOffset[i][1], 
        h * HexHeighborOffset[i][2]);
        
        cgreen = mortonEncode(corner);
        
		sdb::EdgeValue * edge = m_greenEdges->findEdge(ccenter, cgreen);
		if(!edge) {
		    // std::cout<<" edge "<<i<<" connected to "<<center<<" doesn't exist!\n";
		    continue;
		}
		if(edge->visited == 0) {
		    encodeOctahedronVertices(center, h, i, vOctahedron);
		    addTetrahedronsAllNodeVisited(vOctahedron);
		    edge->visited = 1;
		}
    }
}
开发者ID:ahmidou,项目名称:aphid,代码行数:26,代码来源:BccLattice.cpp

示例14: calculateNormal

IFloatBuffer* NormalsUtils::createTriangleSmoothNormals(const IFloatBuffer* vertices,
                                                        const IShortBuffer* indices) {

  const int verticesSize = vertices->size();
  IFloatBuffer* normals = IFactory::instance()->createFloatBuffer(verticesSize);
  for (int i = 0; i < verticesSize; i++) {
    normals->rawPut(i, 0);
  }

  const int indicesSize = indices->size();
  for (int i = 0; i < indicesSize; i += 3) {
    const short index0 = indices->get(i);
    const short index1 = indices->get(i + 1);
    const short index2 = indices->get(i + 2);

    const Vector3F normal = calculateNormal(vertices, index0, index1, index2);
    addNormal(normals, index0, normal);
    addNormal(normals, index1, normal);
    addNormal(normals, index2, normal);
  }

  for (int i = 0; i < verticesSize; i += 3) {
    const float x = normals->get(i);
    const float y = normals->get(i + 1);
    const float z = normals->get(i + 2);

    const Vector3F normal = Vector3F(x, y, z).normalized();
    normals->rawPut(i    , normal._x);
    normals->rawPut(i + 1, normal._y);
    normals->rawPut(i + 2, normal._z);
  }

  return normals;
}
开发者ID:milafrerichs,项目名称:g3m_pod,代码行数:34,代码来源:NormalsUtils.cpp

示例15: sceneCenter

void Base3DView::frameAll()
{
    Vector3F coi = sceneCenter();
    Vector3F eye = coi + Vector3F(0.f, 0.f, 100.f);
    
    getCamera()->lookFromTo(eye, coi);
}
开发者ID:kkaushalp,项目名称:aphid,代码行数:7,代码来源:Base3DView.cpp


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