rotation

Rotating image in python: extrapolate background color

有些话、适合烂在心里 提交于 2019-12-24 01:57:33
问题 I am rotating an image with the following python code: from PIL import Image img = Image.open('banana.jpg') rotated = img.rotate(10) rotated.save('banana-rotated.jpg') This makes the following transformation: to As you can see, the background is black. This question asks how to fill the background with a specific color. However, I would like to fill the background with the color of the image. Because I need to rotate many images, I do not want to set the background to a fixed color. Is there

CSS3 Bugs - Issues when using transform:rotate rules (Safari + Firefox)

余生长醉 提交于 2019-12-24 01:48:47
问题 I've got a Wordpress site with some CSS3 rules applied to some images that rotate the images and have a hover effect on rollover too. Problems are showing up in Safari & Firefox when you hover on and then off these images and I can't seem to locate any similar issues by people on the Interwebs. See http://tinyurl.com/3n2eude and hover on and then off the images (the slightly rotated ones): Member name goes blurry and then back to normal (Firefox) Member image border becomes jagged (Firefox) A

Text not in same position after rotating

三世轮回 提交于 2019-12-24 01:25:54
问题 After applying transform: rotate(90deg); the text is slightly shifted from it's normal position. Open this in Firefox : http://jsfiddle.net/42y89/. As you can see, the text appears shifted by 1px after it's rotated, which makes a big difference in this case. You can hover the boxes to see how this happens. On Chrome however it looks fine. It seems related to the font-size / line-height / anti-aliasing? I don't know... does anyone have any ideas? <div></div> div { width: 100px; height: 100px;

How can I calculate the rotation when using a quaternion camera?

妖精的绣舞 提交于 2019-12-24 01:18:18
问题 Given a quaternion camera, how can I calculate its rotation when the player can walk on different surface normals (walls). I'm working on a game which allows the player to walk on ceilings and walls in 3D space. I've opted to use a quaternion camera system to avoid Gimbal Lock. Given a set of up(0,1,0), right(1,0,0), and forward(0,0,1) vectors, I construct a quaternion. The player rotates around the up vector for heading and around the right vector for pitch. Without changing gravity vectors,

Why is my FPS camera rolling, once and for all?

戏子无情 提交于 2019-12-24 01:15:42
问题 If I ignore the sordid details of quaternions algebra I think I understand the maths behind rotation and translation transformations. But still fail to understand what I am doing wrong. Why is my camera rolling once and for all!? :) And to be a bit more specific, how should I compute the camera View matrix from its orientation (rotation matrix)? I am writing a minimalistic 3d engine in Python with a scene Node class that handles the mechanics of rotation and translation of 3d objects. It has

Rotating text using center in itext

社会主义新天地 提交于 2019-12-24 01:08:16
问题 I'm converting a document which is created with a online editor. I need to be able to rotate the text using it's central point and not (0,0). Since Image rotates using the centre I assumed this would work but it doesn't. Anyone has a clue how to rotate text using the central point in itext? float fw = bf.getWidthPoint(text, textSize); float fh = bf.getAscentPoint(text, textSize) - bf.getDescentPoint(text, textSize); PdfTemplate template = content.createTemplate(fw, fh); Rectangle r = new

can't get the image to rotate in center in Qt

给你一囗甜甜゛ 提交于 2019-12-24 00:56:12
问题 i am trying to rotate a 89x89 image inside the QLabel Widge. #include "header.h" disc::disc(QWidget *Parent) : QWidget(Parent) { orig_pixmap = new QPixmap(); rotate = new QLabel(this); showDegrees = new QLabel(this); orig_pixmap->load("pic.png"); degrees = 0; rotate->resize(89,89); rotate->move(100,10); rotate->setStyleSheet("QLabel{background-color:red;}"); showDegrees->resize(100,100); showDegrees->move(400,0); } void disc::rotate_disc() { QString string; degrees++; if(degrees == 360)

How to implement alt+MMB camera rotation like in 3ds max?

偶尔善良 提交于 2019-12-24 00:43:48
问题 PREREQUISITES Let me start the question by providing some boilerplate code we'll use to play around: mcve_framework.py: from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import glm from glm import cross, normalize, unProject, vec2, vec3, vec4 # -------- Camera -------- class BaseCamera(): def __init__( self, eye=None, target=None, up=None, fov=None, near=0.1, far=100000, delta_zoom=10 ): self.eye = eye or glm.vec3(0, 0, 1) self.target = target or glm.vec3(0, 0, 0)

CGAL: Transformation Matrix for Rotation given two lines/vectors/directions

╄→гoц情女王★ 提交于 2019-12-24 00:39:42
问题 How do I generate a transformation matrix for rotating points/others by the angle between two lines/vectors/directions in CGAL? 2D is what I need. 3D is what I love. 回答1: According to the manual you have these tools to work with: Aff_transformation_2<Kernel> t ( const Rotation, Direction_2<Kernel> d, Kernel::RT num, Kernel::RT den = RT(1)) approximates the rotation over the angle indicated by direction d, such that the differences between the sines and cosines of the rotation given by d and

WPF: Collision Detection with Rotated Squares

眉间皱痕 提交于 2019-12-23 22:24:56
问题 With reference to this programming game I am currently building. Thanks to the answers from this post, I am now able to find the x-y coordinates of all the points of the rectangles (even when rotated), and Collision-Detection with Walls is almost working perfectly now. Now I need to implement collision detection with the bots themselves (cause obviously, there will be more than one bot in the Arena). Square-Square Collision Detection (Non-rotated) is not valid in this case because the bots