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


C++ vector3类代码示例

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


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

示例1: double

  bool OBRing::findCenterAndNormal(vector3 & center, vector3 &norm1, vector3 &norm2)
  {
    OBMol *mol= this->_parent;
    int j= 0;
    const int nA= this->_path.size();
    vector3 tmp;

    center.Set(0.0,0.0,0.0);
    norm1.Set(0.0,0.0,0.0);
    norm2.Set(0.0,0.0,0.0);
    for (j = 0; j != nA; ++j)
      {
        center += (mol->GetAtom(_path[j]))->GetVector();
      }
    center/= double(nA);

    for (j = 0; j != nA; ++j)
      {
        vector3 v1= (mol->GetAtom(_path[j]))->GetVector() - center;
        vector3 v2= (mol->GetAtom(_path[j+1==nA?0:j+1]))->GetVector() - center;
        tmp= cross(v1,v2);
        norm1+= tmp;
      }
    norm1/= double(nA);
    norm1.normalize();
    norm2= norm1;
    norm2 *= -1.0;
    return(true);
  }
开发者ID:arkose,项目名称:openbabel,代码行数:29,代码来源:ring.cpp

示例2: setFace

//for only world
void UITextBox::setFace(vector3 right, vector3 down){
	right.normalize();
	down.normalize();

	direction = right;
	this->down = down;
}
开发者ID:Vorril,项目名称:Cubesprawl,代码行数:8,代码来源:UITextBox.cpp

示例3: Camera

 Camera(vector3 p, vector3 d, vector3 u) {
   position = p;
   direction = d.normalized();
   up = u.normalized();
   up = (u - direction.projected(u)).normalized();
   right = (direction ^ up).normalized();
 }
开发者ID:jongman,项目名称:ray,代码行数:7,代码来源:ray.cpp

示例4: translation_matrix

	matrix4x4 translation_matrix(vector3 const& v)
	{
		return matrix4x4 (1, 0, 0, 0, 
			0, 1, 0, 0, 
			0, 0, 1, 0, 
			v.x(), v.y(), v.z(), 1);
	}
开发者ID:yozhijk,项目名称:test,代码行数:7,代码来源:utils.cpp

示例5: x

const vector3 vector3::operator / (const vector3 &v2) const
{
	vector3 r;
	r.x() = x() / v2.x();
	r.y() = y() / v2.y();
	r.z() = z() / v2.z();
	return r;
}
开发者ID:lsempe,项目名称:uipg,代码行数:8,代码来源:vector.cpp

示例6: acosf

float vector3::AngleBetweenVectors(const vector3& v0, const vector3& v1)
{
	float d = v0.Dot(v1);
	if ( d >= -1.f && d <= 1.f )
	{
		return acosf( d / ( v0.Length() * v1.Length() ) );
	}

	return 0.f;
}
开发者ID:lsempe,项目名称:uipg,代码行数:10,代码来源:vector.cpp

示例7: get_rotation_axis

vector3<float> get_rotation_axis(vector3<float> u, vector3<float> v) {
	u.normalize();
	v.normalize();
	// fix linear case
	if (u == v || u == -v) {
		v[0] += 0.1;
		v[1] += 0.0;
		v[2] += 0.1;
		v.normalize();
	}
	return u.cross(v);
}
开发者ID:channguyen,项目名称:solar-system-opengl-window,代码行数:12,代码来源:main.cpp

示例8: vector3

vector3 vector3::Transform(const vector3& v, const matrix& m)
{
	vector3 result = vector3(	
						(v.x() * m(0,0)) + (v.x() * m(1,0)) + (v.x() * m(2,0))  + m(3,0),
						(v.y() * m(0,1)) + (v.y() * m(1,1)) + (v.y() * m(2,1))  + m(3,1),
						(v.z() * m(0,2)) + (v.z() * m(1,2)) + (v.z() * m(2,2) ) + m(3,2));
	return result;
	
}
开发者ID:lsempe,项目名称:uipg,代码行数:9,代码来源:vector.cpp

示例9: SetData

 //! Implements <a href="http://qsar.sourceforge.net/dicts/blue-obelisk/index.xhtml#calculateOrthogonalisationMatrix">blue-obelisk:calculateOrthogonalisationMatrix</a>
 void OBUnitCell::SetData(const vector3 v1, const vector3 v2, const vector3 v3)
 {
   matrix3x3 m (v1, v2, v3);
   _mOrtho.FillOrth(vectorAngle(v2,v3), // alpha
                    vectorAngle(v1,v3), // beta
                    vectorAngle(v1,v2), // gamma
                    v1.length(),        // a
                    v2.length(),        // b
                    v3.length());       // c
   _mOrient = m.transpose() * _mOrtho.inverse();
   _spaceGroup = NULL;
   _spaceGroupName = "";
   _lattice = OBUnitCell::Undefined;
 }
开发者ID:Antipina,项目名称:OpenBabel-BFGS,代码行数:15,代码来源:generic.cpp

