rotation

Problems rotating BufferedImage

冷暖自知 提交于 2020-01-03 07:23:08
问题 I have some problems with rotating images in Java using the AffineTransform class. I have the following method for creating a rotated (90 degrees) copy of an image: private BufferedImage createRotatedCopy(BufferedImage img, Rotation rotation) { int w = img.getWidth(); int h = img.getHeight(); BufferedImage rot = new BufferedImage(h, w, BufferedImage.TYPE_INT_RGB); double theta; switch (rotation) { case CLOCKWISE: theta = Math.PI / 2; break; case COUNTERCLOCKWISE: theta = -Math.PI / 2; break;

Iphone SDK: move and rotate to touch

风流意气都作罢 提交于 2020-01-03 04:48:10
问题 I have an image of a fish - If the user touches the screen I want the fish to "look" at the touched point and move there. If the touch has been moved i want the fish constantly following the touch. How can I do that? 回答1: would be something like this: - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *tap = [touches anyObject]; CGPoint pointToMove = [tap locationInView:self.view]; CGFloat xdiff = pointToMove.x-myFish.center.x; CGFloat ydiff = pointToMove.y-myFish

Objective-c CATransform3DMakeRotation Clockwise/Counterclockwise

痴心易碎 提交于 2020-01-03 04:46:26
问题 I'm rotating an UIView along the x axis using CATransform3DMakeRotation using the below code: float radians = DegreesToRadians(30); [UIView animateWithDuration:0.15 animations:^{ self.moveControlView.layer.transform = CATransform3DMakeRotation(radians,1,0,0); }]; The rotation is applied always in the same versus ( clockwise ). I want to rotate the UIView in the opposite versus. In order to achieve my goal I've tried: Set a negative angle (-30) Set the angle to 330 But the versus of the

Rotating Towards Path in OpenGL

你离开我真会死。 提交于 2020-01-03 03:42:08
问题 I am having trouble on how to rotate an object in 3D space, based on the OpenGL rotate function glRotatef(..). glRotatef ( angle , x , y , z ) My object is traveling from one point to another in 3D space. I want my object to rotate in the direction it is traveling. How would I find the angle, x, y, z that is needed for the glRotatef(...) function if I know the point where I am starting and the point where I am finishing. 回答1: The gluLookAt function is exactly what you need here. It will save

Rotate point around vector 3d

丶灬走出姿态 提交于 2020-01-03 02:00:10
问题 I want to rotate a P3 (that is somewhere near) around a vector (that intersects P1 and P2) by x degrees. P1 and P2 are 2 points that are intersected by vector(line) e from image. I've researched and searched a lot and found some good materials, but my trigonometry skills are so poor. I need this for PAWN (small), here i have some code, but doesn't really work as intended. If anyone can help me, i'll be very thankful :) Image link: http://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Euler

Lossless JPEG rotation during decoding with libjpeg

帅比萌擦擦* 提交于 2020-01-03 01:20:13
问题 I've got a simple C++ app that decodes JPEGs with libjpeg - however, some of the images it processes come out sideways! These input images have orientations baked in to the EXIF data by the camera, but it seems that during decompression, libjpeg isn't taking the orientation flag into account as many JPEG viewers do. Is there a way to get libjpeg to respect the orientation of the JPEG during decompression, or will I have to parse out this orientation tag and manually rotate the image? 回答1: the

As3 sprite rotationX and rotationY

主宰稳场 提交于 2020-01-02 18:57:09
问题 I have a bit problem with rotationX and rotationY. It's cool if i just do a roationX and rotaionY below _eventParent.rotationY =_differentX; _eventParent.rotationX =_differentY; However once i have assign a mouse move to the _eventParent. The roationX and roationY change perspectively while the mouse is moving. so instead the item remain the same size. it increase and decrease size prospectively. any idea why is it doing this? is there a possibility to stop this behavior? Thanks Please find

Flipping issue when interpolating Rotations using Quaternions

有些话、适合烂在心里 提交于 2020-01-02 10:17:54
问题 I use slerp to interpolate between two quaternions representing rotations. The resulting rotation is then extracted as Euler angles to be fed into a graphics lib. This kind of works, but I have the following problem; when rotating around two (one works just fine) axes in the direction of the green arrow as shown in the left frame here the rotation soon jumps around to rotate from the opposite site to the opposite visual direction, as indicated by the red arrow in the right frame. This may be

Can d3's transition and rotation play well together?

给你一囗甜甜゛ 提交于 2020-01-02 09:59:32
问题 Transitions in combination with rotations have odd results. Here is a fiddle with my problem: http://jsfiddle.net/emperorz/E3G3z/1/ Try clicking on each square to see the varying behaviour. Please forgive the hacked code, but if I use transition with rotation (and x/y placement) then it loops about. I have tried: 1) all in the transform (rotate then translate), and that seems mostly okay. A little wobbly. 2) just rotate in the transform, positioned using x/y attributes. Flies all over the

iPhone App - Show AVFoundation video on landscape mode

折月煮酒 提交于 2020-01-02 08:21:46
问题 I am using the AVCam example App from Apple. This example uses AVFoundation in order to show video on a view. I am trying to make from the AVCam a landscape App with no luck. When screen orientation changes the video is shown rotated on the view. Is there a way of handling this problem? 回答1: When you create your preview layer: captureVideoPreviewLayer.orientation = UIInterfaceOrientationLandscapeLeft; And the methods to manage rotations: -(void)willAnimateRotationToInterfaceOrientation: