coordinates

Drawing part of a Bézier curve by reusing a basic Bézier-curve-function?

大憨熊 提交于 2019-11-27 07:20:02
Assuming I'm using some graphic API which allows me to draw bezier curves by specifying the 4 necessary points: start, end, two control points . Can I reuse this function to draw x percent of the 'original' curve (by adjusting the control points and the end point)? Or is it impossible? Unnecessary information, should someone care: I need the whole thing to draw every n % of the original bezier curve with different color and/or line style I'm using Java's Path2D to draw bezier curves: Path2D p = new GeneralPath(); p.moveTo(x1, y1); p.curveTo(bx1, by1, bx2, by2, x2, y2); g2.draw(p); What you

Remove duplicate element pairs from multidimensional array

有些话、适合烂在心里 提交于 2019-11-27 07:02:15
问题 I have an array that looks like this: 1. coordinates = [ [16.343345, 35.123523], 2. [14.325423, 34.632723], 3. [15.231512, 35.426914], 4. [16.343345, 35.123523], 5. [15.231512, 32.426914] ] The latitude on line 5 is the same as on line 3, but they have different longitudes and are therefore not duplicates. Both the latitude and longitude are the same on line 3 and 6, and are therefore duplicates and one should be removed. 回答1: The difficulty in this question that different arrays never

Converting Longitude & Latitude to X Y on a map with Calibration points

戏子无情 提交于 2019-11-27 06:49:40
If i have a jpeg map with size sizeX, sizeY and some calibration points on the map (X, Y, Lon, Lat) What would be the algorithm for calculating the corresponding XY point in the map with a given Longitude / Latitude pair? Here's what worked for me, without so much bs. int x = (int) ((MAP_WIDTH/360.0) * (180 + lon)); int y = (int) ((MAP_HEIGHT/180.0) * (90 - lat)); The lat,lon coordinates were given to me by Android devices. So they should be in the same standard used by all Google Earth/Map products. If using the Equidistant Cylindrical Projection type map , here is what you need to do: Find

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

青春壹個敷衍的年華 提交于 2019-11-27 06:42:17
This question already has an answer here: Fastest Way to Find Distance Between Two Lat/Long Points 16 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 BEETWEEN , since I want to search trough a maximum of 50Km range the near places? I forgot to say that I

How to place views in a specific location (x, y coordinates)

自作多情 提交于 2019-11-27 06:30:14
问题 I have a problem with placing my views (my class extends View ) in a specific location. I have designed a game that treats the screen as a net of grids. I get from the user x and y coordinates of a specific view (I have different types of views). My first mission is to set the correct view in its place. How can I do it? I am using RelativeLayout for the screen. P.S. I don't want to use AbsoluteLayout params because it was truncated. 回答1: This is not the best way to achieve it, but it's a

Convert Lat/Longs to X/Y Co-ordinates

二次信任 提交于 2019-11-27 06:25:44
I have the Lat/Long value of New York City, NY; 40.7560540,-73.9869510 and a flat image of the earth, 1000px × 446px. I would like to be able to convert, using Javascript, the Lat/Long to an X,Y coordinate where the point would reflect the location. So the X,Y coordinate form the Top-Left corner of the image would be; 289, 111 Things to note: don't worry about issues of what projection to use, make your own assumption or go with what you know might work X,Y can be form any corner of the image Bonus points for the same solution in PHP (but I really need the JS) A basic conversion function in js

HTML5 Canvas moving object to mouse click position

泄露秘密 提交于 2019-11-27 06:22:22
问题 Basically I want to move an object from point A ( 10x,10y ) to a position on the canvas where the mouse has been clicked ( 255x,34y ). I'm currently using a method, but it goes from ++X then ++Y to coordinates; up then right. I want it to go straight to position, likes an animation on a path. Slowing going from point A to Point B. 回答1: When you “move” an object, what you really need to do is erase the object and redraw it First code a function that will redraw the rect at a specified x,y

3D coordinates on a sphere to Latitude and Longitude

孤者浪人 提交于 2019-11-27 06:19:29
I've got the following information: There exists a sphere with origin (0,0,0) and radius R. After doing a ray-sphere intersection I know a point (XYZ) in 3D space that is on the sphere (the exact position in 3D space where the line pierces the sphere hull). For my program I'd like to calculate the Latitude and Longitude of the XYZ point on the sphere, but I can't think (or Google) up a way to do this easily. So in short, the function that I'm trying to write is this: public static LatLon FromVector3(Vector3 position, float sphereRadius) { return Latitude and Longitude } Does anybody know how

How to get the user Home/Work location for a user in Android

你说的曾经没有我的故事 提交于 2019-11-27 05:39:29
问题 Im developing an app that brings the user a quick list of "info" items but i want to set an options so that he receives this items as notifications when he is leaving home or work. I noticed (using google now on my device) that they can tell where the user lives and works so that they can push you notifications whenever you leave or arrive at one of this places (a sort of if this then that). Is there any way yo obtain the coordinates (lat and long) that Google Now (they come from google maps)

Android ImageView - Get coordinates of tap (click) regardless of scroll location or zoom scale

纵饮孤独 提交于 2019-11-27 05:13:30
问题 Background: I have an ImageView that I've modified to be scrollable (drag) and zoom-able (pinch zoom). I used the exact technique mentioned in the "Hello, Android" 3rd edition book that can also be found here. This technique uses matrix transformation to handle both scrolling and zooming. My Problem: When a user taps on the image, I want the coordinates of that tap in relation to the image itself, regardless of how the image has been scrolled or magnified. For instance, if my image is