coordinate-systems

WPF: how to make the (0,0) in center inside a Canvas

谁说我不能喝 提交于 2019-11-28 17:58:58
The WPF Canvas has a coordinate system starting at (0,0) at the top-left of the control. For example, setting the following will make my control appear on the top-left: <Control Canvas.Left="0" Canvas.Top="0"> How can I change it to the standard cartesian coordinates ? Basically: (0,0) at center flip Y I noticed this post is similar, but it does not talk about translating the coordinate system. I tried adding a TranslateTransform, but I can't make it work. The best thing is to write a custom Canvas, in which you can write ArrangeOverride in such a way that it takes 0,0 as the center. Update :

Convert PictureBox Selection Rectangle according to SizeMode

柔情痞子 提交于 2019-11-28 14:17:17
I have two PictureBoxes pbOriginal and pbFace. After Selecting a "face" from an image in pbOriginal I clone the rectangle selection and place it into pbFace. However, Because pbOriginal is using SelectionMode=Stretch the actual area being copied is not the same as the area being selected. How do I convert the coordinates of the Rectangle so that they truly reflect the coordinates of the Stretched Image? Here is an example that draws the second rectangle right along as you draw the first one..: Point mDown = Point.Empty; Point mCurr = Point.Empty; private void pictureBox1_MouseDown(object

Finding Points On Perimeter Of a Circle

六月ゝ 毕业季﹏ 提交于 2019-11-28 11:25:59
问题 I need to draw line from the centre of a circle. For this I first chose centre of the image as a circle centre and draw a circle with known radius. After that using parametric equation of the circle I just calculated the x and y on perimeter by incrementing angle by 6 degree. x = cx + r * cos(a) y = cy + r * sin(a) I am using OpenCV to do all these, where pixel co-ordinate start from upper left corner. So my problem is for 360 degree cycle the algorithm need to be draw 60 lines but when the

Convert GPS coordinates to coordinate plane

只谈情不闲聊 提交于 2019-11-28 07:51:24
This is somewhat related to another question I asked: Translate GPS coordinates to location on PDF Map . That got me to this point, now I'm stuck on the math. Let's say I have a floor plan of a building, I've taken gps coordinate readings from each corner of the building. Also assume that the floor plan is lined up with the latitude and longitude. How do I convert a GPS coordinate to a X,Y position on this map? I can't seem to get the math right. Let delta_long and delta_lat be the differences, in degrees, in the GPS coordinates of the building's corners. Let delta_x = 320 and delta_y = 480

“Non Finite Transformation Detected” in spTransform in rgdal R Package

巧了我就是萌 提交于 2019-11-28 06:29:43
问题 I am trying to convert geographic coordinates (degrees) into UTM coordinates (meters) and keep getting an error message that a "Non finite transformation detected." Do you know how I can fix this? Here is the code I used: > GPS.Points <- Gomer.Data[, c('Longitude', 'Latitude')] > head(GPS.Points) Longitude Latitude 1 23.85474 -19.52211 2 23.85531 -19.52243 3 23.85534 -19.52257 4 23.85580 -19.52346 5 23.85551 -19.52380 6 23.85513 -19.52360 > GPS.Points.Spatial.Data <- SpatialPoints(GPS.Points,

flip svg coordinate system

末鹿安然 提交于 2019-11-28 05:38:05
Is there a way to flip the SVG coordinate system so that [0,0] is in the lower left instead of the upper left? I have done a lot of experimentation, and the only logical method is as follows: <g transform="translate(0,400)"> <g transform="scale(1,-1)"> Where 400 is the height of the image. What this does it move everything down so that the top of the image is now and the bottom of the image, then the scale operation flips the Y coordinates, so that the bit that is now off the page/image is flipped back up to fill the space left behind. cchamberlain The best all around combo I've found for

Finding Cities within 'X' Kilometers (or Miles)

天大地大妈咪最大 提交于 2019-11-28 04:35:41
This may or may not be clear, leave me a comment if I am off base, or you need more information. Perhaps there is a solution out there already for what I want in PHP. I am looking for a function that will add or subtract a distance from a longitude OR latitude value. Reason: I have a database with all Latitudes and Longitudes in it and want to form a query to extract all cities within X kilometers (or miles). My query would look something like this... Select * From Cities Where (Longitude > X1 and Longitude < X2) And (Latitude > Y1 and Latitude < Y2) Where X1 = Longitude - (distance) Where X2

Three.js: Show world coordinate axes in corner of scene

与世无争的帅哥 提交于 2019-11-27 20:48:05
This is probably a very basic problem, but I haven't found a solution yet and it's been bugging me. I'd like to show arrows indicating the world coordinate directions (x, y, z) in the bottom right hand corner of the camera like is done in Maya, so that when rotating the camera around an object, or moving through a scene, you can still identify the directions of the world coordinates. I've tried to accomplish this using two different approaches and neither has worked so far. I have an object with three arrows as children using the THREE.ArrowHelper class, we'll call it XYZ for the moment. The

Python conversion between coordinates

北慕城南 提交于 2019-11-27 19:16:47
Are there functions for conversion between different coordinate systems? For example, Matlab has [rho,phi] = cart2pol(x,y) for conversion from cartesian to polar coordinates. Seems like it should be in numpy or scipy. nzh Using numpy, you can define the following: import numpy as np def cart2pol(x, y): rho = np.sqrt(x**2 + y**2) phi = np.arctan2(y, x) return(rho, phi) def pol2cart(rho, phi): x = rho * np.cos(phi) y = rho * np.sin(phi) return(x, y) The existing answers can be simplified: from numpy import exp, abs, angle def polar2z(r,theta): return r * exp( 1j * theta ) def z2polar(z): return

Generating triangular/hexagonal coordinates (xyz)

家住魔仙堡 提交于 2019-11-27 17:21:10
I'm trying to come up with an iterative function that generates xyz coordinates for a hexagonal grid. With a starting hex position (say 0,0,0 for simplicity), I want to calculate the coordinates for each successive "ring" of hexagons, as illustrated here: So far, all I've managed to come up with is this (example in javascript): var radius = 3 var xyz = [0,0,0]; // for each ring for (var i = 0; i < radius; i++) { var tpRing = i*6; var tpVect = tpRing/3; // for each vector of ring for (var j = 0; j < 3; j++) { // for each tile in vector for(var k = 0; k < tpVect; k++) { xyz[0] = ???; xyz[1] = ??