coordinates

Transforming accelerometer's data from device's coordinates to real world coordinates

杀马特。学长 韩版系。学妹 提交于 2019-11-26 18:11:48
问题 I'm really sorry if this is a very basic question, but I have not choice but ask it: How do you translate the accelerometer data from the device coordinates to real world coordinates? I mean, assuming that the accelerometer is giving me somenting like (Ax,Ay,Az) -in device's coordinates-, what transformations should I apply to transform the values into (Ax',Ay',Az') -in real world's coordinates-, so I can use the acceleration vector in real worlds coordinates to calculate if the device is

Reverse Java Graphics2D scaled and rotated coordinates

主宰稳场 提交于 2019-11-26 17:56:36
I use Graphics2D in Java to scale and rotate the picture I draw. I now want to be able to tell what the original coordinates were when I click on a certain point in the picture. So given the rotated and scaled coordinates I want to calculate the original ones. Is there a simple way to do this? If you keep a copy of the AffineTransform you use when you paint the image, you can use AffineTransform.inverseTransform(Point2D ptSrc, Point2D ptDst) to transform a device space coordinate back to user space Edit : If you capture the current transform of the Graphics2D while painting, beware of the

SQL query, select nearest places by a given coordinates [duplicate]

旧巷老猫 提交于 2019-11-26 17:35:30
问题 This question already has an answer here: Fastest Way to Find Distance Between Two Lat/Long Points 15 answers I have $latitude = 29.6815400 and $longitude = 64.3647100 , now in MySQL I would like to take the 15 nearest places to these coordinates and I'm planning to do this query: SELECT * FROM places WHERE latitude BETWEEN($latitude - 1, $latitude + 1) AND longitude BETWEEN($longitude - 1, $logintude + 1) LIMIT 15; Do you think it's correct or do you suggest something else? How to do the

JFreeChart: Dispay mouse coordinates near to mouse as hints (on mouse move)

大兔子大兔子 提交于 2019-11-26 17:33:53
问题 What I want is, on a XYPlot, the coordinates of mouse displayed as hint near to mouse, when (the mouse) move on chart only! In another words, when the crosshair moves to another point, the positioning of the coordinate values would move too, following the crosshair. Also 1 horizontal line and 1 vertical line will be drawn, that intersects specifically at the point that mouse is over on. Is this possible? Until now I can get the coordinates and printed on console using ChartMouseListener and

Google Geocoder service is unavaliable (Coordinates to address)

荒凉一梦 提交于 2019-11-26 17:32:03
问题 I have to get an address by coordinates, but it doesnt work and outputs "Couldnt get address": public String GetAddress(String lat, String lon) { Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); String ret = ""; try { List<Address> addresses = geocoder.getFromLocation(Double.parseDouble(lat), Double.parseDouble(lon), 1); if(addresses != null) { Address returnedAddress = addresses.get(0); StringBuilder strReturnedAddress = new StringBuilder(""); for(int i=0; i<returnedAddress

Changing position of a button

余生长醉 提交于 2019-11-26 17:14:08
问题 I have one button in an AbsoluteLayout in an XML file. From there I am able to set the (x,y) position of the button. How can I get and set the (x,y) coordinates of the button programmatically? Thanks all. 回答1: You have to get a reference to you button, for example by calling findViewById(). When you got the reference to the button you can set the x and y value with button.setX() and button.setY(). .... Button myButton = (Button) findViewById(R.id.<id of the button in the layout xml file>);

Console App Mouse-Click X Y Coordinate Detection/Comparison

爷,独闯天下 提交于 2019-11-26 16:28:21
问题 I have a game that I am working on in a C# console application, purely as practice before going on to better methods. As opposed to using something such as a Windows Forms App, which has button functionality built in, I am endeavoring to grab the cursor position (which I know how to do) and compare it to a number of area's inside a console application as defined by perhaps pixel location, but I also do not know if there is some sort of built in unit of space other than pixels (this last bit

Getting the coordinates from the location I touch the touchscreen

£可爱£侵袭症+ 提交于 2019-11-26 16:23:14
问题 I try to get the coordinates from the location where I hit the touchscreen to do put a specific UIImage at this point. How can I do this? 回答1: In a UIResponder subclass, such as UIView : override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { let touch = touches.anyObject()! as UITouch let location = touch.locationInView(self) } This will return a CGPoint in view coordinates. Updated with Swift 3 syntax override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { let

Algorithm to generate a hexagonal grid with coordinate system

走远了吗. 提交于 2019-11-26 15:32:51
问题 I am trying to roll up 19 lines of code into a single for loop, but I am feeling a bit stumped. The reason I ask, is because I want the grid to be other sizes instead of 5. In Main::drawHexGridAdvanced() , I am trying to deduce the similarities between each line as opposed to Main::drawHexGridBasic() where I am hard-coding values. I am not sure how to determine the start of the x for each column in each row, because the pattern for n == 5 is 0, -1 -2 -2 -2 after that each consecutive column

Determine if one coordinate is in radius of another

≡放荡痞女 提交于 2019-11-26 15:19:50
问题 Let's say I have a Table of rows that contain coordinates. What would be the best way to pull only the rows of coordinates which are in the radius of another coordinate? To simplify my question, I'm giving the following example: Table like: Columns: Latitude, Longitude. Row1: 23.44444 24.55555 Row2: 32.44444 28.22222 Row3: 35.11111 32.12345 In an SQL statement, how do I get the rows of coordinates that are in the radius of Row3 for example? 回答1: This post shows how to do this in SQL Server.