Questions tagged [rotation]

A rotation is a circular movement of an object around a center (or point) of rotation. On a mobile device, it indicates the change of orientation.

A three-dimensional object rotates always around an imaginary line called a rotation axis. If the axis is within the body, and passes through its center of mass the body is said to rotate upon itself, or spin. A rotation about an external point, e.g. the Earth about the Sun, is called a revolution or orbital revolution, typically when it is produced by gravity.

Mathematically, a rotation is a rigid body movement which, unlike a translation, keeps a point fixed. This definition applies to rotations within both two and three dimensions (in a plane and in space, respectively.)

A rotation is commonly represented using , a rotation or .

On a mobile device, it indicates the change of orientation.

12013 questions
72
votes
10 answers

Rotate UIView around its center keeping its size

I'm trying to rotate an UIView a few radians but after applying the transformation it doesn't look to be keeping its size. What's the proper way to achieve this? Here's what I'm doing and what I get (Blue box with the arrow is the View I'm trying to…
Diego Acosta
  • 1,737
  • 3
  • 16
  • 21
70
votes
7 answers

How can you rotate text for UIButton and UILabel in Objective-C?

How can you rotate text for UIButton and UILabel? 90 degrees, 180 degrees.
jdl
  • 6,151
  • 19
  • 83
  • 132
70
votes
5 answers

Android : Rotate Vector Image to 90 degree

I have following code for my vector:
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
70
votes
17 answers

How to avoid restarting activity when orientation changes on Android

I am creating an Android app in which I'm drawing a view on a canvas. When the device's orientation changes, the activity restarts. I don't want it to. How can I avoid restarting the activity when the orientation changes?
chirag
  • 701
  • 1
  • 5
  • 3
70
votes
5 answers

threejs how to rotate around object's own center,instead of world center

two objects in the scene. the cube rotate axis should be the cube's center,that's my expect. but the shoe model's rotate axis is the world's y axis. my original code is. cube.rotation.y += 0.01; shoe.rotation.y += 0.01; I found a solution in…
Jinceon
  • 1,292
  • 2
  • 13
  • 21
69
votes
8 answers

How can I rotate a mesh by 90 degrees in ThreeJS?

I have a mesh that I want to rotate by 90 degrees inside Three JS. Here is the image of the current situation: I want the selected mesh to be rotated parallelly to the large mesh. I have tried rotating the matrix like this: matrix = new…
Zaay
  • 622
  • 2
  • 8
  • 23
68
votes
6 answers

Why doesn't setVisibility work after a view is animated?

Why doesn't the textView become invisible? Here is my layout xml:
ZippyFerguson
  • 889
  • 1
  • 7
  • 8
68
votes
7 answers

Easiest way to rotate by 90 degrees an image using OpenCV?

What is the best way (in c/c++) to rotate an IplImage/cv::Mat by 90 degrees? I would assume that there must be something better than transforming it using a matrix, but I can't seem to find anything other than that in the API and online.
Ben H
  • 3,136
  • 3
  • 25
  • 34
67
votes
17 answers

Setting device orientation in Swift iOS

I am working on a swift app for iPhone. There is a modal view in my application that I want only to be in portrait view. My question is, how do I programmatically force the phone to not allow rotation? In other words, I am looking for code that will…
rocket101
  • 7,369
  • 11
  • 45
  • 64
65
votes
4 answers

How can I get log4j to delete old rotating log files?

How can I get log4j to delete old rotating log files? I know I can set up automated jobs (cron for UNIX and scheduled task for Windows), but I want it cross platform, and I want it in our application's log configuration as a part of our…
skiphoppy
  • 97,646
  • 72
  • 174
  • 218
64
votes
10 answers

UICollectionView - resizing cells on device rotate - Swift

I've created a UICollectionView, so that I can arrange views into neat columns. I'd like there to be a single column on devices > 500 pixels wide. In order to achieve this, I created this function: func collectionView(collectionView:…
Ben
  • 4,707
  • 5
  • 34
  • 55
63
votes
6 answers

How to use onSensorChanged sensor data in combination with OpenGL

( edit: I added the best working approach in my augmented reality framework and now also take the gyroscope into account which makes it much more stable again: DroidAR framework ) I have written a TestSuite to find out how to calculate the rotation…
Simon
  • 13,173
  • 14
  • 66
  • 90
59
votes
7 answers

Get the current angle/rotation/radian for a UIView?

How do you get the current angle/rotation/radian a UIView has?
Hjalmar
  • 1,921
  • 2
  • 16
  • 19
59
votes
5 answers

2D Euclidean vector rotations

I have a euclidean vector a sitting at the coordinates (0, 1). I want to rotate a by 90 degrees (clockwise) around the origin: (0, 0). If I have a proper understanding of how this should work, the resultant (x, y) coordinates after the rotation…
hiddensunset4
  • 5,825
  • 3
  • 39
  • 61
56
votes
4 answers

Rotate a point by another point in 2D

I want to know how to work out the new co-ordinates for a point when rotated by an angle relative to another point. I have a block arrow and want to rotate it by an angle theta relative to a point in the middle of the base of the arrow. This is…
James
  • 3,597
  • 11
  • 47
  • 57