var m = new(Matrix); in Python?
-
On 25/03/2013 at 15:39, xxxxxxxx wrote:
I'm currently looking over some coffee scripts and looking at taking some of the tips in them into python. Could someone please shine some light on or help me re-write this coffee script snippet into python?
I'm getting stuck on m = new(Matrix)?var mobj = Object->GetMg(); var tobj = Target->GetMg(); var oldrot, newrot; var p1 = mobj->GetV0(); var p2 = tobj->GetV0(); var m = new(Matrix); m->SetV0(p1); m->SetV3(vnorm(p2 - p1)); m->SetV2(vnorm(vcross(p2-p1, vector(0,1,0)))); m->SetV1(vnorm(vcross(p2-p1, vector(0,0,1)))); newrot=m->GetHPB(); var orot=mobj->GetHPB(); newrot.z=orot.z; oldrot=mobj->GetHPB();
-
On 25/03/2013 at 16:10, xxxxxxxx wrote:
mobj = Object.GetMg() tobj = Target.GetMg() oldrot = newrot = c4d.Vector() #Not important p1 = mobj.off p2 = tobj.off m = c4d.Matrix() m.off = p1 m.V3 = (p2 - p1).GetNormalized()) m.V2 = (p2-p1).Cross(c4d.Vector(0,1,0)).GetNormalized()) m.V1 = (p2-p1).Cross(c4d.Vector(0,0,1)).GetNormalized()) newrot = c4d.utils.MatrixToHPB(m) orot = c4d.utils.MatrixToHPB(mobj) newrot.z = orot.z oldrot = c4d.utils.MatrixToHPB(mobj)
Should look like this.
Greeting
rown -
On 25/03/2013 at 16:16, xxxxxxxx wrote:
Ah thanks, thats a big help, thanks Rown.