예제 #1
0
파일: nodos.cpp 프로젝트: gurroz/Memori
void Nodos::moverNodo(int indice, double x, double y, double z, double dist) {
    if(indice == -1) {
        return;
    }
    if(indice >= (int)nodos.size() || indice < 0) {
        cout << "Error: Moviendo Nodo(" << indice << "). Numero de nodos = " << nodos.size() << endl;
        assert((indice < (int)nodos.size()) && (indice >= 0));
    }
    Nodo *n = nodos[indice];
    //movemos el nodo una distancia dist.
    double x1,y1,z1;
    if(n != 0) {
        x1=n->getPunto().getX()+x*dist;
        y1=n->getPunto().getY()+y*dist;
        z1=n->getPunto().getZ()+z*dist;
        n->setPunto(Punto(x1,y1,z1));
    }
};
예제 #2
0
void MovimientosAUV::moverNodosSegunParametro(int indice, double valor, Malla *malla){

    int nNodos = malla->getMaxIndiceNodos();
    double xs[nNodos +1];
    double ys[nNodos +1];
    double zs[nNodos +1];

    for(int i = 0; i <= nNodos; ++i){
        xs[i] = 0.0;
        ys[i] = 0.0;
        zs[i] = 0.0;
    }

    for(int i = 0; i < malla->getNodos()->n_marcados; ++i){
        Punto *p = this->getMovimiento(i, indice);
        int ind = malla->getNodos()->nodos_marcados[i];
        xs[ind] = p->getX();
        ys[ind] = p->getY();
        zs[ind] = p->getZ();
    }

    for(int i = 0; i <= nNodos; ++i){
        Nodo *n = malla->getNodo(i);
        int i1 = n->getAsociado1();
        int i2 = n->getAsociado2();
        int i3 = n->getAsociado3();

        if(i1<0 || i2<0 || i3<0)
            continue;

        float coef1 = n->getCoef1();
        float coef2 = n->getCoef2();
        float coef3 = n->getCoef3();

        float newX = n->getPunto().getX() + coef1*xs[i1]*valor + coef2*xs[i2]*valor + coef3*xs[i3]*valor;
        float newY = n->getPunto().getY() + coef1*ys[i1]*valor + coef2*ys[i2]*valor + coef3*ys[i3]*valor;
        float newZ = n->getPunto().getZ() + coef1*zs[i1]*valor + coef2*zs[i2]*valor + coef3*zs[i3]*valor;

        n->setPunto(Punto(newX, newY, newZ));
    }

}
예제 #3
0
파일: nodos.cpp 프로젝트: gurroz/Memori
void Nodos::regresarNodoSegunConcentracion(int indice, double val) {
    if(indice == -1) {
        return;
    }
    if(indice >= (int)nodos.size() || indice < 0) {
        cout << "Error: Regresando Nodo(" << indice << "). Numero de nodos = " << nodos.size() << endl;
        assert((indice < (int)nodos.size()) && (indice >= 0));
    }
    Nodo *n = nodos[indice];
    //regresamos el nodo una distancia dist.
    double x,y,z;
    if(n != 0) {
        Vect normal = n->getNormal();
        if(normal.largo() > 0) {
            x=n->getPunto().getX()-normal.getPunto().getX()*val*n->getConcentracion();
            y=n->getPunto().getY()-normal.getPunto().getY()*val*n->getConcentracion();
            z=n->getPunto().getZ()-normal.getPunto().getZ()*val*n->getConcentracion();
            n->setPunto(Punto(x,y,z));
        }
    }
}
예제 #4
0
파일: nodos.cpp 프로젝트: gurroz/Memori
void Nodos::moverNodo(int indice, double dist) {
    if(indice == -1) {
        return;
    }
    if(indice >= (int)nodos.size() || indice < 0) {
        cout << "Error: Moviendo Nodo(" << indice << "). Numero de nodos = " << nodos.size() << endl;
        assert((indice < (int)nodos.size()) && (indice >= 0));
    }
    Nodo *n = nodos[indice];
    //movemos el nodo una distancia dist.
    double x,y,z;
    if(n != 0) {
        Vect normal = n->getNormal();
        if(normal.largo() > 0) {
            x=n->getPunto().getX()+normal.getPunto().getX()*dist;
            y=n->getPunto().getY()+normal.getPunto().getY()*dist;
            z=n->getPunto().getZ()+normal.getPunto().getZ()*dist;
            n->setPunto(Punto(x,y,z));
        }
    }
}