PDA

View Full Version : Use Position, Orientation, Matrix4d(pointOfView) and Quaternion?


DickBaldwin
04-24-2007, 09:28 PM
I see functions that will return the following types of data describing an object:

Position
Orientation
Matrix4d(pointOfView)
Quaternion

I can declare variables of the first three types listed above and save the values returned from the functions in those variables. (I don't know how to save a Quaternion.)

However, I don't see any way to use the information stored in those variables once they are populated. I would expect to see methods that take these types an incoming parameters to make a move or to take some other action, or functions that take these types as incoming parameters and return the constituent parts, etc.

Maybe those methods and functions are there and I simply haven't identified them yet.

Any suggestions would be appreciated.

Thank you.
Dick Baldwin

DickBaldwin
04-24-2007, 09:53 PM
It never seems to fail. When I ask for help, I quickly find at least part of the answer.

I found one way to use a saved pointOfView. Some objects have a pointOfView property that can be set using the contents of a pointOfView variable that was saved earlier.

However, I could still use some advice on how to use the other types.

Dick Baldwin

DrJim
04-24-2007, 11:01 PM
See http://www.alice.org/community/showthread.php?t=580&highlight=roll for some links to quaternion math and its relationship to more conventional (to me) - but also apparently more difficult to compute with - roll, pitch and yaw notation. My understanding is that the 3D math package CMU is using is based on the quaternion method - certainly the values in the object property lists change with each rotation operation.

This has been on my list of things to look into deeper for quite a while but somehow :o I haven't gotten around to it. There was a bit of discussion on the general accumulated angle problem in the big discussion of Alice 3.0 progress posted about a year ago.

Note: Haven't checked this for sure, but I believe the "point of view" is just the combination of the position value and the quaternion value.

DickBaldwin
04-25-2007, 09:36 AM
That little text file containing a description of the code that you attached in one of your postings on the quaternion is interesting. Is there a way to cause Alice to produce such a text file, or did you create it outside of Alice?

I have a good understanding of vectors and am familiar with quaternions. So far, however, I haven't been able to get started using quaternions, positions, and vectors with Alice because:

1. I don't know how to save a quaternion (what is its type for example?)
2. I haven't found any methods or functions that accept them as input.
3. I haven't found any way to decompose them into more fundamental types such as coordinate values or angle values.

Dick Baldwin

DrJim
04-25-2007, 08:22 PM
Here is a bit of code with some things I've discovered - not very useful as far as I can see, but maybe something for teaching or debugging. At least you won't have to dig it out again.

Note particularly the options when setting a position. Also you can set orientation "as seen by" - i.e., with respect to any reference frame. Interesting, but not something I'm going to run out and use right away.

As far as data types go, Position, Orientation and PointOfView are all supported options as you noted. Orientation looks like a quaternion value. Haven't figured out exactly what PointOfView is - looks like a matrix when said or printed but given as position and orientation in the property list.

None of this seems to me to be of much use, since I also can't figure out how to use most of these variable types in the built-in methods. POV can be used to a limited extent but it can't be set that I can see.

(There is some intriguing stuff on the web http://www.alice.org/bvw02fall/scripting/scripting.html but it appears to be left over from Alice 1 - think there are more details somewhere in the forum. Also see http://www.westga.edu/~drocco/alice/scripting.html .)

As far as the text version of the code goes - I just printed it out as an .html document, copied it to the clipboard and pasted it into Notepad.

DickBaldwin
04-25-2007, 09:13 PM
DrJim,

That link to scripting in v2.0 looks really interesting. I might need to dust off some of my Python material, refresh my memory on Python, and take a closer look at that.

I was surprised to learn of the existence of the file named AlicePreferences.xml since no Windows installation was required in order to run Alice under WinXP. I'm not sure how or when that file was created. Sure enough, however, when I edited that file and made the change that Rocco suggested, the next time I started Alice, I was able to open a script editing tab in the program edit mode.

That's as far as I went, but I will certainly have to look deeper into that.

Thanks for the tip on creating the text files. I have never tried to copy an HTML page into NotePad because I don't normally use it. I normally use an editor named Aracnophilia, which preserves HTML, so it probably wouldn't work for the same purpose.

Dick Baldwin

DrJim
04-25-2007, 11:13 PM
DrJim,
I was surprised to learn of the existence of the file named AlicePreferences.xml .. I'm not sure how or when that file was created.


The whole .alice file seems to be a fairly important part of the Alice environment - there is quite a bit of information about it (for Alice :rolleyes: ) but it's scattered through a lot of notes and some of the documents on the main page. All of the preference seem to be kept there as well as the window setup - that's where to look if the display really gets resized beyond use. It is also periodically updated automatically by the progam - don't remember the details - and also seems to hold most of the differences in parameters for regular and slow and steady Alice.

Probably have goofed this up some - doing it from very imperfect memory. Maybe Gabe can post some sources for the characteristics of that file.