rotation

ARKit Calc euler angles from rotation matrix in YXZ world

三世轮回 提交于 2021-02-11 13:00:25
问题 I need help in math in general for euler angles and specifically in ARKit. I looked at many references for calculation of euler angles but I wondered why apple in its tutorial calculated yaw from atan2(r11, r12) as follow: let yaw = atan2f(camera.transform.columns.0.x, camera.transform.columns.1.x) If I need to calculate pitch or roll, for example how? I need to understand yaw and why they not always depends on yaw = camera.eularAngle.y Please check this code and questions in comments, I'm

Changing direction of rotation Pygame

女生的网名这么多〃 提交于 2021-02-11 12:36:17
问题 How would you change the direction of a rotating image/rect in Pygame? Applying positive and negative degree values works but it seems to only be able to rotate one direction throughout my window. Is there a way to ensure a change in direction of rotation? Perhaps change up rotation of a spinning image every 5 seconds, or if able to change the direction of the spin when hitting a X or Y axis. I've added some code below. It seems like switching movement directions is easy with rect.move_ip as

Spawn bullet at barrel of gun

百般思念 提交于 2021-02-09 13:57:46
问题 I'm making a top-down shooter and the player's gun is offset from the coordinates of the object. I'm using GameMaker:Studio, so the x and y coords are the center of the object. The offset of the image is set here: bullet_offset_x = 30; bullet_offset_y = 28; And here is the code for shooting the gun: var xpos = x + (bullet_offset_x * cos(degtorad(direction))) - (bullet_offset_y * sin(degtorad(direction))); var ypos = y + (bullet_offset_x * sin(degtorad(direction))) + (bullet_offset_y * cos

Eigen: Perform an 3D rotation around an axis W and anchored at a point P

南楼画角 提交于 2021-02-08 06:30:33
问题 I want to create a function that receives an angle, two vectors, one of them being an unit vector that defines the direction of the axis of rotation and the other is the vector to be rotated and a point P that defines the anchoring position of the rotation. To implement this in Eigen I guess I would have to use the geometry module, unfortunately, I think the documentation of this module is not great and I am failing to understand it. My idea is to combine the rotation transformation AngleAxis

C# Rotating JPG without losing too much quality

僤鯓⒐⒋嵵緔 提交于 2021-02-08 04:29:08
问题 So I'm reading in files from a directory, figuring out which way they need to be rotated. Rotating and then saving. That part works... The issue is, after it saves the file it gets recompressed and I go from 1.5meg images to 250k images. I need to keep the file size around the original. I tried using jhead.exe and calling it from a command line but couldn't get any of my arguments to pass in correctly. Here's my code snipit to detect, rotate, and save. foreach (FileInfo f in dir.GetFiles("*

Three js 3D rotation

限于喜欢 提交于 2021-02-07 22:38:49
问题 I have 2 mesh objects. Anchor and Rod. The Anchor rotates around z-axis, as illustrated by the image. The rod is supposed to move only backward and forwards. Here is the image: http://imageshack.us/photo/my-images/841/7a83.png/. But i am stuck with trying to figure out the matrix calculation. For example if the anchor rotates 45degrees, so its facing the x-axis, how can i make the rod still move backwards and forwards? 回答1: For the rotation around z axis : var rotation = new THREE.Matrix4()

Rotate, scale and translate 2D coordinates?

泪湿孤枕 提交于 2021-02-07 20:11:10
问题 I'm am working on a project at the moment where I am trying to create a Hilbert curve using the Python Imaging Library. I have created a function which will generate new coordinates for the curve through each iteration and place them into various lists which then I want to be able to move, rotate and scale. I was wondering if anyone could give me some tips or a way to do this as I am completely clueless. Still working on the a lot of the code. #! usr/bin/python import Image, ImageDraw import

OpenCV : wrapPerspective on whole image

自古美人都是妖i 提交于 2021-02-07 07:18:03
问题 I'm detecting markers on images captured by my iPad. Because of that I want to calculate translations and rotations between them, I want to change change perspective on images these image, so it would look like I'm capturing them directly above markers. Right now I'm using points2D.push_back(cv::Point2f(0, 0)); points2D.push_back(cv::Point2f(50, 0)); points2D.push_back(cv::Point2f(50, 50)); points2D.push_back(cv::Point2f(0, 50)); Mat perspectiveMat = cv::getPerspectiveTransform(points2D,

How to calculate a rotation matrix in n dimensions given the point to rotate, an angle of rotation and an axis of rotation (n-2 subspace)

泄露秘密 提交于 2021-02-07 07:17:35
问题 I would like to calculate an (nxn) rotation matrix in the n-dimensional space given the following: The point to rotate. An angle of rotation. An axis of rotation (an (n-2) subspace that passes through the origin given by (n-2) unit vectors that span the subspace). the final rotated point. I think that number 4 (the final rotated point) is redundant and it is possible to calculate the rotation matrix without it. But I have them all. Is there a matlab function that already implements it? I know

OpenCV : wrapPerspective on whole image

六月ゝ 毕业季﹏ 提交于 2021-02-07 07:14:35
问题 I'm detecting markers on images captured by my iPad. Because of that I want to calculate translations and rotations between them, I want to change change perspective on images these image, so it would look like I'm capturing them directly above markers. Right now I'm using points2D.push_back(cv::Point2f(0, 0)); points2D.push_back(cv::Point2f(50, 0)); points2D.push_back(cv::Point2f(50, 50)); points2D.push_back(cv::Point2f(0, 50)); Mat perspectiveMat = cv::getPerspectiveTransform(points2D,