ravshan Gaziev

rash

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

UT_QuaternionT lerp incorrectly March 6, 2018, 4:30 a.m.

Hey derrick, thanks man! how I find short path? with dot? I use interpolate like weighted sum, when I have Q1…Qn, where weight w(1..n)==1, what I need to do to find short path between several quaternions and do interpolate correctly?

below source code, GETWEIGHT() func where I got weight from parameter each object, DrvObjName names of objects and DrnObjName name of object who rotates between them.

UT_QuaternionD qori;
UT_Matrix3D _mt;

for (int objindex = 1; objindex <= numobj; objindex++)
{

  // var sum weight
  float sum = 0;

  for (int i = 1; i <= numobj; i++){
    sum += GETWEIGHT(i);
  }

  UT_String DrvObjName;
  OPPATH(DrvObjName, objindex, t);

  UT_Matrix4D matN;
  OP_Node *drvObj = findNode(DrvObjName);
  drvObj->getWorldTransform( matN, context);

  // compute offset list
  if(GETWEIGHT()){

    UT_Matrix4D matTempDrv, matTempDrn;
    OP_Node *drnObj = findNode(DrnObjName);
    drnObj->getWorldTransform( matTempDrn, context);
    drvObj->getWorldTransform( matTempDrv, context);
    matTempDrv.invertDouble();
    offsetMat[objindex-1] = matTempDrn * matTempDrv;

  }

  matN = offsetMat[objindex-1] * matN * matInv;
              
  UT_Matrix3D mt;
  UT_Vector3D  _pos;
              
  // Rotate compute
  matN.extractRotate(mt);
  UT_QuaternionD orient;
  orient.updateFromArbitraryMatrix(mt);
  orient.normalize();
  qori += orient*(GETWEIGHT(objindex)/sum);
  matN.getTranslates(_pos);
              
  // Translate compute
  x += _pos.x()*(GETWEIGHT(objindex)/sum);
  y += _pos.y()*(GETWEIGHT(objindex)/sum);
  z += _pos.z()*(GETWEIGHT(objindex)/sum);

}

qori.normalize();
UT_Vector3D _qrot;
qori.getRotationMatrix(_mt);
_mt.crack(_qrot, UT_XformOrder::rstOrder(5));


please help me to understand, what I have to do?

UT_QuaternionT lerp incorrectly March 5, 2018, 5:04 a.m.

Hey guys, could you help me please, why UT_QuaternionT lerp work incorrectly? What I mean, if you look picture, I do linear interpolate quaternion between two object, first object red rectangle second blue rectangle, so green object rotated between them…. so… problem is when I make angle 210, the green object rotated by long angle… If I use UT_QuaternionT.interpolate() it work correctly… but I need lerp, how I can do linear interpolate correctly?

Thanks!

HDK create parameter Feb. 20, 2018, 10:57 a.m.

Hey there!

Help me please! What type of operator path parameter(attached img)? How create it correctly and how can get string( get OP_Node ) in c++ when I create this parameter? I searched in docks, but I did't find!

thanks!