# XPresso: HPB-to-Matrix Node?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 25/06/2009 at 03:25, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R11
Platform:   Windows  ;   Mac OSX  ;
Language(s) :      XPRESSO  ;

---------
Hi,

just a very short question:

Is there an XPresso node equivalent to the HPBToMatrix() function from the SDK? And if not, how could one create an XPresso setup that performs this calculation?

Thanks & Greetings,
Jack

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 25/06/2009 at 06:04, xxxxxxxx wrote:

Simply take a COFFEE Node and port the code from the SDK to coffee:

> ` \> \> // angles in Rad-/Euler system \> Matrix HPBToMatrix(const Vector &w;, LONG rot_order) \> { \>      Real a,b,c,d,e,f,cosksinn,sinksinn; \> \>      SinCos(w.x,d,c); //y = h \>      SinCos(w.y,b,a); //x = p \>      SinCos(w.z,f,e); //z = b \> \>      switch (rot_order) \>      { \>      case ROT_ZXYGLOBAL:     break; //Default \>      case ROT_YXZGLOBAL: break; \>           { \>                sinksinn = d \* b; \>                cosksinn = c \* b; \> \>                return Matrix(Vector(0.0), \>                                                   Vector(c \* e + sinksinn \* f, -c \* f + sinksinn \* e, d \* a), \>                                                   Vector(a \* f, a \* e, -b), \>                                                   Vector(-d \* e + cosksinn \* f, d \* f + cosksinn \* e, c \* a)); \>           } break; \>      case ROT_YZXGLOBAL: \>           { \>                sinksinn = c \* f; \>                cosksinn = d \* f; \> \>                return Matrix(Vector(0.0), \>                                                   Vector(c \* e, -sinksinn \* a + d \* b, sinksinn \* b + d \* a), \>                                                   Vector(f, e \* a, -e \* b), \>                                                   Vector(-d \* e, cosksinn \* a + c \* b, -cosksinn \* b + c \* a)); \>           } break; \>      case ROT_ZYXGLOBAL: \>           { \>                sinksinn = e \* d; \>                cosksinn = f \* d; \> \>                return Matrix(Vector(0.0), \>                                                   Vector(e \* c, -f \* a + sinksinn \* b, f \* b + sinksinn \* a), \>                                                   Vector(f \* c, e \* a + cosksinn \* b, -e \* b + cosksinn \* a), \>                                                   Vector(-d, c \* b, c \* a)); \>           } break; \>      case ROT_XZYGLOBAL: \>           { \>                sinksinn = a \* f; \>                cosksinn = b \* f; \> \>                return Matrix(Vector(0.0), \>                                                   Vector(e \* c, -f, e \* d), \>                                                   Vector(sinksinn \* c + b \* d, a \* e, sinksinn \* d - b \* c), \>                                                   Vector(cosksinn \* c - a \* d, b \* e, cosksinn \* d + a \* c)); \>           } break; \>      case ROT_XYZGLOBAL: \>           {      \>                sinksinn = b \* d; \>                cosksinn = a \* d; \> \>                return Matrix(Vector(0.0), \>                                                   Vector(c \* e, -c \* f, d), \>                                                   Vector(sinksinn \* e + a \* f, -sinksinn \* f + a \* e, -b \* c), \>                                                   Vector(-cosksinn \* e + b \* f, cosksinn \* f + b \* e, a \* c)); \>           } break; \>      default: break; \>      } \> \>      //ZXY \>      cosksinn = e \* b; \>      sinksinn = f \* b; \> \>      return Matrix(Vector(0.0), \>                                         Vector(e \* c - sinksinn \* d, -f \* a, e \* d + sinksinn \* c), \>                                         Vector(f \* c + cosksinn \* d, e \* a, f \* d - cosksinn \* c), \>                                         Vector(-a \* d, b, a \* c)); \> } \> `

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 25/06/2009 at 13:39, xxxxxxxx wrote:

Damn, I was hoping there would be an XPresso-only solution.

But can't I just use this?

> `main() \> { \> var InMatrix = new(Matrix); \> InMatrix->SetRotHPB(InHPB); \> OutMatrix = InMatrix->GetClone(); \> }`

Greetings,
Jack