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


C++ Vect类代码示例

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


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

示例1: z

// Mnozenie wektora przez skalar
Vect operator*(const Vect &p, double d)
{
    Vect z(p.getDimension());
    for(int i=0; i<p.getDimension(); i++)
        z.setCoordinate(i,d*p.getCoordinate(i));
    return z;
};
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp

示例2: logMsg

bool Env::sendMsg(long idSrc, long idDest, char *msg) {
    logMsg("SEND MSG : " + std::to_string(idSrc) + " -> " + std::to_string(idDest));
    // if (this->phy->getNeighbours(idSrc).count(idDest)) {
        this->agents.at(idDest)->addMsg(msg);

        // Display the sending message with dataAgents
        Agent * agentSrc = this->agents.at(idSrc);
        Agent * agentDest = this->agents.at(idDest);
        Vect posSrc = PosToCell(agentSrc->getPos().x, agentSrc->getPos().y);
        Vect posDest = PosToCell(agentDest->getPos().x, agentDest->getPos().y);
        if (posSrc != posDest) {
            float dist = ((724-Vect(posSrc - posDest).Length()) / 724.0) / 6.0;
            for (float n = 0; n < 1; n += dist) {
                Vect base = posDest + n * (posSrc - posDest);
                Vect dirSommet = Vect(posSrc - posDest);
                dirSommet.Normalize();
                Vect vectBase = Vect(dirSommet.y, -dirSommet.x);
                for (int j = 0; j < 20; j++) {
                    for (int i = -j*0.5; i <= j*0.5; i++) {
                        Vect point = base + j / 2.0 * dirSommet + i / 2.0 * vectBase;
                        if (point.x >= 0 && point.x < 512 && point.y >= 0 && point.y < 512) {
                            agentSrc->getVision(point.x, point.y)->dataAgent = 10 * (1 - n);
                        }
                    }
                }
            }
        }
        return true;
    //}
    //return false;
}
开发者ID:schlog,项目名称:camass_v2,代码行数:31,代码来源:Env.cpp

示例3: GetPoint

Bounds Bounds::GetTransformedBounds(const Matrix &m) const
{
    Bounds newBounds;
    BOOL bInitialized=0;
    for(int i=0; i<8; i++)
    {
        Vect p = GetPoint(i);
        p.TransformPoint(m);

        if(!bInitialized)
        {
            newBounds.Max = newBounds.Min = p;
            bInitialized = 1;
        }
        else
        {
            if(p.x < newBounds.Min.x)
                newBounds.Min.x = p.x;
            else if(p.x > newBounds.Max.x)
                newBounds.Max.x = p.x;

            if(p.y < newBounds.Min.y)
                newBounds.Min.y = p.y;
            else if(p.y > newBounds.Max.y)
                newBounds.Max.y = p.y;

            if(p.z < newBounds.Min.z)
                newBounds.Min.z = p.z;
            else if(p.z > newBounds.Max.z)
                newBounds.Max.z = p.z;
        }
    }

    return newBounds;
}
开发者ID:373137461,项目名称:OBS,代码行数:35,代码来源:XMath.cpp

示例4:

JNIEXPORT void JNICALL Java_neuron_Neuron_vectorToHoc
  (JNIEnv *env, jclass, jlong jc, jdoubleArray ja, jint size) {
	Object* ho = (Object*)jc;
	Vect* vec = (Vect*)ho->u.this_pointer;
	vector_resize(vec, size);
	env->GetDoubleArrayRegion(ja, 0, size, &vec->elem(0));
}
开发者ID:stephanmg,项目名称:neuron,代码行数:7,代码来源:nrnjni.cpp

示例5: growVector

 void
 growVector()
   {
     CHECK (0 == Dummy::checksum());
     {
       typedef typename Table<HO>::Type Vect;
       
       Vect table;
       table.reserve(2);
       CHECK (0 == Dummy::checksum());
       
       cout << ".\n..install one element at index[0]\n";
       table.push_back(HO());
       CHECK (0 == Dummy::checksum());
       
       create_contained_object (table[0]); // switches into "managed" state
       CHECK (0 < Dummy::checksum());
       int theSum = Dummy::checksum();
       
       cout << ".\n..*** resize table to 16 elements\n";
       for (uint i=0; i<15; ++i)
         table.push_back(HO());
       
       CHECK (theSum == Dummy::checksum());
     }
     CHECK (0 == Dummy::checksum());
   }
