Question #686076 on Yade changed:
https://answers.launchpad.net/yade/+question/686076

yang yi posted a new comment:
Thanks for Jan Stránský (honzik)   and Chareyre (bruno-chareyre-9) very much.
I tired the RotationEngine before using O.bodies[i].state.angVel .  However, 
the speed I cound not change during simulation.  The Code is as below:


O.engines = [
           。。。。。。
    RotationEngine(rotationAxis=(0, 0, 1), angularVelocity= velocity, 
rotateAroundZero=True, zeroPoint=(0, 0, 0)),
    PyRunner(comment= "ChangeVelocity()"....)
]

But the velocity can not changed.  So I tried the third way.  Yestoday
night, I fund the function of RotationEngine in the
KinematicEngines.cpp,   I understand the Chareyre's advise that the
velocity should be improved during the angleVelocity.  I wirte the code
now, But I meet a  new problem,  I can not find the function of
AngleAxisr().  The code of RotationEngine is


void RotationEngine::apply(const vector<Body::id_t>& ids){
        if (ids.size()>0) {
                #ifdef YADE_OPENMP
                const long size=ids.size();
                #pragma omp parallel for schedule(static)
                for(long i=0; i<size; i++){
                        const Body::id_t& id=ids[i];
                #else
                FOREACH(Body::id_t id,ids){
                #endif
                        assert(id<(Body::id_t)scene->bodies->size());
                        Body* b=Body::byId(id,scene).get();
                        if(!b) continue;
                        b->state->angVel+=rotationAxis*angularVelocity;
                        if(rotateAroundZero){
                                const Vector3r l=b->state->pos-zeroPoint;
                                Quaternionr 
q(AngleAxisr(angularVelocity*scene->dt,rotationAxis));
                                Vector3r newPos=q*l+zeroPoint;
                                
b->state->vel+=Vector3r(newPos-b->state->pos)/scene->dt;
                        }
                }
        } else {
                LOG_WARN("The list of ids is empty! Can't move any body.");
        }
}


So  I need to write the function AngleAxisr(). 
Thank you very much!!!!

Yang Yi

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to