transformation

Matrix / coordinate transformation in C#

混江龙づ霸主 提交于 2019-12-02 05:20:09
问题 I have an array of coordinates that reflect known positions on an image. Let's call this the template image. It has a unique barcode and orientation markers (which are also in the coordinate array). The image is printed, scanned and fed back into my application to be detected. During printing and scanning, the image could be transformed in three ways; translation, rotation and scale. Assuming that I can find the orientation markers on the distorted image, how can I use matrix transformation

Swing: Delegate events to child components of transformed parent

有些话、适合烂在心里 提交于 2019-12-02 04:41:28
问题 I've got a custom component GameViewCanvas extends JPanel that will hold a number of tiles (800x800 textures). Now in GameViewCanvas I've overridden the paint() method, so that it will paint the children on a transformed canvas (zoom, panning and rotation). I now want to delegate events like MouseEvent and MouseMotionEvent to the respective children - the problem of course being that Swing has no idea where the children are on the actual frame. I thought I might be able to just override a

Draw an Image in arbitrary corners

核能气质少年 提交于 2019-12-02 03:57:46
So i have a normal image. I defined Click- and Drag-Listeners on each corner of the rectangular image. I want to freely transform each of the corners and paint it on the screen. The AffineTransform class provides transformation possibilities but i couldn't find a way to realize this. I have implemented the same function in android with the Matrix.setPolytoPoly method. However there is no equivalent in java swing. Thanks! Edit: I would like to illustrate this process with the following image: This should happen when i drag one corner to the upper left. Now the problem that i have is, that i don

Transformation to get rid of collinear points

主宰稳场 提交于 2019-12-02 03:25:42
问题 I'm writing a program to solve a geometry problem. My algorithm doesn't treat collinear point very well. Is there any transformation I can apply to the points to get rid of the collinearity? 回答1: Then I think that noise might actually be the solution. As I wrote in the comment above One way to remove colinearity is simply to add some noise to each point, i.e. (x, y, z) ↦ (x + 0.01*(random() - 0.5), y + 0.01*(random() - 0.5), z + 0.01(random() - 0.5)) if random() returns a random real number

Calling Java from XSL (SAXON)

岁酱吖の 提交于 2019-12-02 02:05:30
I'm trying to use the Saxon processor from java. I'm using the the saxon9ee.jar inside saxonee9-3-0-11j.zip (just downloaded, no license - is that needed so it'll work?) Their * * resources can be found here: http://www.saxonica.com/documentation/extensibility/functions/instance-methods.xml http://www.saxonica.com/documentation/extensibility/functions/staticmethods.xml My xsl: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:value-of select="dateUtils:getCurrentFullDate()" xmlns:dateUtils="java:com.macfaq.math

Transformation to get rid of collinear points

天大地大妈咪最大 提交于 2019-12-02 01:56:51
I'm writing a program to solve a geometry problem. My algorithm doesn't treat collinear point very well. Is there any transformation I can apply to the points to get rid of the collinearity? Then I think that noise might actually be the solution. As I wrote in the comment above One way to remove colinearity is simply to add some noise to each point, i.e. (x, y, z) ↦ (x + 0.01*(random() - 0.5), y + 0.01*(random() - 0.5), z + 0.01(random() - 0.5)) if random() returns a random real number in [0, 1[. If you are working with a lot of point sets, adding noise to every set may solve the problem in

Objective-C CALayer UIView real rotation

不羁的心 提交于 2019-12-02 00:04:25
I'm trying to rotate a UIView object like shown on the image below http://i.piccy.info/i7/f8ff7fe488c7c492e6ff6a689bc9cdeb/1-5-2127/60800682/rotation.png I'm trying to use the CALayer's transform but I get something like this: http://i.piccy.info/i7/bbb672b058fdfdd251cc90f1ce2b9c1f/1-5-2128/9488743/rotate2.png If I understand correctly, you want to title the view backwards (into the screen) an should be able to achieve it something like this: float distance = 50; CATransform3D basicTrans = CATransform3DIdentity; basicTrans.m34 = 1.0 / -distance; view.layer.transform = CATransform3DRotate

Matrix / coordinate transformation in C#

試著忘記壹切 提交于 2019-12-01 23:19:14
I have an array of coordinates that reflect known positions on an image. Let's call this the template image. It has a unique barcode and orientation markers (which are also in the coordinate array). The image is printed, scanned and fed back into my application to be detected. During printing and scanning, the image could be transformed in three ways; translation, rotation and scale. Assuming that I can find the orientation markers on the distorted image, how can I use matrix transformation to get the relative positions of the remaining coordinates? I posted this question on SO before but made

XSL recursive sort

与世无争的帅哥 提交于 2019-12-01 20:47:49
问题 I am facing a problem where I need to sort elements, depending on their value, which contains a numbers, separated by periods. I need to sort elements depending on the value of the number before first period, then the number between first and second periods and so on. I don't know, how deep this hierarchy can go and that is the biggest problem. <?xml version="1.0" encoding="UTF-8"?> <root> <ROW>2.0.1</ROW> <ROW>1.2</ROW> <ROW>1.1.1</ROW> <ROW>1.2.0</ROW> <ROW>1</ROW> </root> The result shoul

XSL recursive sort

自古美人都是妖i 提交于 2019-12-01 19:28:01
I am facing a problem where I need to sort elements, depending on their value, which contains a numbers, separated by periods. I need to sort elements depending on the value of the number before first period, then the number between first and second periods and so on. I don't know, how deep this hierarchy can go and that is the biggest problem. <?xml version="1.0" encoding="UTF-8"?> <root> <ROW>2.0.1</ROW> <ROW>1.2</ROW> <ROW>1.1.1</ROW> <ROW>1.2.0</ROW> <ROW>1</ROW> </root> The result shoul be like this: <?xml version="1.0" encoding="UTF-8"?> <root> <ROW>1</ROW> <ROW>1.1.1</ROW> <ROW>1.2</ROW