开发者ID:,项目名称:,代码行数:27,代码来源:

示例6: SegTriInt

char AdapterComputationalGeometry::SegTriInt(Vect* T,Vect q,Vect r){
    SegmentTriangleIntersection segmenttriangleintersection;
    tPointi Tpoints;
    tPointd qpoints;
    tPointd rpoints;
    tPointd ppoints;

	segmenttriangleintersection.Vertices[0][0]=T[0].getPunto().getX();
	segmenttriangleintersection.Vertices[0][1]=T[0].getPunto().getY();
	segmenttriangleintersection.Vertices[0][2]=T[0].getPunto().getZ();
	segmenttriangleintersection.Vertices[1][0]=T[1].getPunto().getX();
	segmenttriangleintersection.Vertices[1][1]=T[1].getPunto().getY();
	segmenttriangleintersection.Vertices[1][2]=T[1].getPunto().getZ();
	segmenttriangleintersection.Vertices[2][0]=T[2].getPunto().getX();
	segmenttriangleintersection.Vertices[2][1]=T[2].getPunto().getY();
	segmenttriangleintersection.Vertices[2][2]=T[2].getPunto().getZ();

	Tpoints[0]=0;
	Tpoints[1]=1;
	Tpoints[2]=2;

	qpoints[0]=q.getPunto().getX();
	qpoints[1]=q.getPunto().getY();
	qpoints[2]=q.getPunto().getZ();

	rpoints[0]=r.getPunto().getX();
	rpoints[1]=r.getPunto().getY();
	rpoints[2]=r.getPunto().getZ();

	return segmenttriangleintersection.SegTriInt(Tpoints,qpoints,rpoints,ppoints);
	}
开发者ID:gurroz,项目名称:Memori,代码行数:31,代码来源:adaptercomputationalgeometry.cpp

示例7: assert

bool VerificacionNodosVecinosColapsoRegion::corrigeInconsistencia (Malla *malla, int indNodo){
	assert(malla->getNodo(indNodo)!=NULL);

	Nodo* nodo=malla->getNodo(indNodo);
	Vect viejaNormal=nodo->getNormal();
	Vect nuevaNormal;
	vector<int> indArcosVecinos=nodo->getArcos();
	for (int indArco=0; indArco< (int)indArcosVecinos.size(); indArco++){
		Arco* arcoVecino=malla->getArco(indArcosVecinos[indArco]);
		int indPuntoA=arcoVecino->getNodoDistinto(indNodo);
		Nodo* NodoA=malla->getNodo(indPuntoA);
		Vect vectorVecino=NodoA->getNormal()*(val*NodoA->getConcentracion());
		nuevaNormal=nuevaNormal+vectorVecino;
		}
	//Normalizamos.
	nuevaNormal = nuevaNormal*(1/nuevaNormal.largo());
	nodo->setNormal(nuevaNormal);
	//Si la inconsistencia no se corrige, borramos el nodo central.
	if (checkInterseccionNodo(malla,indNodo)==true){
		nodo->setNormal(viejaNormal);
		colapsarRegion(malla,indNodo);
		return false;
	}
	else
		ntrayectoriasreparadas++;
	return true;
	}
开发者ID:gurroz,项目名称:Memori,代码行数:27,代码来源:verificacionnodosvecinoscolapsoregion.cpp

示例8: GetIntersection