示例10: get_rotation_angle

double get_rotation_angle(vector3<float> u, vector3<float> v) {
	u.normalize();
	v.normalize();
	double cosine_theta = u.dot(v);
	// domain of arccosine is [-1, 1]
	if (cosine_theta > 1) {
		cosine_theta = 1;
	}
	if (cosine_theta < -1) {
		cosine_theta = -1;
	}
	double angle = acos(cosine_theta);
	return angle;
}
开发者ID:channguyen,项目名称:solar-system-opengl-window,代码行数:14,代码来源:main.cpp

示例11: FacePlane

///
//	FacePlane()
//   
//		Which of the six face-plane(s) is point P outside of? 
//
static
int FacePlane(const vector3& p)
{
	int outcode;

	outcode = 0;
	if (p.x() >  .5) outcode |= 0x01;
	if (p.x() < -.5) outcode |= 0x02;
	if (p.y() >  .5) outcode |= 0x04;
	if (p.y() < -.5) outcode |= 0x08;
	if (p.z() >  .5) outcode |= 0x10;
	if (p.z() < -.5) outcode |= 0x20;
   
	return(outcode);
}
开发者ID:bsumirak,项目名称:ugcore,代码行数:20,代码来源:tri_box.cpp

示例12: nStabilizer

//Return size of stabilizer group of a Cartesian displacement (given Cartesian symmetry rotations)
inline int nStabilizer(const vector3<>& n, const std::vector< matrix3<> >& symCart)
{	int nStab = 0;
	for(const matrix3<>& m: symCart)
		if((n - m * n).length_squared() < symmThresholdSq * n.length_squared())
			nStab++;
	return nStab;
}
开发者ID:yalcinozhabes,项目名称:pythonJDFTx,代码行数:8,代码来源:Phonon_init.cpp

示例13: setrot

void matrix::setrot(vector3 p1,vector3 p2)
{
    vector3 _ax=p1*p2;
    _ax.selfnormalize();
    double _th=p1.angle(p2);
    setrot(_th,_ax);
}
开发者ID:dseagrav,项目名称:NASSP,代码行数:7,代码来源:Matrix.cpp

示例14: atan2

void moon::display(const vector3 &moon_pos, const vector3 &sun_pos, double max_view_dist) const
{
	vector3 moon_dir = moon_pos.normal();
	double moon_size = max_view_dist/20;
	float moon_azimuth = atan2(-moon_dir.y, moon_dir.x);
	float moon_elevation = asin(moon_dir.z);

	glsl_moon->use();
	glsl_moon->set_gl_texture(*map_diffuse, loc_diffcol, 0);
	glsl_moon->set_gl_texture(*map_normal, loc_nrml, 1);
	//	transform light into object space
	matrix4 roth = matrix4::rot_z(-RAD_TO_DEG(moon_azimuth));
	matrix4 rotv = matrix4::rot_y(-RAD_TO_DEG(moon_elevation));
	matrix4 model_mat = roth*rotv;
	vector3 l = model_mat.inverse() * sun_pos;
	vector3 nl = vector3(-l.y, l.z, -l.x).normal();	//	OpenGL coordinates
	glsl_moon->set_uniform(loc_lightdir, nl);

	//	render moon
	glPushMatrix();
	model_mat.multiply_gl();
	glTranslated(0.95*max_view_dist, 0, 0);

	primitives::textured_quad(vector3f( 0,  moon_size,  moon_size),
				  vector3f( 0, -moon_size,  moon_size),
				  vector3f( 0, -moon_size, -moon_size),
				  vector3f( 0,  moon_size, -moon_size),
				  *map_diffuse).render_plain();
	glPopMatrix();
}
开发者ID:salamanderrake,项目名称:dangerdeep,代码行数:30,代码来源:moon.cpp

示例15: dir

double controller::ray_traverse(vector3 const & direction) const
{
    float coords[4];
    direction.getAs4Values(coords);
    vector3 dir(coords[0] * cos(-rotation) - coords[2] * sin(-rotation),
                coords[1], 
                coords[0] * sin(-rotation) + coords[2] * cos(-rotation));
    boost::lock_guard<boost::mutex> lock(mutex_);
    core::line3d<f32> ray;
    ray.start = position_ + vector3(0, 5, 0);
    ray.end = position_  + vector3(0, 5, 0) + dir * 1000.0f;

    core::vector3df intersection;
    core::triangle3df hitTriangle;
    
    scene::ISceneNode * selectedSceneNode =
      collision_manager_->getSceneNodeAndCollisionPointFromRay(
        ray,
        intersection, // This will be the position of the collision
        hitTriangle, // This will be the triangle hit in the collision
        0, //IDFlag_IsPickable, // This ensures that only nodes that we have
                // set up to be pickable are considered
        0); // Check 
   return (intersection - position_).getLength();
}
开发者ID:finomen,项目名称:Ivan-Susanin,代码行数:25,代码来源:controller.cpp


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