您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ v3函数代码示例

51自学网 2021-06-03 09:29:18
  C++
这篇教程C++ v3函数代码示例写得很实用,希望能帮到您。

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

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

示例1: v1

void CMeteorit::Deform(){	//Meteoriten deformieren	// Form 1	m_zgMeteorit[0].TaperY(0.5F, true, false, true);	m_zgMeteorit[0].WaveX(0.1F, 1.5f, 0.0f, true, false, true);	CHVector v1(1, 1, 1, 1);	m_zgMeteorit[0].Magnet(v1, 1.5f, 1.0f, true);	//Form 2	m_zgMeteorit[1].TaperX(0.2F, false, true, true);	m_zgMeteorit[1].WaveX(0.6F, 5.0f, 0.0f, true, false, true);	CHVector v2(0, 2, 2, 1);	m_zgMeteorit[1].Magnet(v2, 1.0f, 1.0f, true);	//Form3	m_zgMeteorit[2].TaperY(0.2f, true, false, true);	m_zgMeteorit[2].RippleY(0.1f, 4, 0.0f, true, false, true);	m_zgMeteorit[2].WaveX(0.1F, 4.0f, 0.0f, true, false, true);	CHVector v3(1, 1, 1, 1);	m_zgMeteorit[2].Magnet(v3, 1.2f, 1.5f, true);}
开发者ID:Volvicious,项目名称:Space-Riddle,代码行数:22,


示例2: smallVectors

template<typename Scalar> void smallVectors(){  typedef Matrix<Scalar, 1, 2> V2;  typedef Matrix<Scalar, 3, 1> V3;  typedef Matrix<Scalar, 1, 4> V4;  Scalar x1 = ei_random<Scalar>(),         x2 = ei_random<Scalar>(),         x3 = ei_random<Scalar>(),         x4 = ei_random<Scalar>();  V2 v2(x1, x2);  V3 v3(x1, x2, x3);  V4 v4(x1, x2, x3, x4);  VERIFY_IS_APPROX(x1, v2.x());  VERIFY_IS_APPROX(x1, v3.x());  VERIFY_IS_APPROX(x1, v4.x());  VERIFY_IS_APPROX(x2, v2.y());  VERIFY_IS_APPROX(x2, v3.y());  VERIFY_IS_APPROX(x2, v4.y());  VERIFY_IS_APPROX(x3, v3.z());  VERIFY_IS_APPROX(x3, v4.z());  VERIFY_IS_APPROX(x4, v4.w());}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:22,


示例3: TEST

TEST(vector4, operatoroverload){	Vector4 v1(3, 2, -8, 5);	Vector4 v2(v1);	Vector4 multiply = v2 * v1;	Vector4 result(9, 4, 64, 25);	EXPECT_TRUE(multiply == result);	v1 = v2 + v1;	result = Vector4(6, 4, -16, 10);	EXPECT_TRUE(v1 == result);	Vector4 v3(4, 4 ,4 ,4); 	Vector4 v4(6, 6, 6, 6);	v1 = v4 - v3;	result = Vector4(2, 2, 2, 2);	EXPECT_TRUE(v1 == result);	v1 = v1 * 3.f;	result = Vector4(6,6,6,6);	EXPECT_TRUE(v1 == result);}
开发者ID:TheCapleGuy,项目名称:MathLib,代码行数:22,


示例4: v1

void DebugRenderer::AddBoundingBox(const BoundingBox& box, const Color& color, bool depthTest, bool solid){    const Vector3& min = box.min_;    const Vector3& max = box.max_;    Vector3 v1(max.x_, min.y_, min.z_);    Vector3 v2(max.x_, max.y_, min.z_);    Vector3 v3(min.x_, max.y_, min.z_);    Vector3 v4(min.x_, min.y_, max.z_);    Vector3 v5(max.x_, min.y_, max.z_);    Vector3 v6(min.x_, max.y_, max.z_);    unsigned uintColor = color.ToUInt();    if (!solid)    {        AddLine(min, v1, uintColor, depthTest);        AddLine(v1, v2, uintColor, depthTest);        AddLine(v2, v3, uintColor, depthTest);        AddLine(v3, min, uintColor, depthTest);        AddLine(v4, v5, uintColor, depthTest);        AddLine(v5, max, uintColor, depthTest);        AddLine(max, v6, uintColor, depthTest);        AddLine(v6, v4, uintColor, depthTest);        AddLine(min, v4, uintColor, depthTest);        AddLine(v1, v5, uintColor, depthTest);        AddLine(v2, max, uintColor, depthTest);        AddLine(v3, v6, uintColor, depthTest);    }    else    {        AddPolygon(min, v1, v2, v3, uintColor, depthTest);        AddPolygon(v4, v5, max, v6, uintColor, depthTest);        AddPolygon(min, v4, v6, v3, uintColor, depthTest);        AddPolygon(v1, v5, max, v2, uintColor, depthTest);        AddPolygon(v3, v2, max, v6, uintColor, depthTest);        AddPolygon(min, v1, v5, v4, uintColor, depthTest);    }}
开发者ID:1vanK,项目名称:Urho3D,代码行数:39,


示例5: QWidget

Widget::Widget(QWidget *parent) :    QWidget(parent),    ui(new Ui::Widget){    ui->setupUi(this);    QVariant v1(15);    qDebug()<<v1.toInt();     QVariant v2(12.3);     qDebug()<<v2.toFloat();     QVariant v3("nihao");     qDebug()<<v3.toString();     QColor color=QColor(Qt::red);     QVariant v4=color;     qDebug()<<v4.type();   //  qDebug()<<v4.value<QColor>;     QString str="hello";     QVariant v5=str;     qDebug()<<v5.canConvert(QVariant::Int);     qDebug()<<v5.toString();     qDebug()<<v5.convert(QVariant::Int);     qDebug()<<v5.toString();}
开发者ID:squirrelClare,项目名称:algorithm_cplusplus,代码行数:22,


示例6: GetDerivatives

void SplineSeg3<D> :: GetDerivatives (const double t, 				      Point<D> & point,				      Vec<D> & first,				      Vec<D> & second) const{  Vec<D> v1(p1), v2(p2), v3(p3);  double b1 = (1.-t)*(1.-t);  double b2 = sqrt(2.)*t*(1.-t);  double b3 = t*t;  double w = b1+b2+b3;  b1 *= 1./w; b2 *= 1./w; b3 *= 1./w;  double b1p = 2.*(t-1.);  double b2p = sqrt(2.)*(1.-2.*t);  double b3p = 2.*t;  const double wp = b1p+b2p+b3p;  const double fac1 = wp/w;  b1p *= 1./w; b2p *= 1./w; b3p *= 1./w;  const double b1pp = 2.;  const double b2pp = -2.*sqrt(2.);  const double b3pp = 2.;  const double wpp = b1pp+b2pp+b3pp;  const double fac2 = (wpp*w-2.*wp*wp)/(w*w);  for(int i=0; i<D; i++)    point(i) = b1*p1(i) + b2*p2(i) + b3*p3(i);       first = (b1p - b1*fac1) * v1 +    (b2p - b2*fac1) * v2 +    (b3p - b3*fac1) * v3;  second = (b1pp/w - b1p*fac1 - b1*fac2) * v1 +    (b2pp/w - b2p*fac1 - b2*fac2) * v2 +    (b3pp/w - b3p*fac1 - b3*fac2) * v3;}
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:38,


示例7: integration_rk4

void integration_rk4(listv2d& r, listv2d& v, listv2d& a, const listdouble& m, const double h, double ti) {  listv2d r1(ITEMS);  listv2d r2(ITEMS);  listv2d r3(ITEMS);  listv2d r4(ITEMS);  listv2d v2(ITEMS);  listv2d v3(ITEMS);  listv2d v4(ITEMS);  listv2d a2(ITEMS);  listv2d a3(ITEMS);  listv2d a4(ITEMS);  for (int i = 0; i < ITEMS; i++) {    r2[i] = r[i] + 0.5 * h * v[i];    v2[i] = v[i] + 0.5 * h * a[i];  }  calc_accel_multiple(r2, a2, m);  for (int i = 0; i < ITEMS; i++) {    r3[i] = r[i] + 0.5 * h * v2[i];    v3[i] = v[i] + 0.5 * h * a2[i];  }  calc_accel_multiple(r3, a3, m);  for (int i = 0; i < ITEMS; i++) {    r4[i] = r[i] + h * v3[i];    v4[i] = v[i] + h * a3[i];  }  calc_accel_multiple(r4, a4, m);  for (int i = 0; i < ITEMS; i++) {    r[i] = r[i] + h/6.0 * (v[i] + 2.0 * v2[i] + 2.0 * v3[i] + v4[i]);    v[i] = v[i] + h/6.0 * (a[i] + 2.0 * a2[i] + 2.0 * a3[i] + a4[i]);  }}
开发者ID:dawehner,项目名称:physics-compo,代码行数:38,


示例8: R_DrawScreenRect

void R_DrawScreenRect( float left, float top, float right, float bottom ){	float mat[16], proj[16];	materialSystemInterface->GetMatrix( MATERIAL_VIEW, mat );	materialSystemInterface->MatrixMode( MATERIAL_VIEW );	materialSystemInterface->LoadIdentity();		materialSystemInterface->GetMatrix( MATERIAL_PROJECTION, proj );	materialSystemInterface->MatrixMode( MATERIAL_PROJECTION );	materialSystemInterface->LoadIdentity();			IMaterial *pMaterial = materialSystemInterface->FindMaterial( "debug//debugportals", NULL );	IMesh *pMesh = materialSystemInterface->GetDynamicMesh( true, NULL, NULL, pMaterial );	CMeshBuilder builder;	builder.Begin( pMesh, MATERIAL_LINE_LOOP, 4 );		Vector v1( left, bottom, 0.5 );		Vector v2( left, top, 0.5 );		Vector v3( right, top, 0.5 );		Vector v4( right, bottom, 0.5 );		builder.Position3fv( v1.Base() ); 		builder.AdvanceVertex();  		builder.Position3fv( v2.Base() ); 		builder.AdvanceVertex();  		builder.Position3fv( v3.Base() ); 		builder.AdvanceVertex();  		builder.Position3fv( v4.Base() ); 		builder.AdvanceVertex();  	builder.End( false, true );	materialSystemInterface->MatrixMode( MATERIAL_VIEW );	materialSystemInterface->LoadIdentity();	materialSystemInterface->MultMatrix( mat );	materialSystemInterface->MatrixMode( MATERIAL_PROJECTION );	materialSystemInterface->LoadIdentity();	materialSystemInterface->MultMatrix( proj );}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:38,


示例9: v1

Real utl::Jacobian (matrix<Real>& J, Vec3& n, matrix<Real>& dNdX,                    const matrix<Real>& X, const matrix<Real>& dNdu,                    size_t t1, size_t t2){  // Compute the Jacobian matrix, J = [dXdu]  J.multiply(X,dNdu); // J = X * dNdu  Real dS;  if (J.cols() == 2)  {    // Compute the face normal    Vec3 v1(J.getColumn(t1));    Vec3 v2(J.getColumn(t2));    Vec3 v3(v1,v2); // v3 = v1 x v2    // Compute the curve dilation (dS) and the in-plane edge normal (n)    dS = v2.normalize(); // dA = |v2|    v3.normalize();    n.cross(v2,v3); // n = v2 x v3 / (|v2|*|v3|)  }  else  {    // Compute the face normal (n) and surface dilation (dS)    n.cross(J.getColumn(t1),J.getColumn(t2)); // n = t1 x t2    dS = n.normalize(); // dS = |n|  }  // Compute the Jacobian inverse  if (J.inverse(epsZ) == Real(0))  {    dS = Real(0);    dNdX.clear();  }  else    // Compute the first order derivatives of the basis function, w.r.t. X    dNdX.multiply(dNdu,J); // dNdX = dNdu * J^-1  return dS;}
开发者ID:OPM,项目名称:IFEM,代码行数:38,


示例10: TEST

TEST(TestArrayList, copy_constructor_test001){	Counter call_count;	TestCls v1(&call_count, 1);	TestCls v2(&call_count, 2);	TestCls v3(&call_count, 3);	ArrayList<TestCls> list;	list.PushBack(v1);	list.PushBack(v2);	list.PushBack(v3);	call_count.reset();	{		ArrayList<TestCls> list2(list);		ASSERT_EQ(3, list2.size());		ASSERT_EQ(1, list2[0].value());		ASSERT_EQ(2, list2[1].value());		ASSERT_EQ(3, list2[2].value());	}	ASSERT_EQ(call_count.constructor, call_count.destructor); 	ASSERT_EQ(3, call_count.constructor); }
开发者ID:oliverjose,项目名称:Protheus,代码行数:23,


示例11: CPPUNIT_ASSERT

   void OutputTest::testVec()   {      std::ostringstream out1;      gmtl::Vec<int, 1> v1;      v1.set( 1 );      out1 << v1;      CPPUNIT_ASSERT( out1.str() == "(1)" );      std::ostringstream out2;      gmtl::Vec<int, 2> v2( 1, 2 );      out2 << v2;      CPPUNIT_ASSERT( out2.str() == "(1, 2)" );      std::ostringstream out3;      gmtl::Vec<int, 3> v3( 1, 2, 3 );      out3 << v3;      CPPUNIT_ASSERT( out3.str() == "(1, 2, 3)" );      std::ostringstream out4;      gmtl::Vec<int,3> v4(1,1,1);      out4 << (v3+v4);      CPPUNIT_ASSERT( out4.str() == "(2, 3, 4)" );   }
开发者ID:jpvanoosten,项目名称:illusionsengine_old,代码行数:23,


示例12: v1

  void RoutePlugin::DrawRoutePoint(const sru::RoutePoint& point)  {    const double arrow_size = ui_.iconsize->value();    tf::Vector3 v1(arrow_size, 0.0, 0.0);    tf::Vector3 v2(0.0, arrow_size / 2.0, 0.0);    tf::Vector3 v3(0.0, -arrow_size / 2.0, 0.0);    tf::Transform point_g(point.orientation(), point.position());    v1 = point_g * v1;    v2 = point_g * v2;    v3 = point_g * v3;    const QColor color = ui_.positioncolor->color();    glLineWidth(3);    glBegin(GL_POLYGON);    glColor4d(color.redF(), color.greenF(), color.blueF(), 1.0);    glVertex2d(v1.x(), v1.y());    glVertex2d(v2.x(), v2.y());    glVertex2d(v3.x(), v3.y());    glEnd();  }
开发者ID:lardemua,项目名称:mapviz,代码行数:23,


示例13: TEST

TEST(ArraySerializationTest, StrictMixedArray) {	AmfInteger v0(0);	AmfString v1("value");	AmfDouble v2(3.1);	AmfObjectTraits traits("", true, false);	AmfObject v3(traits);	AmfArray array;	array.push_back(v0);	array.push_back(v1);	array.push_back(v2);	array.push_back(v3);	isEqual(v8 {		0x09,		0x09,		0x01,		0x04, 0x00,		0x06, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65,		0x05, 0x40, 0x08, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcd,		0x0a, 0x0b, 0x01, 0x01	}, array);}
开发者ID:junfan,项目名称:amf-cpp,代码行数:23,


示例14: v1

    //---------------------------------------------------------------------    void OptimisedUtilGeneral::calculateFaceNormals(        const float *positions,        const EdgeData::Triangle *triangles,        Vector4 *faceNormals,        size_t numTriangles)    {        for ( ; numTriangles; --numTriangles)        {            const EdgeData::Triangle& t = *triangles++;            size_t offset;            offset = t.vertIndex[0] * 3;            Vector3 v1(positions[offset+0], positions[offset+1], positions[offset+2]);            offset = t.vertIndex[1] * 3;            Vector3 v2(positions[offset+0], positions[offset+1], positions[offset+2]);            offset = t.vertIndex[2] * 3;            Vector3 v3(positions[offset+0], positions[offset+1], positions[offset+2]);            *faceNormals++ = Math::calculateFaceNormalWithoutNormalize(v1, v2, v3);        }    }
开发者ID:LiberatorUSA,项目名称:GUCE,代码行数:24,


示例15: QWidget

Widget::Widget(QWidget *parent) :    QWidget(parent),    ui(new Ui::Widget){    ui->setupUi(this);    QVariant v1(15);    qDebug() << v1.toInt();    // 结果为15    QVariant v2(12.3);    qDebug() << v2.toFloat();  // 结果为12.3    QVariant v3("nihao");    qDebug() << v3.toString(); // 结果为"nihao"    QColor color = QColor(Qt::red);    QVariant v4 = color;    qDebug() << v4.type();     // 结果为QVariant::QColor    qDebug() << v4.value<QColor>(); // 结果为QColor(ARGB 1,1,0,0)    QString str = "hello";    QVariant v5 = str;    qDebug() << v5.canConvert(QVariant::Int); // 结果为true    qDebug() << v5.toString();                // 结果为"hello"    qDebug() << v5.convert(QVariant::Int);    // 结果为false    qDebug() << v5.toString();                // 转换失败,v5被清空,结果为"0"}
开发者ID:Rookiee,项目名称:Qt_Codes,代码行数:23,


示例16: makeSphere

/** * makeSphere - Create sphere of a given radius, centered at the origin,  * using spherical coordinates with separate number of thetha and  * phi subdivisions. * * @param radius - Radius of the sphere * @param slides - number of subdivisions in the theta direction * @param stacks - Number of subdivisions in the phi direction. * * Can only use calls to addTriangle */void makeSphere (float r, int slices, int stacks){	float cosp, cosp1, sinp, sinp1, sint, sint1, cost, cost1;	for(int i = 0; i < slices; i++){		cosp = cos(i*M_PI/slices);		cosp1 = cos((i+1)*M_PI/slices);		sinp = sin(i*M_PI/slices);		sinp1 = sin((i+1)*M_PI/slices);		for(int j = 0; j < stacks; j++){			cost = cos(j*2*M_PI/stacks);			cost1 = cos((j+1)*2*M_PI/stacks);			sint = sin(j*2*M_PI/stacks);			sint1 = sin((j+1)*2*M_PI/stacks);			Vertex v1(r*cost*sinp, r*sint*sinp, r*cosp);			Vertex v2(r*cost1*sinp, r*sint1*sinp, r*cosp);			Vertex v3(r*cost*sinp1, r*sint*sinp1, r*cosp1);			Vertex v4(r*cost1*sinp1, r*sint1*sinp1, r*cosp1);			makeTriangle(v1, v3, v4);			makeTriangle(v1,v2,v4);		}	}	}
开发者ID:kristenmills,项目名称:CG,代码行数:34,


示例17: v3

// Calculates v3 for the Prey at index "index". OBSTACLES TO BE ADDED.Vector Sky::tooNear(int index, float K, float O, Vector* obstacles, int n_obstacles){	Vector v3(0,0);	Vector sum1(0,0);	Vector sum2(0,0);	int i;	Vector position1 = flock[index].getPosition();	float contact = flock[index].getContact();		for (i=0; i<flock_size; i++) // For every bird of the flock	{		if(i!=index) 		{			Vector position2 = flock[i].getPosition();						if (position1.isSomeoneTouching(position2,contact) == true)  // Finding birds in radius of perception				sum1 = sum1 + (position2 - position1);		}	}	for (i=0; i<n_obstacles; i++) // For every obstacle	{			Vector obstacle = obstacles[i];					if (position1.isSomeoneTouching(obstacle,contact) == true)			sum2 = sum2 + (obstacle - position1);							//printf("/nsum1 = (%lg,%lg),  sum2 = (%lg,%lg)/n", sum1.getX(), sum1.getY(), sum2.getX(), sum2.getY());				}		//printf("v3=(%lg,%lg)/n", v3.getX(), v3.getY());	v3 = sum1/(-K) +sum2/(-O);	return v3;}
开发者ID:gvattiato,项目名称:ProjetBoids,代码行数:38,


示例18: CalcTetBadness

  double CalcTetBadness (const Point3d & p1, const Point3d & p2,			 const Point3d & p3, const Point3d & p4, double h)  {    double vol, l, ll, lll, ll1, ll2, ll3, ll4, ll5, ll6;    double err;    Vec3d v1 (p1, p2);    Vec3d v2 (p1, p3);    Vec3d v3 (p1, p4);    vol = -Determinant (v1, v2, v3) / 6;    ll1 = v1.Length2();    ll2 = v2.Length2();    ll3 = v3.Length2();    ll4 = Dist2 (p2, p3);    ll5 = Dist2 (p2, p4);    ll6 = Dist2 (p3, p4);    ll = ll1 + ll2 + ll3 + ll4 + ll5 + ll6;    l = sqrt (ll);    lll = l * ll;    if (vol <= 1e-24 * lll)      return 1e24;    err = 0.0080187537 * lll / vol;    // sqrt(216) / (6^4 * sqrt(2))    if (h > 0)      err += ll / (h * h) + 	h * h * ( 1 / ll1 + 1 / ll2 + 1 / ll3 + 		  1 / ll4 + 1 / ll5 + 1 / ll6 ) - 12;        if (teterrpow == 2)      return err*err;    return pow (err, teterrpow);  }
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:37,


示例19: TEST_F

TEST_F(KDLCORBAPluginTest, VectorTest) {   KDL::Vector v1(1.,2.,3.);   KDL::Vector v2(3.,2.,1.);   KDL::Vector v3(4.,5.,6.);   //Set remote property   RTT::Property<KDL::Vector>* prop = tc->properties()->getPropertyType<KDL::Vector>("vectorProperty");   ASSERT_FALSE (prop == 0);   prop->set(v1);   EXPECT_EQ(prop->get(),v1) << "Failed to set remote KDL::Vector property";   // Call vector operation (return current value of prop as return value and sets argument as new value)   RTT::OperationCaller<KDL::Vector (const KDL::Vector& vector_in)> op = tc->getOperation("vectorOperation");   KDL::Vector v4 = op(v2);   EXPECT_EQ(v4,v1) << "Failed to call remote operation with KDL type";   //Write new value to port, will set current value of prop to outport and prop to new value   RTT::OutputPort<KDL::Vector> wport;   RTT::InputPort<KDL::Vector> rport;   depl.addPort(wport);   depl.addPort(rport);   ASSERT_TRUE(wport.connectTo(tc->getPort("VectorIn")) && wport.connected()) << "Failed to connect to remote input port";   ASSERT_TRUE(rport.connectTo(tc->getPort("VectorOut")) && rport.connected()) << "Failed to connect to remote output port";   wport.write(v3);   //wait for remote to handle write   sleep(1);   KDL::Vector v5;   ASSERT_EQ(rport.read(v5),RTT::NewData) << "Failed to read data from port";   //Check if read value equals last value of property:   EXPECT_EQ(v5,v2) << "Failed to read KDL Vector from port";   //Check if current value of property is the written value:   KDL::Vector v6 = prop->get();   EXPECT_EQ(v6,v3) << "Failed to write KDL Vector to port";}
开发者ID:snrkiwi,项目名称:rtt_geometry,代码行数:37,


示例20: v1

void MxPropSlim::compute_face_quadric(MxFaceID i, MxQuadric& Q){	MxFace& f = m->face(i);	MxVector v1(dim());	MxVector v2(dim());	MxVector v3(dim());	if( will_decouple_quadrics )	{		Q.clear();		for(unsigned int p=0; p<prop_count(); p++)		{			v1=0.0;  v2=0.0;  v3=0.0;			pack_prop_to_vector(f[0], v1, p);			pack_prop_to_vector(f[1], v2, p);			pack_prop_to_vector(f[2], v3, p);			// !!BUG: Will count area multiple times (once per property)			MxQuadric Q_p(v1, v2, v3, m->compute_face_area(i));			// !!BUG: Need to only extract the relevant block of the matrix.			//        Adding the whole thing gives us extraneous stuff.			Q += Q_p;		}	}	else	{		pack_to_vector(f[0], v1);		pack_to_vector(f[1], v2);		pack_to_vector(f[2], v3);		Q = MxQuadric(v1, v2, v3, m->compute_face_area(i));	}}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:37,


示例21: TEST

TEST(SharedValueTest, ctorBool){    bool b = true;    EXPECT_NO_THROW(Value v(b));    EXPECT_NO_THROW(Value v(false));    Value v(false);    EXPECT_EQ(v.type(), typeid(bool));    EXPECT_EQ(v.as<bool>(), false);    Value v2(true);    EXPECT_EQ(v2.type(), typeid(bool));    EXPECT_EQ(v2.as<bool>(), true);    Value v3(b);    EXPECT_EQ(v3.type(), typeid(bool));    EXPECT_EQ(v3.as<bool>(), true);    b = false;    Value v4(b);    EXPECT_EQ(v4.type(), typeid(bool));    EXPECT_EQ(v4.as<bool>(), false);    float f = 11.44;    Value v5(!(f - 111));    EXPECT_EQ(v5.type(), typeid(bool));    EXPECT_EQ(v5.as<bool>(), false);    Value v6(!!0.1f);    EXPECT_EQ(v6.type(), typeid(bool));    EXPECT_EQ(v6.as<bool>(), true);    EXPECT_NO_THROW(Value v7(v6));    Value v7(v6);    EXPECT_EQ(v7.type(), typeid(bool));    EXPECT_EQ(v7.as<bool>(), true);}
开发者ID:aasfalcon,项目名称:wexplorer,代码行数:37,


示例22: table

bool test_hash_table_t::run() {	my_table_t table(3);	std::string key;	for (auto ch = 'A'; ch <= 'Z'; ++ch) {		key.clear();		key.push_back(ch);		table[key] = key + " value";	}	(*table.begin()).second += "  #First";	(*table.rbegin()).second += "  #Last";	this->dump_4(&table);	table.insert("A", "A value #2");	table.erase("A");	table.erase("C");	table.erase("G");	table.erase("H");	this->dump_4(&table);	auto v2(table);	this->dump_4(&v2);	v2 = table;	this->dump_4(&v2);	my_table_t v3({ { "11", "11 value" }, { "22", "22 value" }, { "33", "33 value" } });	v3.insert({ { "44", "44 value" },{ "55", "55 value" },{ "66", "66 value" } });	this->dump_4(&v3);	return true;}
开发者ID:toalexjin,项目名称:algo,代码行数:37,


示例23: v1

void csCameraPerspective::UpdateClipPlanes(){  if (!clipPlanesDirty) return;    float lx, rx, ty, by;  lx = -shift_x * inv_aspect;  rx = (1.0f - shift_x) * inv_aspect;  ty = -shift_y;  by = (1.0f - shift_y);    csPlane3* frust = clipPlanes;  csVector3 v1 (lx, ty, 1);  csVector3 v2 (rx, ty, 1);  frust[0].Set (v1 % v2, 0);  frust[0].norm.Normalize ();  csVector3 v3 (rx, by, 1);  frust[1].Set (v2 % v3, 0);  frust[1].norm.Normalize ();  v2.Set (lx, by, 1);  frust[2].Set (v3 % v2, 0);  frust[2].norm.Normalize ();  frust[3].Set (v2 % v1, 0);  frust[3].norm.Normalize ();    csPlane3 pz0 (0, 0, 1, 0);	// Inverted!!!.  clipPlanes[4] = pz0;  clipPlanesMask = 0x1f;  if (fp)  {    clipPlanes[5] = *fp;    clipPlanesMask |= 0x20;  }    clipPlanesDirty = false;}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:37,


示例24: sms

bool TestCppBase::TestVariantArrayRef() {  String sms("hhvm.stats.max_slot");  String hfc("hhvm.hot_func_count");  String mla("hhvm.multi_level_array");  String k1("key1");  String k2("key2");  String k3("key3");  Variant v1(11);  Variant v2(77);  Variant v3(99);  Variant v4(true);  Variant ml_arr(Array::Create());  ml_arr.toArrRef().set(k1, Array::Create());  ml_arr.toArrRef().lvalAt(k1).toArrRef().set(k2, Array::Create());  ml_arr.toArrRef().lvalAt(k1).toArrRef().lvalAt(k2).toArrRef().set(k3, v4);  Variant arr(Array::Create());  arr.toArrRef().set(sms, v1);  arrayRefHelper(arr);  arr.toArrRef().set(sms, v2);  VERIFY(arr.toArray().rvalAt(hfc).toInt64() == 77);  // bidirectional references  arr.toArrRef().set(hfc, v3);  VERIFY(arr.toArray().rvalAt(sms).toInt64() == 99);  VERIFY(ml_arr.toArray().size() == 1);  VERIFY(ml_arr.toArray().rvalAt(k1).isArray() == true);  VERIFY(ml_arr.toArray().         rvalAt(k1).toArray().         rvalAt(k2).toArray().         rvalAt(k3).toBoolean() == true);  return Count(true);}
开发者ID:DerPapst,项目名称:hhvm,代码行数:36,


示例25: tc_constructor

		void tc_constructor()		{			std::cout << "-----/t constructor" << '/n';			vector<int> v1;		// constructor: default			v1 = { 1, 2, 3, 4, 5 };		// assign content: initializer list			printvector(v1);			vector<int> v2(5, 10);	// constructor: fill			printvector(v2);			vector<int> v3({ 4, 5, 6, 7, 8 });	// constructor: initializer list			printvector(v3);			vector<int> v4(v1);		// copy constructor			printvector(v4);			vector<int> v5 = v1;	// assign content: copy			printvector(v5);			// the iterator constructor can also be used to construct from arrays:			int myints[] = { 16, 2, 77, 29 };			MySTL::vector<int> v6(myints, myints + sizeof(myints) / sizeof(int));			printvector(v6);		}
开发者ID:MarinYoung4596,项目名称:MySTL,代码行数:24,


示例26: v1

mat4 Quaternion::getMatrix() const{	float x2 = x * x;	float y2 = y * y;	float z2 = z * z;	float xy = x * y;	float xz = x * z;	float yz = y * z;	float wx = w * x;	float wy = w * y;	float wz = w * z; 	//there seems to be contraditing version for this matrix at these two loc	//http://content.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation	//http://www.cprogramming.com/tutorial/3d/quaternions.html	//the book seems to be supporting first link (atleast based on the patern of things)	// i am using the first one. link also useful http://www.gamedev.net/page/resources/_/technical/math-and-physics/quaternion-powers-r1095	vec4 v1(1.0f - 2.0f * (y2 + z2), 2.0f * (xy - wz)       , 2.0f * (xz + wy)       , 0.0f);	vec4 v2(2.0f * (xy + wz)       , 1.0f - 2.0f * (x2 + z2), 2.0f * (yz - wx)       , 0.0f);	vec4 v3(2.0f * (xz - wy)       , 2.0f * (yz + wx)       , 1.0f - 2.0f * (x2 + y2), 0.0f);	vec4 v4(0.0f                   , 0.0f                   , 0.0f                   , 1.0f);		return mat4( v1, v2, v3, v4	); }
开发者ID:elixiroflife4u,项目名称:cs174a_term_project,代码行数:24,


示例27: main

int main(){  Point_2 p3(1,0,0), q3(1,1,0), r3(1,2,0);  Vector_2 v3(1, 0, 0), w3(0,1,0);  Epic::Point_2 p2(1,0), q2(1,1), r2(1,2);  Epic::Vector_2 v2(1, 0), w2(0,1);  K k;  assert( k.compute_scalar_product_2_object()(v3, w3) ==          v2 * w2 );  assert( k.collinear_2_object()(p3,q3,r3) ==          CGAL::collinear(p2,q2,r2) );  assert( k.collinear_are_ordered_along_line_2_object()(p3,q3,r3) ==          CGAL::collinear_are_ordered_along_line(p2,q2,r2) );  assert( k.compute_squared_length_2_object()(v3) ==          v2.squared_length() ); return 0;}
开发者ID:ArcEarth,项目名称:cgal,代码行数:24,


示例28: test_assignment_operator_2

void test_assignment_operator_2 (){  Weighted_point p0(Bare_point(0,0,0),1);  Weighted_point p1(Bare_point(2,0,0),1);  Weighted_point p2(Bare_point(0,2,0),1);  Weighted_point p3(Bare_point(0,0,2),1);  Tds::Vertex v0(p0), v1(p1), v2(p2), v3(p3);  Tds::Cell c0, c1, c2, c3;  Tds tds;  Vertex_handle vh0 = tds.create_vertex(v0);  Vertex_handle vh1 = tds.create_vertex(v1);  Vertex_handle vh2 = tds.create_vertex(v2);  Vertex_handle vh3 = tds.create_vertex(v3);  Cell_handle ch0 = tds.create_cell(c0);  Cell_handle ch1 = tds.create_cell(c1);  Cell_handle ch2 = tds.create_cell(c2);  Cell_handle ch3 = tds.create_cell(c3);  Cell_type cell(vh0, vh1, vh2, vh3, ch0, ch1, ch2, ch3);  const Bare_point& circumcenter = cell.weighted_circumcenter();  Cell_type ccell;  ccell = cell;  assert(ccell.vertex(0) == vh0 && ccell.vertex(0) != Vertex_handle());  assert(ccell.vertex(1) == vh1 && ccell.vertex(1) != Vertex_handle());  assert(ccell.vertex(2) == vh2 && ccell.vertex(2) != Vertex_handle());  assert(ccell.vertex(3) == vh3 && ccell.vertex(3) != Vertex_handle());  assert(ccell.neighbor(0) == ch0 && ccell.neighbor(0) != Cell_handle());  assert(ccell.neighbor(1) == ch1 && ccell.neighbor(1) != Cell_handle());  assert(ccell.neighbor(2) == ch2 && ccell.neighbor(2) != Cell_handle());  assert(ccell.neighbor(3) == ch3 && ccell.neighbor(3) != Cell_handle());  const Bare_point& ccircumcenter = ccell.weighted_circumcenter();  assert(ccircumcenter == Bare_point(1,1,1));  assert(&circumcenter != &ccircumcenter);}
开发者ID:lrineau,项目名称:cgal,代码行数:36,


示例29: testVector

  void testVector()  {    namespace cg = cartograph;    // Default is invalid    cg::vector_t v;    CPPUNIT_ASSERT_EQUAL(v, cg::invalid_vector);    // Test equality    cg::vector_t v1(0, 1);    cg::vector_t v2(0, 1);    CPPUNIT_ASSERT_EQUAL(v1, v2);    // Test distance function    CPPUNIT_ASSERT_EQUAL(v1.distance(), v2.distance());    cg::vector_t v3(1, 0);    CPPUNIT_ASSERT_EQUAL(v1.distance(), v3.distance());    cg::vector_t v4(1, 1);    CPPUNIT_ASSERT(v1.distance() < v4.distance());    // Test < operator - it's actually comparing distances.    CPPUNIT_ASSERT(v1 < v4);    // Test != operator    CPPUNIT_ASSERT(v1 != v4);    // Minus and plus operators.    cg::vector_t sum = v1 + v4;    CPPUNIT_ASSERT_EQUAL(cg::unit_t(1), sum.m_x);    CPPUNIT_ASSERT_EQUAL(cg::unit_t(2), sum.m_y);    cg::vector_t diff = v1 - v4;    CPPUNIT_ASSERT_EQUAL(cg::unit_t(-1), diff.m_x);    CPPUNIT_ASSERT_EQUAL(cg::unit_t(0), diff.m_y);  }
开发者ID:Wednesnight,项目名称:cartograph,代码行数:36,



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


C++ v3f函数代码示例
C++ v2s32函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。