rotation

Compare Quaternion to axis

I have the orientation of an object stored as a unit quaternion, and I want to see what angle the object's local x axis makes with the global y axis. What's the easiest way to do that? Thanks! ...

Stopping the video if the rotate is moving

Ok so i have this page. As you can see on this page I have a header that if you click on the three little dots on the right a new image and movie is displayed. this works great at the moment. The problem is the client now wants the page to rotate and I have tried this in the past but the problem arises when someone clicks on the movie an...

What is the best way to rotate cube in Opengl

Hi all, after reading stackoverflow questions on the topic, I am not able to find a solution. I have a Rubik's cube displayed using OpenGl in a Java Eclipse application and I want to "rotate" this cube in response to mouse events. I started with a "naive" (isn't it ?) solution as described here: http://stackoverflow.com/questions/14264...

Component of a quaternion rotation around an axis

I'm having trouble finding any good information on this topic. Basically I want to find the component of a quaternion rotation, that is around a given axis (not necessarily X, Y or Z - any arbitrary unit vector). Sort of like projecting a quaternion onto a vector. So if I was to ask for the rotation around some axis perpendicular to the ...

Android: Dialog etc restore after rotation changed

How to restore the dialog etc after rotating the screen? For example, pop up an alertDialog to tell user some information. then the user rotate the screen to another orientation. How to restore the alertDialog? Can any one guide me to do it? Thanks! Appended later: I looked into the android source code and find these things: Dialogs ...

Bash script log file rotation

My bash script produces a log file. Now i'd like to implement some log file rotation. Let's say the first time it's called somelog.log, the next time it's renamed to somelog.log.1 and the new log file somelog.log.The third time the new log is somelog.log again, but somelog.log.1 is renamed to somelog.log.2 and the old somelog.log to some...

How to rotate a 3D tringle flat against the wall?

I'm working with 3D mesh data, where I have lots of 3D triangles which I need to rotate to eliminate the Z value, converting it to a 2D triangle. With this 2D triangle I'm doing some vector calculations. After I'm done with my work I need to rotate it back to the original angle such that the old points return back to their original pos...

Changing iPad orientation, rotating statusbar, toolbars, but not the main view

Hello, I’m trying to set up an iPad test application, window-based, where I have a single view controller and a single view. When I rotate the iPad, I want the orientation of the toolbar to change, but not that of the view itself. For example, a sort of background view that you work in is fixed to the device, but the status bar and tool...

Calculate if two 3D triangles are on the same plane

For a 3D game engine I'm working on I need to calculate if two 3D triangles are on the same plane to display it accordingly. How do I calculate the angles of a triangle in 3D space? Would calculating a surface normal and comparing those ever give me 2 equivalent normals? ...

Objective c - Rotate wheel using radians

Hi, I am trying to make a circle image which rotates when the user drags the wheel This is my code: CABasicAnimation *rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.toValue = [NSNumber numberWithFloat:angleRadians]; rotationAnimation.duration = 10; rotationAnima...

Rotating an array of bits in C

I've just started learning C and I'm having some problems with some code I want to write. Basically I have this struct that is a bit array, with the number of bits in the array, and a pointer to a buffer of chars, that stores the bits. My strategy for rotating the bit array is simply taking the number of rotations (mod the length to a...

Rotate UIView using UITouch

I have a question on how I should approach rotating a UIView with touch based events. Quite simply, I want to rotate a UIView around an anchorpoint, depending on where I touch on and off within that view. Imagine a volume knob on a hifi, which you turn with one finger. I've built a rotation method using CAKeyframeAnimation which carrie...

What's wrong with this XNA RotateVector2 function?

Hi, I know this is probably a very simple question, but I can't seem to figure it out. First of all, I want to specify that I did look over Google and SO for half an hour or so without finding the answer to my question(yes, I am serious). Basically, I want to rotate a Vector2 around a point(which, in my case, is always the (0, 0) vecto...

Will Apple reject my app for using setStatusBarOrientation?

ViewController1 uses portrait orientation. ViewController2 uses landscape orientation. If I use: [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait]; Will my app get rejected? If I can't use this call, what is my other option? Simply rotating the images won't be sufficient since I need to use ac...

device rotation iphone

Hi there... All of my widths, heights, positions and everything are set relative to views and such, so if the iphone is rotated it should "expand to fit" as it were. :) How would I go about telling the iphone to be in "landscape mode" ie: refresh, but now all widths are heights and all heights are widths? Thanks Tom EDIT Here is the ...

iPhone view won't rotate

Hi, This is a continuation from a previous question that I asked: http://stackoverflow.com/questions/3730190/iphone-view-strategy I am now using the following method to switch between views: UIWindow *window = [[UIApplication sharedApplication] keyWindow]; [window setRootViewController:[self gameViewController]]; [[[self gameViewContr...

ipad rotation hides elements in view !

OK here is a very basic iPad app that i am starting out with and I am already into issue. I have been doing iphone apps but in that too never implemented rotation things.. well here is the issue. This is a simple viewbased app build with interface builder that looks like this: when i run the app, the vertical orientation has both elem...

Rotate 2D rectangular array in-place

I have an non-square array like this: const int dim1 = 3, dim2 = 4; int array[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12}; and I need to convert it to: {3,6,9,12, 2,5,8,11, 1,4,7,10} that is, rotate/shuffle it counter-clockwise (or clockwise, the algorithm should be similiar)...

Auto resize subviews on device rotation

Hi there I have all my subviews set up so that they are based on self.view. EG: UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,(self.view.frame.size.width-20),(self.view.frame.size.height-90))]; however when the view rotates (shouldRotateToDeviceOrientation or whatever) the views all stay the same size. How can...

How to use a matrix to rotate the reference system of a vector relatively to another?

Real-life case (helps understand the question) I am building a device that can freely rotate around all its axis (x, y, z) and is equipped with: an accelerometer (A) that gives me a vector pointing to the centre of the Earth (Va) a 3D magnetometer (M) that gives me the direction of the magnetic field of the Earth (Vm) The two vector...