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
30
votes
4 answers

Android camera unexplainable rotation on capture for some devices (not in EXIF)

What I'm doing seems like it should be simple, but I'm still lost after I've read every possible Stackoverflow answer I can find and Googled every article I can find. I'm using a preview SurfaceView and capturing an image from an activity that is…
Scott Merritt
  • 1,284
  • 2
  • 13
  • 24
30
votes
8 answers

Android CheckBox -- Restoring State After Screen Rotation

I have come across some very unexpected (and incredibly frustrating) functionality while trying to restore the state of a list of CheckBoxes after a screen rotation. I figured I first would try to give a textual explanation without the code, in…
Jared M
  • 301
  • 1
  • 3
  • 3
30
votes
11 answers

Rotate image by 90, 180 or 270 degrees

I need to rotate an image by either 90, 180 or 270 degrees. In OpenCV4Android I can use: Imgproc.getRotationMatrix2D(new Point(center, center), degrees, 1); Imgproc.warpAffine(src, dst, rotationMatrix, dst.size()); However, this is a huge…
1''
  • 26,823
  • 32
  • 143
  • 200
29
votes
3 answers

Get new position of coordinate after rotation with Matrix

I'm wondering how to use a Matrix to get the new position of a coordinate within a rectangle after rotation. What I would like to do is: Define a rectangle Define a coordinate within that rectangle Rotate the rectangle Get the new position of the…
DecodeGnome
  • 1,809
  • 1
  • 19
  • 36
29
votes
5 answers

what method will called when we start to rotate device and after it finished

i want to detect a rotation process on ipad programmatically. In this case i want to set a boolean into yes, when the rotation will begin, and set it false after the rotation did ending. Is there any method that called when the rotation will begin…
R. Dewi
  • 4,141
  • 9
  • 41
  • 66
29
votes
2 answers

How to handle rotation with Retrofit and RxJava/RxAndroid in Activity?

I read here that we can use some global cache in order to handle rotation. You can prevent this by using the cache or replay Observable operators, while making sure the Observable somehow survives the Activity life-cycle (for instance, by storing…
DeniSHow
  • 1,394
  • 1
  • 18
  • 30
29
votes
4 answers

OpenGL rotating a camera around a point

In OpenGL I'm trying to rotate a camera around a point, with camera being distance r from the point and facing the point when it rotates. In other words, I want the camera to move along the circumference of a circle at a radius r from the center,…
Bryan Denny
  • 27,363
  • 32
  • 109
  • 125
28
votes
4 answers

Android camera resulted image should be rotated after the capture?

I'm writing an Android application that uses the camera. I'm setting camera display orientation to 90, my activity is in a portrait orientation: camera.setDisplayOrientation(90); I'm getting a well oriented preview picture, but the resulting image…
GetUsername
  • 1,057
  • 5
  • 18
  • 29
28
votes
3 answers

Drawable Rotating around its center Android

I am getting strange results with the following code: iv = (ImageView) findViewById(R.id.iv); iv.setImageResource(R.drawable.spinner_white_76); Animation a = new RotateAnimation(0.0f, 360.0f, …
Sameer Segal
  • 21,813
  • 7
  • 42
  • 56
27
votes
6 answers

Rotating Image on A canvas in android

I want to Rotate Image according to a specific angle in android ,some thing like a compass... I have this code...it works on drawPath() but i want to replace the path and the Drawing thing with image.. I tried to create a bitmap image…
Reham
  • 1,916
  • 6
  • 21
  • 45
27
votes
2 answers

How to transition only rotate transformation?

I'm using a bunch of elements to compose a background image and they all absolutely position around, rotating freely. Problem is, I would like to transition only the rotation of those objects, not the top nor left properties. And apparently…
Digger
  • 718
  • 1
  • 9
  • 22
26
votes
4 answers

Antialiasing edges of UIView after transformation using CALayer's transform

I have a UIView object that rotates using CALayer's transform: // Create uiview object. UIImageView *block = [[UIImageView alloc] initWithFrame....] // Apply rotation. CATransform3D basicTrans = CATransform3DIdentity; basicTrans.m34 =…
Oleg
  • 1,383
  • 4
  • 19
  • 35
26
votes
6 answers

Log rotating with a Bash script

I have the following issue: I have an application, which continuously produces output to stderr and stdout. The output of this application is captured in a logfile (the app is redirected as: &> log.txt ). I don't have any options to produce a…
Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
26
votes
15 answers

Rotate array elements to the left (move first element to last and re-index)

Is it possible to easily 'rotate' an array in PHP? Like this: 1, 2, 3, 4 -> 2, 3 ,4 ,1 Is there some kind of built-in PHP function for this?
Dylan
  • 9,129
  • 20
  • 96
  • 153
26
votes
4 answers

Finding center of 2D triangle?

I've been given a struct for a 2D triangle with x and y coordinates, a rotation variable, and so on. From the point created by those x and y coordinates, I am supposed to draw a triangle around the point and rotate it appropriately using the…
ray
  • 1,966
  • 4
  • 24
  • 39