Hey,
I am trying to adapt the JReality RotateTool in such a way, that rotations can be limited.
I am using the standard implementation, in which an Inputslot "TrackballTransformation" is registered. I can receive the transformation of this slot via the ToolContext.
Now, I`d like to limit transformations, so that for example only transformations within a quarter sphere or half sphere are possible. This would result in the user not being able to turn the picked component upside down. That`s exactly what I want.
Now, the question I am facing is, whether I need to receive the components transformation and check, whether it is valid, i.e. whithin the defined sphere.
Also that might better be accomplished by adding a TransformationListener to the component.
Maybe there is an easier way than those custom calculations/implementations. Is it possible to limit movements of my devices? There is the toolconfig.xml. Can I set delimiters already whithin the configuration? That`ll be great.
Well, sorry for possible lacks of explanation. Hope, someone can offer a suggestion.
Best regards,
luko
Limit Rotations of Components (RotateTool)
Re: Limit Rotations of Components (RotateTool)
Hi Luko,
look into de.jreality.tools.RotateTool (under src-tool/). In the last line of the perform-method, the new Matrix is applied (i.e., the matrix is set for the transformation). My suggestion would be to move that line in a protected method (e.g., apply(Matrix result)). Then you can inherit RotateTool and overwrite that method. There you can check first if you allow the rotation or not...
Steffen.
look into de.jreality.tools.RotateTool (under src-tool/). In the last line of the perform-method, the new Matrix is applied (i.e., the matrix is set for the transformation). My suggestion would be to move that line in a protected method (e.g., apply(Matrix result)). Then you can inherit RotateTool and overwrite that method. There you can check first if you allow the rotation or not...
Steffen.
-
- Posts: 3
- Joined: Wed 2. Jun 2010, 13:30
Re: Limit Rotations of Components (RotateTool)
Hey Steffen,
that's exactly what i was doing the last days.
My work is still in progress, but thx for your reply. at the moment i am only declining rotations around specified axes by using the rotation quaternion, e.g. fix x- and z-axis.
Next step will be limiting the rotations around the axes.
Whenever i find a working solution i will post it in here.
Best regards,
Luko
that's exactly what i was doing the last days.
My work is still in progress, but thx for your reply. at the moment i am only declining rotations around specified axes by using the rotation quaternion, e.g. fix x- and z-axis.
Next step will be limiting the rotations around the axes.
Whenever i find a working solution i will post it in here.
Best regards,
Luko
Re: Limit Rotations of Components (RotateTool)
To limit the rotation to a half sphere you can just look at the image of (0,0,1) under the transformation - only allow a rotation that when the z-component is non-negative.
-
- Posts: 17
- Joined: Thu 6. Mar 2008, 15:18
- Location: TU Berlin, Germany
- Contact:
Re: Limit Rotations of Components (RotateTool)
You probably already know, but still: there is a very useful class for such manipulations:
de.jreality.math.FactoredMatrix
de.jreality.math.FactoredMatrix
Paul Peters
-
- Posts: 3
- Joined: Wed 2. Jun 2010, 13:30
Re: Limit Rotations of Components (RotateTool)
Hey. Thx for your numerous replies.
I fortunately also found the factored Matrix.
We limited our expectations to only limiting rotations around defined axis - for a start. I did that through the rotationquaternion which is, as you know i guess, quite handy to work with. I guess, noone is interested in that bit of code, but if so, let me know.
Future work will surely be adding the bounds to that tool. Just do not know yet, when i will implement it.
Thx again t y'all.
Cya next time.
I fortunately also found the factored Matrix.
We limited our expectations to only limiting rotations around defined axis - for a start. I did that through the rotationquaternion which is, as you know i guess, quite handy to work with. I guess, noone is interested in that bit of code, but if so, let me know.
Future work will surely be adding the bounds to that tool. Just do not know yet, when i will implement it.
Thx again t y'all.
Cya next time.