-
ebkc
well I try to do
the same very simple math in actionscript and puredata and get different results...
PD
1.5707963267948966 -> cos -> print
output: -4.37114e-008
in flash
trace(Math.cos(1.5707963267948966));
output : 6.123031769111886e-17
I think it's because the number is cut when too long or something,
is there a way to fix this ?
thanks
-
ebkc
hey !
I've put my hands on a kinect, and thanks to Matthias Kronlachner I've pluged it to PureData with pix_openni.
So I receive points with XYZ translations,
and I want to transform that in rotations for a rig.
I'm no expert with such things. but I tryed something out with trigonometry :
a being the hand and b being the shoulder
BC = (a.x-b.x);
AB = (a.y-b.y);
AC = sqrt((AB*AB)+(BC*BC));
BD = AC - AB;
YY = atan(AB/BC)+atan(BD/BC)
X = (YY*180/PI)*2;this gives me in degree from 0 to 360 the angle of my arm, I then just give him XY, XZ and ZY translation and get RX RY RZ in return.
But when I apply it as a rotation to a cube, movements don't match ...
So I guess that's not the right technique. I'm reading something about matrices, but I don't understand it quite well ...
so maybe somebody can tell me if I'm on the right way, and maybne explain me a bit
thanks for reading,
cheers -
ebkc
hey there !
I have a simple question : how can I do like in php a variable variable
my problem is
I have an abstraction(called MASTER) that outlet a number (the stereo mix volume), lets call it RESULT
I want this number to be sent to different OSC adress like such
layer1/position/value RESULT
layer2/position/value RESULT
layer3/position/value RESULT
layer4/position/value RESULTRight now I have my 4 message box each containing the message and a $1
but I want to be able to control how many layers so I used [until]
simplified it looks like
[MASTER]
[trigger bang float]the float goes to the right inlet of a [pack f f]
then the bang go to the [until] and put the result (0, 1, 2, 3, ...) in the left inlet of the packthe pack outlet to a message "layer$1/position/value $2"
and that works perfectlyProblem is, I wand to be able to multiply the value of each layer to a different number(contained in a list for example)
if Master output let say "2";
right now 2 is sent to all the layers
but I want that :
layer1 value is 2*($1 of another list)
layer2 value is 2*($2 of another list)
layer3 value is 2*($3 of another list)
...but I'd have to write $1 wich doesn't work...
I think it's not really clear what I'm saying ... but thanks for reading !
-
ebkc
well I found a euler/quaternion/euler calculator online and after compare his results with mine, it appears that the part I have wrong is the RZ in case of gimbal lock
maybe someone can telle me wich part is wrong
RX = ((sin_X*sin_Y)*sin_Z)+(cos_X*cos_Z);
RY = -(sin_X*sin_Y)*cos_Z+cos_X*sin_Z;Z = Math.atan2(RY,RX);
Z *= RADIANS;cheers
-
ebkc
I made a patch to fix gimbal lock on PD but I still have wrong moves,
can someone telle me if the patch is wrong ?
or if after gimbal fix following rotations
X 160 Y 90 Z 267
with Y to be the base
you get
X 0 Y 90 Z 106
thanks
-
ebkc
thanks baby cot ! very helpfull
though maelstorm I now realise thant when turned back in degree it fits
thanks cheers
-
ebkc
Hey !
thabnks for your answer, but is there a way to easy make bigger precision ?
I'm trying to make a patch against gimbal lock for 3D rotation from kinect translations.
so I have my XYZ angles, I convert them to a matrice, check condition for gimbal lock and convert back to degree,
but while all of this there is a lot of cos sin & tan added and multiplied wich create very different results from for example flash and the part I'm intrested in for gimbal lock fix are very tiny precise numbers ...
so ? any lutions ?
-
ebkc
http://lists.puredata.info/pipermail/pd-list/2012-04/095889.html
does that mean I'm screwd ?
-
ebkc
actually I just found that
http://en.wikipedia.org/wiki/Gimbal_lock
wich is I think my problem, I'm trying now to understand how to write a solution in PD