Hi,
I have a question which I know myself is very vague, but may also be straight forward as well to anyone who has had the same problem.
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion", "gimbal lock".
At least my understanding so far is that, no combination of chaining [rotate] objects give me results I expect.
How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for? Or else, is the only option to make a patch which crunches yucky and complex matrix multiplication, then feed the results to [rotate] ?
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion" How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for?
If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion" How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for?
If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
On Wed, 16 Jul 2008, PSPunch wrote:
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix.
Well, that's sort of it, if you use the name 'matrix' as taken from Jitter, or as taken from a plain linear algebra system that has been expanded to higher-order structures. I mean that in math, 'matrix' is limited to mean a grid of weights that make inputs correspond to outputs. the indices of that grid are 2-dimensional, with the rows representing inputs and the columns representing outputs or the other way around depending on which way you prefer it (or which way your software prefers it). The concept of 'matrix' as you would find in Jitter is something more generic, meaning that it's more about just storage than any particular operators... math is much more operator-oriented: matrices are matrices because of how you add and multiply them.
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
No, you didn't get my point. I was talking about quaternions in particular, and not even in comparison to how else you could possibly do any quaternions in Pd.
Well, GridFlow is fine for number crunching, but it depends what. I don't recall anything in Pd that directly supports quaternions. Depending on what plugins you can use, you may or may not have a way to cook your own quaternions. I suspect that it's doable in GridFlow and less doable with other plugins, as it is usually the case, but I don't know.
This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
yeah.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Mathieu,
Well, that's sort of it, if you use the name 'matrix' as taken from Jitter, or as taken from a plain linear algebra system that has been expanded to higher-order structures.
I was referring to matrix as in linear algebra like you mentioned. I no nothing about features that Jitter has.
/* O/T This was one of the topics in math which I missed out in high school. (Hey, wasn't goofing off.. schedules were conflicting with biology classes :) Now that I've got a grasp of what they are good for in real (or virtual) life, I enjoyed spending the last week or so studying math putting patching aside. :( */
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
No, you didn't get my point. I was talking about quaternions in particular, and not even in comparison to how else you could possibly do any quaternions in Pd. Well, GridFlow is fine for number crunching, but it depends what. I don't recall anything in Pd that directly supports quaternions. Depending on what plugins you can use, you may or may not have a way to cook your own quaternions. I suspect that it's doable in GridFlow and less doable with other plugins, as it is usually the case, but I don't know.
Got it.
This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
yeah.
Great, I wasn't quite sure on that.
Thanks again Mathieu, I think you've gifted me enough bases to start building thoughts on this.
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Well, that's sort of it, if you use the name 'matrix' as taken from Jitter, or as taken from a plain linear algebra system that has been expanded to higher-order structures.
I was referring to matrix as in linear algebra like you mentioned. I no nothing about features that Jitter has.
Ok, I don't really know any Jitter, but you sounded like you could've had experience or contact with it, and that's the only reason I mentioned it.
Now that I've got a grasp of what they are good for in real (or virtual) life, I enjoyed spending the last week or so studying math putting patching aside. :(
So why don't you smile?
Thanks again Mathieu,
You're welcome.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
O/T
Now that I've got a grasp of what they are good for in real (or virtual) life, I enjoyed spending the last week or so studying math putting patching aside. :(
So why don't you smile?
I was practicing my sarcasm which I've just proved that it can use some improvement.
Of course studying math is fun, but patching is even more fun! (^v^)/
Or I should say I personally find patching to be relatively sporty compared to other things I enjoy doing.. until bumping into logic problems like this. That is also fun, but not sporty.
-- David Shimamoto
On Thu, 17 Jul 2008, PSPunch wrote:
Now that I've got a grasp of what they are good for in real (or virtual) life, I enjoyed spending the last week or so studying math putting patching aside. :(
So why don't you smile?
I was practicing my sarcasm which I've just proved that it can use some improvement.
So, is it that you didn't enjoy it because you were too much hoping that this stuff wouldn't have to be learned, or you secretly enjoyed it but try to hide it because it would look geeky?
Of course studying math is fun, but patching is even more fun! (^v^)/
imho, depends on which math and which patch.
Or I should say I personally find patching to be relatively sporty compared to other things I enjoy doing.. until bumping into logic problems like this. That is also fun, but not sporty.
Not sporty? I can very well imagine Miller sweating hard while looking for a Shannonesque proof of the Central Limit Theorem.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion" How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for?
If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Indeed,
Seems to me all the matrix discussion does not get to the heart of the question.
So, Pspunch, what are you really trying to do?
I agree with cyrille that It's very likely the normal rotation objects will do what you want it to.
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
..b
cyrille henry wrote:
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion" How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for?
If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Wed, 16 Jul 2008, B. Bogart wrote:
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
Depends how huge they are. Pick 1000000032. That should give 312 degrees, supposing you use [wrap 0 360] instead of [wrap 0 359]. But as a pd float, it gives either 280 or 344 depending on how the rounding happens.
But this [wrap] trick is definitely not something that one can consider using if one is concerned with gimbal lock, and pspunch said he wants to avoid gimbal lock, so I don't know why you even mention it, if you want so much to stick to the "heart of the question".
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
I suppose we'll here from David...
I do certainly not quite understand what he is aiming to do.
As for the heart of the question:
"...I have come across concepts such as multiplying matrixs and converting a matrix to 'quarternion', 'gimbal lock'."
Does not sound like he is explicitly trying to avoid "gimbal lock" to me. ;)
.b.
Mathieu Bouchard wrote:
On Wed, 16 Jul 2008, B. Bogart wrote:
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
Depends how huge they are. Pick 1000000032. That should give 312 degrees, supposing you use [wrap 0 360] instead of [wrap 0 359]. But as a pd float, it gives either 280 or 344 depending on how the rounding happens.
But this [wrap] trick is definitely not something that one can consider using if one is concerned with gimbal lock, and pspunch said he wants to avoid gimbal lock, so I don't know why you even mention it, if you want so much to stick to the "heart of the question".
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
On Wed, 16 Jul 2008, B. Bogart wrote:
"...I have come across concepts such as multiplying matrixs and converting a matrix to 'quarternion', 'gimbal lock'." Does not sound like he is explicitly trying to avoid "gimbal lock" to me. ;)
if he is using [accumrotate] he is trying to avoid gimbal lock.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Hi,
My primary goal is to place an object you can rotate by dragging the mouse.
Basically, whenever the mouse is clicked to start drag, I want to rotate the object on the X & Y axises. Up to this point is no problem, but I want the rotation to begin assuming the direction of the viewer being the bases of the axis.
Using one [rotate] object, I can get the object to rotate in the behavior I expect only on the first drag.
Ideally, each time the mouse button is released, the base (fundus? basal?) of the rotation vector should be updated... I think.
By chaining [rotate] objects, I can use one to rotate the rotation axis and another to rotate the object from that point. However, I have not found a method of summing multiple drag actions.
Although I may be wrong, I think what I need to do is,
Prepare two rotation axises I. Angle of the axis II.Angle of the current drag session
When the mouse button is clicked, rotate object to angles I + II
When the mouse button is released, sum I + II and wait for a new click.
And again, although I may be wrong, my current understanding is that step 3 will require multiplying the X-Y-Z angles converted to quaternion, or some other method which will rotate the Z axis at some point by summing rotations based only on the X&Y axises.
Using procedures completely different from the one mentioned abouve, I was able to achieve the expected behavior based on [accumrotate] but I found no simple way of managing the current angle.
Unfortunately I have torn down the patch. If it would clarify anything, I will try to put together another one later today.
David Shimamoto
Indeed,
Seems to me all the matrix discussion does not get to the heart of the question.
So, Pspunch, what are you really trying to do?
I agree with cyrille that It's very likely the normal rotation objects will do what you want it to.
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
..b
cyrille henry wrote:
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion" How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for?
If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Thu, 17 Jul 2008, PSPunch wrote:
My primary goal is to place an object you can rotate by dragging the mouse.
Ok, if it's through a user interface like that, for computing just one rotation matrix, I guess you could use [accumrotate] unless it accumulates too much error. Suppose that it consistently gets a relative error of 2**-24 downwards on every rotation. Then after 1000000 rotations it gets its values 6% wrong. If rotating using doubles (float64) instead of float32, then you'd hardly notice anything after 1000000000000 rotations. Note that this is just a rule of thumb of worst cases. It's better to try it. [accumrotate] doesn't try to compensate for rounding errors because they aren't quite significant in practice in this case. (it's possible to do the theory for figuring out average realistic error but it's easier and more accurate to just try the implementation.)
Using procedures completely different from the one mentioned abouve, I was able to achieve the expected behavior based on [accumrotate] but I found no simple way of managing the current angle.
What do you mean "managing the current angle" ??
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
ok. i think i undersand.
there is an other possibility based on the gemlist_info object that get curent transformation matrix and convert it to rotation / translation ...
so, what i think is the most simple is :
gemhead
|
rotateXYZ (for the drag rotation, should be (0 0 0) when you don't drag)
|
rotateXYZ (for a feedback loop thanks to the rotation given by by the last object on the chain)
|
object primitive
|
gemlist (the gemlist should be banged only at the end of the drag) | gemlist_info (get curent rotation at the end of the drag, and send it to the 2nd rotate)
you can save few cpu using gemlist_matrix and GEMglMultMatrix.
this is a bit like the algorythm you describ, execpt that everything is computed on the GPU (it is more the Gem way to do).
cyrille
PSPunch a écrit :
Hi,
My primary goal is to place an object you can rotate by dragging the mouse.
Basically, whenever the mouse is clicked to start drag, I want to rotate the object on the X & Y axises. Up to this point is no problem, but I want the rotation to begin assuming the direction of the viewer being the bases of the axis.
Using one [rotate] object, I can get the object to rotate in the behavior I expect only on the first drag.
Ideally, each time the mouse button is released, the base (fundus? basal?) of the rotation vector should be updated... I think.
By chaining [rotate] objects, I can use one to rotate the rotation axis and another to rotate the object from that point. However, I have not found a method of summing multiple drag actions.
Although I may be wrong, I think what I need to do is,
Prepare two rotation axises I. Angle of the axis II.Angle of the current drag session
When the mouse button is clicked, rotate object to angles I + II
When the mouse button is released, sum I + II and wait for a new click.
And again, although I may be wrong, my current understanding is that step 3 will require multiplying the X-Y-Z angles converted to quaternion, or some other method which will rotate the Z axis at some point by summing rotations based only on the X&Y axises.
Using procedures completely different from the one mentioned abouve, I was able to achieve the expected behavior based on [accumrotate] but I found no simple way of managing the current angle.
Unfortunately I have torn down the patch. If it would clarify anything, I will try to put together another one later today.
Thanks for replies.
David Shimamoto
Indeed,
Seems to me all the matrix discussion does not get to the heart of the question.
So, Pspunch, what are you really trying to do?
I agree with cyrille that It's very likely the normal rotation objects will do what you want it to.
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
..b
cyrille henry wrote:
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
Trying to achieve free rotation *without* using [accumrotate], I have come across concepts such as multiplying matrixs and converting a matrix to "quarternion" How do you implement precise control of rotation matrixs? Is this exactly what people use GridFlow for?
If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thanks, cyrille,
I looked up some of the objects which were new to me in order to understand your method, and your example makes an awful lot of sense. I will try implementing it later today.
Mean while,
you can save few cpu using gemlist_matrix and GEMglMultMatrix.
Can you please show me specifically how I can utilize these? I was not able to create [GEMglMultMatrix] as an object so I am guessing it is an abbreviation of some related method I do not know of.
Also, are there any resources on what practices are processed on the GPU and which ones are not? That is a point I have never considered but is probably worth thinking of for intense patches I may (or I may not, someone else may..) build in the future.
Thanks.
-- David Shimamoto
PSPunch wrote:
Thanks, cyrille,
I looked up some of the objects which were new to me in order to understand your method, and your example makes an awful lot of sense. I will try implementing it later today.
Mean while,
you can save few cpu using gemlist_matrix and GEMglMultMatrix.
Can you please show me specifically how I can utilize these? I was not able to create [GEMglMultMatrix] as an object so I am guessing it is an abbreviation of some related method I do not know of.
use [GEMglMultMatrixf] (or [GEMglMultMatrixd], but the latter will not give you any benefits with a current Pd)
when starting with GEMgl... you should be aware that you are doing openGL (there's nothing wrong with that) and that you will have to follow openGL conventions a good start is to search the web for (e.g.) "glMultMatrix" and see what it gives you...
gfasmrd IOhannes
Cyrille,
With your advise, I think I've successfully implemented the algorithm I had in mind.
The sad thing is, the algorithm I imagined did not exactly function in the way I wanted.
i.e. 1, during one "drag session", when rotating the Y axis (dragging right or left) 180 degrees and then the x axis (up or down), it rotates as expected. However, when moving the axis in reverse order (making the teapot upside down, and then rotate) it does not rotate in the expected direction.
i.e. 2, Behavior when dragging from one corner diagonally across the screen is not as expected.
I've attached a sample patch.
Probably the two problems are related. I need to look into this a bit more..
-- David Shimamoto
ok. i think i undersand.
there is an other possibility based on the gemlist_info object that get curent transformation matrix and convert it to rotation / translation ...
so, what i think is the most simple is : gemhead | rotateXYZ (for the drag rotation, should be (0 0 0) when you don't drag) | rotateXYZ (for a feedback loop thanks to the rotation given by by the last object on the chain) | object primitive | gemlist (the gemlist should be banged only at the end of the drag) | gemlist_info (get curent rotation at the end of the drag, and send it to the 2nd rotate)
you can save few cpu using gemlist_matrix and GEMglMultMatrix.
this is a bit like the algorythm you describ, execpt that everything is computed on the GPU (it is more the Gem way to do).
cyrille
PSPunch a écrit :
Hi,
My primary goal is to place an object you can rotate by dragging the mouse.
Basically, whenever the mouse is clicked to start drag, I want to rotate the object on the X & Y axises. Up to this point is no problem, but I want the rotation to begin assuming the direction of the viewer being the bases of the axis.
Using one [rotate] object, I can get the object to rotate in the behavior I expect only on the first drag.
Ideally, each time the mouse button is released, the base (fundus? basal?) of the rotation vector should be updated... I think.
By chaining [rotate] objects, I can use one to rotate the rotation axis and another to rotate the object from that point. However, I have not found a method of summing multiple drag actions.
Although I may be wrong, I think what I need to do is,
Prepare two rotation axises I. Angle of the axis II.Angle of the current drag session
When the mouse button is clicked, rotate object to angles I + II
When the mouse button is released, sum I + II and wait for a new click.
And again, although I may be wrong, my current understanding is that step 3 will require multiplying the X-Y-Z angles converted to quaternion, or some other method which will rotate the Z axis at some point by summing rotations based only on the X&Y axises.
Using procedures completely different from the one mentioned abouve, I was able to achieve the expected behavior based on [accumrotate] but I found no simple way of managing the current angle.
Unfortunately I have torn down the patch. If it would clarify anything, I will try to put together another one later today.
Thanks for replies.
David Shimamoto
Indeed,
Seems to me all the matrix discussion does not get to the heart of the question.
So, Pspunch, what are you really trying to do?
I agree with cyrille that It's very likely the normal rotation objects will do what you want it to.
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
..b
cyrille henry wrote:
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote:
> Trying to achieve free rotation *without* using [accumrotate], I > have > come across concepts such as multiplying matrixs and converting a > matrix > to "quarternion" > How do you implement precise control of rotation matrixs? > Is this exactly what people use GridFlow for? If you tried GridFlow's bundled examples you'd see what I use GridFlow for. I suppose that I could add some other people's examples in the package, if they sent it to me for that purpose. There is already one patch by Roman Häfeli in GridFlow's examples though.
GridFlow does not support quaternions. I bet it's possible to add support for it using abstractions, but it wouldn't be fast. But I'm willing to add it to the core... there's already a complex-number section in number.c, why not quaternion product? It would be called [# H.*] where H stands for Hamilton (in math the letter Q is already reserved for rationals, so I'd use H even though the concept of rational reasonably couldn't appear in that particular place).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
This is rotating about local axes within the pot, which move when the pot moves, creating the strange response. The response should be based on a global set of axes, which will remain constant and provide the response you want.
On 7/17/08, PSPunch shima@pspunch.com wrote:
Cyrille,
With your advise, I think I've successfully implemented the algorithm I had in mind.
The sad thing is, the algorithm I imagined did not exactly function in the way I wanted.
i.e. 1, during one "drag session", when rotating the Y axis (dragging right or left) 180 degrees and then the x axis (up or down), it rotates as expected. However, when moving the axis in reverse order (making the teapot upside down, and then rotate) it does not rotate in the expected direction.
i.e. 2, Behavior when dragging from one corner diagonally across the screen is not as expected.
I've attached a sample patch.
Probably the two problems are related. I need to look into this a bit more..
-- David Shimamoto
ok.
i think i undersand.
there is an other possibility based on the gemlist_info object that get curent transformation matrix and convert it to rotation / translation ...
so, what i think is the most simple is : gemhead | rotateXYZ (for the drag rotation, should be (0 0 0) when you don't drag) | rotateXYZ (for a feedback loop thanks to the rotation given by by the last object on the chain) | object primitive | gemlist (the gemlist should be banged only at the end of the drag) | gemlist_info (get curent rotation at the end of the drag, and send it to the 2nd rotate)
you can save few cpu using gemlist_matrix and GEMglMultMatrix.
this is a bit like the algorythm you describ, execpt that everything is computed on the GPU (it is more the Gem way to do).
cyrille
PSPunch a écrit :
Hi,
My primary goal is to place an object you can rotate by dragging the mouse.
Basically, whenever the mouse is clicked to start drag, I want to rotate the object on the X & Y axises. Up to this point is no problem, but I want the rotation to begin assuming the direction of the viewer being the bases of the axis.
Using one [rotate] object, I can get the object to rotate in the behavior I expect only on the first drag.
Ideally, each time the mouse button is released, the base (fundus? basal?) of the rotation vector should be updated... I think.
By chaining [rotate] objects, I can use one to rotate the rotation axis and another to rotate the object from that point. However, I have not found a method of summing multiple drag actions.
Although I may be wrong, I think what I need to do is,
Prepare two rotation axises I. Angle of the axis II.Angle of the current drag session
When the mouse button is clicked, rotate object to angles I + II
When the mouse button is released, sum I + II and wait for a new click.
And again, although I may be wrong, my current understanding is that step 3 will require multiplying the X-Y-Z angles converted to quaternion, or some other method which will rotate the Z axis at some point by summing rotations based only on the X&Y axises.
Using procedures completely different from the one mentioned abouve, I was able to achieve the expected behavior based on [accumrotate] but I found no simple way of managing the current angle.
Unfortunately I have torn down the patch. If it would clarify anything, I will try to put together another one later today.
Thanks for replies.
David Shimamoto
Indeed,
Seems to me all the matrix discussion does not get to the heart of the question.
So, Pspunch, what are you really trying to do?
I agree with cyrille that It's very likely the normal rotation objects will do what you want it to.
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
..b
cyrille henry wrote:
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
On Wed, 16 Jul 2008, PSPunch wrote: > > Trying to achieve free rotation *without* using [accumrotate], I have >> come across concepts such as multiplying matrixs and converting a >> matrix >> to "quarternion" >> How do you implement precise control of rotation matrixs? >> Is this exactly what people use GridFlow for? >> > If you tried GridFlow's bundled examples you'd see what I use > GridFlow for. I suppose that I could add some other people's examples in the > package, if they sent it to me for that purpose. There is already one patch > by Roman Häfeli in GridFlow's examples though. > > GridFlow does not support quaternions. I bet it's possible to add > support for it using abstractions, but it wouldn't be fast. But I'm willing > to add it to the core... there's already a complex-number section in > number.c, why not quaternion product? It would be called [# H.*] where H > stands for Hamilton (in math the letter Q is already reserved for rationals, > so I'd use H even though the concept of rational reasonably couldn't appear > in that particular place). > > _ _ __ ___ _____ ________ _____________ _____________________ ... > | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec > _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hello,
yes, there was a small bug in your algo.
it's easier for me to make a patch than to explain the problem. so, i think this is what you need.
cyrille
PSPunch a écrit :
Cyrille,
With your advise, I think I've successfully implemented the algorithm I had in mind.
The sad thing is, the algorithm I imagined did not exactly function in the way I wanted.
i.e. 1, during one "drag session", when rotating the Y axis (dragging right or left) 180 degrees and then the x axis (up or down), it rotates as expected. However, when moving the axis in reverse order (making the teapot upside down, and then rotate) it does not rotate in the expected direction.
i.e. 2, Behavior when dragging from one corner diagonally across the screen is not as expected.
I've attached a sample patch.
Probably the two problems are related. I need to look into this a bit more..
-- David Shimamoto
ok. i think i undersand.
there is an other possibility based on the gemlist_info object that get curent transformation matrix and convert it to rotation / translation ...
so, what i think is the most simple is : gemhead | rotateXYZ (for the drag rotation, should be (0 0 0) when you don't drag) | rotateXYZ (for a feedback loop thanks to the rotation given by by the last object on the chain) | object primitive | gemlist (the gemlist should be banged only at the end of the drag) | gemlist_info (get curent rotation at the end of the drag, and send it to the 2nd rotate)
you can save few cpu using gemlist_matrix and GEMglMultMatrix.
this is a bit like the algorythm you describ, execpt that everything is computed on the GPU (it is more the Gem way to do).
cyrille
PSPunch a écrit :
Hi,
My primary goal is to place an object you can rotate by dragging the mouse.
Basically, whenever the mouse is clicked to start drag, I want to rotate the object on the X & Y axises. Up to this point is no problem, but I want the rotation to begin assuming the direction of the viewer being the bases of the axis.
Using one [rotate] object, I can get the object to rotate in the behavior I expect only on the first drag.
Ideally, each time the mouse button is released, the base (fundus? basal?) of the rotation vector should be updated... I think.
By chaining [rotate] objects, I can use one to rotate the rotation axis and another to rotate the object from that point. However, I have not found a method of summing multiple drag actions.
Although I may be wrong, I think what I need to do is,
Prepare two rotation axises I. Angle of the axis II.Angle of the current drag session
When the mouse button is clicked, rotate object to angles I + II
When the mouse button is released, sum I + II and wait for a new click.
And again, although I may be wrong, my current understanding is that step 3 will require multiplying the X-Y-Z angles converted to quaternion, or some other method which will rotate the Z axis at some point by summing rotations based only on the X&Y axises.
Using procedures completely different from the one mentioned abouve, I was able to achieve the expected behavior based on [accumrotate] but I found no simple way of managing the current angle.
Unfortunately I have torn down the patch. If it would clarify anything, I will try to put together another one later today.
Thanks for replies.
David Shimamoto
Indeed,
Seems to me all the matrix discussion does not get to the heart of the question.
So, Pspunch, what are you really trying to do?
I agree with cyrille that It's very likely the normal rotation objects will do what you want it to.
If you are just wanting to rotate many times, using huge numbers then tricks like: wrap 0 359 work well...
..b
cyrille henry wrote:
hello
sorry if i misunderstand. rotateXYZ will rotate in X direction, then in Y, finally in Z. if you wish to rotate in Z, then in X, you just need 2 rotate objects: the 1st for the rotation in Z, then an other for the rotation in X.
anyway, there is no matrix manipulation that i was not able to do with rotate/rotateXYZ/translateXYZ/scaleXYZ/shearXY.. so i'm quite sure you don't need anything else than this standard objects for simple matrix rotation.
so i think you need 1 [rotate] to rotate the vector axis of the object, then a accumrotate. if i misunderstood, could you please describe your problem better.
I think you can also use GEMgl objects to multiply the matrix with a custom one, but it's to much complex for what you need.
cyrille
PSPunch a écrit :
Hi Mathieu,
I have not looked into GridFlow much, but I had the impression that its main concept was to add matrix manipulation features to Pd, all of its visual capabilities being just one of the many results of data you can manipulate with matrix. (or is the egg first?)
Anyway, understanding its marvelous potentials, I have lately been stuck with Windows platforms. At least I got your point that utilizing GridFlow only for crunching numbers may work but not so efficient.
What I am trying to do is rotate the vector axis of the object before applying [rotation]. This also calls for a method of summing the rotations when applying multiple times (and my current understanding is that this can only be done by multiplying the quaternion on each rotation)
If there is no solution at the moment, perhaps Gem could use a few extra objects to ease advanced rotations?
I feel like I am complaining about lack of features without pointing out what exactly is missing, when I should be blaming my lack of math skills.
hmmm..
-- David Shimamoto
> On Wed, 16 Jul 2008, PSPunch wrote: > >> Trying to achieve free rotation *without* using [accumrotate], I >> have >> come across concepts such as multiplying matrixs and converting >> a matrix >> to "quarternion" >> How do you implement precise control of rotation matrixs? >> Is this exactly what people use GridFlow for? > If you tried GridFlow's bundled examples you'd see what I use > GridFlow for. I suppose that I could add some other people's > examples in the package, if they sent it to me for that purpose. > There is already one patch by Roman Häfeli in GridFlow's examples > though. > > GridFlow does not support quaternions. I bet it's possible to add > support for it using abstractions, but it wouldn't be fast. But > I'm willing to add it to the core... there's already a > complex-number section in number.c, why not quaternion product? > It would be called [# H.*] where H stands for Hamilton (in math > the letter Q is already reserved for rationals, so I'd use H even > though the concept of rational reasonably couldn't appear in that > particular place). > > _ _ __ ___ _____ ________ _____________ _____________________ ... > | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
#N canvas 366 8 638 677 10; #X obj 230 269 gemhead; #X obj 230 442 teapot; #X obj 482 16 gemmouse; #X obj 475 99 -; #X obj 475 152 spigot; #X obj 230 337 rotateXYZ; #X obj 230 401 rotateXYZ; #X obj 539 99 -; #X obj 535 151 spigot; #X obj 230 468 gemlist_info; #X obj 251 371 unpack f f f; #X msg 301 303 0; #X obj 56 88 gemwin; #X obj 53 186 gemhead 49; #X obj 53 223 world_light; #X msg 56 46 create , 1 , lighting 1; #X text 359 46 Messy stuff....; #X msg 213 49 destroy; #X obj 476 72 t f f; #X obj 538 73 t f f; #X obj 474 129 * 5; #X obj 538 129 * 5; #X connect 0 0 5 0; #X connect 1 0 9 0; #X connect 2 0 18 0; #X connect 2 1 19 0; #X connect 2 2 8 1; #X connect 2 2 4 1; #X connect 3 0 20 0; #X connect 4 0 5 2; #X connect 5 0 6 0; #X connect 6 0 1 0; #X connect 7 0 21 0; #X connect 8 0 5 1; #X connect 9 1 10 0; #X connect 9 1 11 0; #X connect 10 0 6 1; #X connect 10 1 6 2; #X connect 10 2 6 3; #X connect 11 0 5 1; #X connect 11 0 5 2; #X connect 13 0 14 0; #X connect 15 0 12 0; #X connect 17 0 12 0; #X connect 18 0 3 1; #X connect 18 1 3 0; #X connect 19 0 7 1; #X connect 19 1 7 0; #X connect 20 0 4 0; #X connect 21 0 8 0;