BOOL Plane::GetIntersection(const Vect &p1, const Vect &p2, float &fT) const
{
    float P1Dist = p1.DistFromPlane(*this);
    float P2Dist = p2.DistFromPlane(*this);

    if(CloseFloat(P1Dist, 0.0f, EPSILON))
    {
        if(P2Dist == 0.0f)
            return 0;

        fT = 0.0f;
        return 1;
    }
    else if(CloseFloat(P2Dist, 0.0f, EPSILON))
    {
        fT = 1.0f;
        return 1;
    }

    BOOL bP1Over = (P1Dist > 0.0f);
    BOOL bP2Over = (P2Dist > 0.0f);

    if(bP1Over == bP2Over)
        return FALSE;

    float P1AbsDist = fabs(P1Dist);
    float dist2 = (P1AbsDist+fabs(P2Dist));
    if(dist2 < EPSILON)
        return FALSE;
    fT = P1AbsDist/dist2;

    return TRUE;
}
开发者ID:373137461,项目名称:OBS,代码行数:33,代码来源:XMath.cpp

示例9: can_project_and_scale_points

void can_project_and_scale_points() {
    FrameBuffer fb(500, 500);
    Vect v = Vect(0, 0, 100);
    fb.projectAndScalePoint(v);
    ASSERT_EQUAL_FLOAT(v.getX(), 250, 0.1);
    ASSERT_EQUAL_FLOAT(v.getY(), 250, 0.1);
}
开发者ID:sondrele,项目名称:NTNU,代码行数:7,代码来源:test_framebuffer.cpp

示例10: Vect

const Vect Vect::getNorm()const
{
	Vect norming = Vect(this->m);
	norming.norm();

	return norming;
};
开发者ID:Norseman055,项目名称:immaterial-engine,代码行数:7,代码来源:Vect.cpp

示例11: start

void AnimController::setBonePose( PyramidObject *node )
{
	PyramidObject *childNode = (PyramidObject *)node;
	PyramidObject *parentNode = (PyramidObject *)node->getParent();

	if( parentNode == GraphicsObjMan::getMainTree()->getRoot() )
		return;

	if (parentNode != 0 && childNode != 0)	{
		// Now get the world matrices
		Vect start(0.0f,0.0f,0.0f);

		parentNode->transform();
		Vect ptA = start * parentNode->getWorld();

		childNode->transform();
		Vect ptB = start * childNode->getWorld();

		// direction between the anchor points of the respective bones
		Vect dir = -(ptB - ptA);

		// length of the bone 0
		float mag = dir.mag();

		// Set the orientation and length for bone 0
		Matrix S( SCALE, BONE_WIDTH, BONE_WIDTH, mag);
		Quat Q( ROT_ORIENT, dir.getNorm(), Vect( 0.0f, 1.0f, 0.0f) );
		Matrix T( TRANS, ptB );

		Matrix BoneOrient = S * Q * T;

		childNode->setBoneOrientation( BoneOrient );
	}
}
开发者ID:Norseman055,项目名称:immaterial-engine,代码行数:34,代码来源:AnimController.cpp

示例12: setCoordinate

// Konstruktor kopiujacy
Vect::Vect(const Vect &w)
{
    dim = w.getDimension();
    v = new double[w.getDimension()];
    for (int i = 0; i < w.getDimension(); i++)
        setCoordinate(i, w.getCoordinate(i));
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp

示例13: TEST

TEST(RayTracer, ray_inits) {
    Ray r(Vect(0, 0, -1), Vect(-1, 0, 0));
    Vect o = r.getOrigin();
    Vect d = r.getDirection();
    CHECK_EQUAL(-1, o.getZ());
    CHECK_EQUAL(-1, d.getX());
}
开发者ID:sondrele,项目名称:NTNU,代码行数:7,代码来源:raytracer_test.cpp

示例14: r

Vect operator*(const Vect &w, double d)
{
    Vect r(w.getDimension());
    r = w;
    for (int i = 0; i < w.getDimension(); i++)
        r.setCoordinate(i, d * w.getCoordinate(i));
    return r;
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp

示例15: assert

double operator*(const Vect &w1, const Vect &w2)
{
    assert (w1.getDimension() == w2.getDimension());
    double d = 0;
    for (int i = 0; i < w1.getDimension(); i++)
        d = d + w1.getCoordinate(i) * w2.getCoordinate(i);
    return d;
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp


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