rotation

Java GUI Rotation and Translation of Rectangle

孤街醉人 提交于 2020-01-23 08:06:30
问题 I am trying to draw a rectangle in JPanel that would translate and then rotate itself to mimic the movement of a car. I have been able to make the rectangle translate and rotate, however it rotates around the origin of (0,0). I'm very pleased that I was able to have the rectangle move and rotate as I am very new to Java GUI, but I can not seem to get how to have the rectangle rotate around itself, because I experimented more with it, and when I initialized the rectangle and rotate it 45

Center of rotated cv::Rect

帅比萌擦擦* 提交于 2020-01-23 05:35:46
问题 I have an image, and I place a rectangle on the image. Then I rotate the image. How do I get the center of the rectangle on the rotated image? Or can I rotate a rectangle somehow to put on rotated image? I think in this case rotation must be done along same point with point used to rotate image. This is the image with a rectangle placed on it. This is the rotated image. Here is the code I use to rotate my image: cv::Mat frame, frameRotated; frame = cv::imread("lena.png"); cv::Rect rect(225

MP4 videos in Firefox and IE not respecting rotation

邮差的信 提交于 2020-01-23 03:54:05
问题 We have a webpage that plays back a faststart MP4 in a <video> tag - pretty simple, and it works great in Chrome and Safari. However, it seems as though Firefox 36 and IE10 are not respecting the rotation of the video, so they end up playing either upside down or rotated 90*. Here is what ffprobe says about one of the videos: ╰─$ ffprobe test ffprobe version 2.6 Copyright (c) 2007-2015 the FFmpeg developers built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)

Turn a 2D Image into a rotating 3D image on Matlab

走远了吗. 提交于 2020-01-23 03:22:05
问题 I would like to know how to rotate a 2D image along its Z-axis using Matlab R2016b and to obtain an image after performing this procedure. For example, let's take this 2D image: Now, I rotate it of 45° roughly: And now, of 90°: Do you know if it is possible to perform the same operation in Matlab R2016b, please ? Thank you very much for your help Images Source: https://www.youtube.com/watch?v=m89mVexWQZ4 回答1: Yes it's possible. The easiest thing to do would be to map the image on the y = 0

Rotation and Scaling controls are off after using setAngle() in Fabric.js

耗尽温柔 提交于 2020-01-21 18:54:19
问题 I want to let users rotate objects on the Fabric.js powered canvas, but limit their rotation to 90 deg increments. Idea is that as they rotate and then stop, the object would "snap" into place at the closest angle. This works okay by listening to "object:rotating", setting the closest angle, then calling object.setAngle(angleClosestTo90). However, once the object has been "snapped", the controls for scaling/rotating the image are off. You can still select them, but it's finicky - I guess the

Rotation and Scaling controls are off after using setAngle() in Fabric.js

拟墨画扇 提交于 2020-01-21 18:54:19
问题 I want to let users rotate objects on the Fabric.js powered canvas, but limit their rotation to 90 deg increments. Idea is that as they rotate and then stop, the object would "snap" into place at the closest angle. This works okay by listening to "object:rotating", setting the closest angle, then calling object.setAngle(angleClosestTo90). However, once the object has been "snapped", the controls for scaling/rotating the image are off. You can still select them, but it's finicky - I guess the

How do I make an exact copy of a UIImage returned from a UIImagePickerController?

↘锁芯ラ 提交于 2020-01-20 02:44:08
问题 I have divergent needs for the image returned from the iPhone camera. My app scales the image down for upload and display and, recently, I added the ability to save the image to the Photos app. At first I was assigning the returned value to two separate variables, but it turned out that they were sharing the same object, so I was getting two scaled-down images instead of having one at full scale. After figuring out that you can't do UIImage *copyImage = [myImage copy]; , I made a copy using

Extract arbitrarily rotated plane of data from 3D array as 2D array

孤街浪徒 提交于 2020-01-19 04:00:08
问题 I have a 3D matrix of data in matlab, but I want to extract an arbitrarily rotated slice of data from that matrix and store it as a 2D matrix, which I can access. Similar to how the slice() function displays data sliced at any angle, except I would also like to be able to view and modify the data as if it were an array. I have the coordinates of the pivot-point of the plane as well as the angles of rotation (in x, y and z axis), I have also calculated the equation of the plane in the form: Ax

local mesh rotation without geometry translate and pivot (THREEJS)

北城余情 提交于 2020-01-17 06:15:30
问题 I try to apply a "local rotation" to a mesh in THREEJS. I want to rotation to be applied around the geometry center but it is applied around the geometry "origin" (0, 0, 0). Assumption: I can not modify the geometry. What I do right now: mesh3D.position.copy(worldPosition); mesh3D.rotation.setFromRotationMatrix(localRotation); mesh3D.updateMatrixWorld(true); Is the only solution to use a pivot somehow? I'd also like to avoid that as it changes the object children hierarchy... Thanks 回答1: To

Rotate text in a canvas with javascript

三世轮回 提交于 2020-01-17 02:56:06
问题 In the following code i want to rotate the text of each element of the array in javascript. If i use for example ctx.rotate(Math.PI/10) before the filltext, it rotates all the elements. The positioning of the text also changes with ctx.rotate(Math.PI/10) and if i use 90 degrees, ctx.rotate(Math.PI/2) the text does not show on the canvas. <html> <canvas id="myCanvas" width="300" height="300" style="border:1px solid #d3d3d3;"></canvas> <script> var c = document.getElementById("myCanvas"); var