Menu
  • HOME
  • TAGS

With knowing just 2 points that represent opposing corners, how to determine if a point input by the user is inside the rectangle

java,eclipse,position,coordinates,rectangles

Essentially here's what you need to do: Based on your points 1 and 3, construct the other two points 2 and 4 to complete the rectangle definition. Take in the user-input point, we'll call it 5. Calculate the area made by triangles for all P(1,2,5), P(1,4,5), P(2,3,5), P(3,4,5) and add...

Check if elements of different ArrayLists share position

java,arraylist,coordinates

A pretty messy approach would be to find all indexes of matching x-coordinates and for each index found check whether the y-coordinate for the given index is equal to the y in question. So given coordinates x, y and array lists visitedX and visitedY you could do something like this:...

Find coordinates of tap event when using iScroll

cordova,coordinates,iscroll

Here's the code which gave me the coordinates of where I touched the image, regardless of where it was scrolled to, or zoomed: document.addEventListener('tap', tap_on_floor_plan, false); setTimeout(function () { myScroll = new IScroll('#wrapper', { zoom: true, scrollX: true, scrollY: true, tap: true, mouseWheel: true, wheelAction: 'zoom' }); }, 100); function...

How to ignore black bars on fitviewport(LibGdx) when getting coordinates?

java,libgdx,touch,coordinates,viewport

Keep a Vector2 handy so you don't have to create new ones each time: private Vector2 tmpVec2 = new Vector2(); Then use viewport's unproject method: public boolean touchDown(int screenX, int screenY, int pointer, int button) { stage.getViewport().unproject(tmpVec2.set(screenX, screenY)); xTouch = tmpVec2.x; yTouch = tmpVec2.y; } ...

Working with coordinates x y

c++,function,structure,coordinates,circle

I would name the struct something like Point rather than Points, since a single instance of the struct holds only one pair of x,y coordinates. Then a suitable distance function might be something like float distance(const Point& point1, const Point& point2) { return sqrt((point1.x * point2.x) + (point1.y * point2.y));...

What is this algorithm mapping coordinates to numbers called?

algorithm,coordinates,coordinate-systems,coordinate

So here's my question: does this algorithm exists already? Has it a name? This mapping is called the Z-order curve or Morton code: In mathematical analysis and computer science, Z-order, Morton order, or Morton code is a function which maps multidimensional data to one dimension while preserving locality of...

How to retrieve the coordinates of a Line2D in Java

java,line,coordinates,shape,rectangles

you can use getX1(); getX2(); and getY1() getY2() for getting x1,y1 and x2,y2 coordinates .there is no width and height for a 2d line.read api here update assume u have a line 2d shape Shape s = new Line2D.Float(1, 2, 200, 200); now you if want to get (x1,y1,x2,y2)then use...

How to make it so D3 Force Directed Graph generates nodes in same position each time

javascript,d3.js,graph,coordinates

According to the d3 documentation, aligning your nodes along a diagonal line, will make the force directed algorithm balance the nodes positions with the least number of iterations in most cases. I use it this way and I get consistent positions every time I use the same data set. The...

Create Google Maps links based on coordinates

google-maps,hyperlink,coordinates,share

Why not http://www.google.com/maps/place/lat,lng I think this is the simplest way http://www.google.com/maps/place/49.46800006494457,17.11514008755796...

How to sort string of numbers (x,y,z,x,y,..) w/ regular expressions?

regex,string,notepad++,coordinates

Thanks. But I have also managed to consult it with IT student on my dorms and he figured it out. find: "([+-]*[0-9]+.[0-9]+),([+-]*[0-9]+.[0-9]+),([+-]*[0-9]+.[0-9]+)," replace: "x=$1 y=$2 z=$3" The magic for me is the dollar sign plus number denoting the found expression in given () brackets. I hope it will help someone...

How can I get users within a given radius of distance using PFGeoPoint

ios,objective-c,coordinates,pfuser,parse-framework

EDITED Parse actually have a simple solution to that: int radiusInKilometers = 400; //Example PFGeoPoint * myGeoPoint = [PFUser currentUser][@"geoPoint"]; // Your geoPoint PFQuery *query = [PFUser query]; [query whereKey:@"geoPoint" nearGeoPoint:myGeoPoint withinKilometers:radiusInKilometers]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { NSLog(@"Successfully retrieved %d scores.", objects.count); // Do something with...

How to parse coordinates from a text file in Objective-C?

ios,objective-c,parsing,coordinates

Assuming the text file's in your bundle, you can store the text in an NSString like so: NSString* path = [[NSBundle mainBundle] pathForResource:@"coordinates" ofType:@"txt"]; NSString* content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; Then separate the text into lines using componentsSeparatedByString:, go through each line with a loop, then separate each line...

Get the current coordinates of an item on a Canvas widget given its item handle?

python,canvas,tkinter,coordinates,items

Use the coords method: coords = the_canvas.coords(item_id) ...

Finding if lat/long point is inside a polygon defined by coordinates

php,codeigniter,coordinates,kml,geojson

The point is inside the green boundaries, but you just want to override that with another polygon. Assuming that you have multiple polygons, it might be worth keeping track of whether the polygons are shaded (True) or not shaded (False), or some other combination based on what your algorithm actually...

Convert DDM to DD Geographic Coordinate Conversion C# [closed]

c#,math,coordinates,converter,coordinate

//Parsing the DDM format is left as an excersize to the reader, // as is converting this code snippet into a usable function. double inputDegrees = 52; double inputMinutes = 37.9418; double latitude = inputDegrees + (inputMinutes/60); // 52.632363 ...

C# WPF -> How to get the coordinates from a stretched(uniform) polygon on a grid

c#,wpf,coordinates,polygon

You have to take two more things into account. First, the Grid may align (i.e. move) the whole stretched Polygon according to its HorizontalAlignment and VerticalAlignment properties. If you don't want to calculate that by yourself, you could get an appropriate GeneralTransform object by myPolygon.TransformToAncestor(grid): var polygonGeometryTransform = myPolygon.RenderedGeometry.Transform; var...

How do I get the current x and y position to use GCRectMake in Swift?

swift,coordinates,cgrectmake

do you mean you want this? var frm: CGRect = imageView.frame frm.origin.x = frm.origin.x - 50 frm.origin.y = frm.origin.y - 50 frm.size.width = frm.size.width + 500 frm.size.height = frm.size.height + 500 imageView.frame = frm ...

Check if object is looking at position

javascript,rotation,three.js,coordinates

That won't work because the matrix for your target is not in the same place, and can be scaled differently and all sorts of stuff. A better technique is to raycast from your eye object, and see if it hits the target object. http://threejs.org/examples/#webgl_geometry_terrain_raycast var raycaster = new THREE.Raycaster(); raycaster.setFromCamera(...

How to connect two markers with a line in Google maps api3

javascript,html,google-maps,google-maps-api-3,coordinates

create a polyline (See the documentation for options availble) var polyline = new google.maps.Polyline({ // set desired options for color, opacity, width, etc. strokeColor:"#0000FF", // blue (RRGGBB, R=red, G=green, B=blue) strokeOpacity: 0.4 // opacity of line }); // create the polyline (global) var path = []; // global variable...

Get coordinates of multiple touches in Swift

ios,swift,coordinates

the given touches argument is a set of detected touches. You only see one touch because you select one of the touches with : touches.anyObject() // Selects a random object (touch) from the set In order to get all touches iterate the given set for obj in touches.allObjects { let...

expanding a square openCV

java,opencv,coordinates

Rect temp = Rect(0,0); This line should be Rect temp = new Rect(0,0); Actually this shouldn't even compile. Just use Rect temp = new Rect(); ...

Determining a admissible heuristic (coordinate graph)

graph,coordinates,heuristics

Assuming you are in a grid world where the only allowed movements are N,S,W,E (or adiacent cells in general) yes. The Manhattan distance would be the true cost (and even the best heuristic!) SLD would of course be smaller but also less informative than MHD that represents h*. In case...

Co-ordinate of touch location is zero

swift,sprite-kit,coordinates

Convert whatever the location object is returning for variables x and y to a Float if you want to print the coordinates using NSLog with the %f formatter. NSLog("position x %f and y %f", Float(location.x), Float(location.y)) If you aren't dead set on using NSLog, you can also do what Okapi...

Change matrix/raster coordinates on R

r,matrix,coordinates,raster

Using the raster package is the right intuition but when you instantiate it with just the matrix it doesn't get the extents accurately. This will do it: library(raster) r <- raster(nrow=360,ncol=720,vals=matrix) plot(r) raster will initialize a raster object with (by default), world boundaries. You can optionally specify the coordinate reference...

Speed up looping code for coordinate conversion

r,loops,coordinates

Best thing is to vectorize operations instead of using loop. You can do: transform(x, utm_x=gx*cos(-0.031989084) - gy*sin(-0.031989084) + 625774 , utm_y=gx*sin(-0.031989084) + gy*cos(-0.031989084) + 1011776) # tag gx gy utm_x utm_y #1 2 994.1 488.3 626783.2 1012232 #2 4 990.5 488.9 626779.6 1012233 #3 6 993.5 498.3 626782.9 1012242 #4...

Calculating real world co-ordinates using stereo images in Python and OpenCV

python,opencv,computer-vision,coordinates,stereo-3d

1) Case of no rotation, only translation parallel to the horizontal axis of the image plane, cameras with equal focal lengths. Denote with "f" the common focal length. Denote with "b" the baseline of the stereo pair, namely the distance between the cameras' optical centers. Given a 3D point P,...

Drawing a Line - Maximum Point

java,2d,line,coordinates

There's probably a simpler way, but basically, you can calculate two points on a circle based on the angle and the inverse of the angle (angle - 360) With a circle with a radius of 150, this will give you a line of 300, for example The red line is...

What is the drawback of storing latitude/longitude as integer in mysql?

mysql,optimization,coordinates

You are not likely to achieve a search performance improvement from either partitioning the table or changing the datatype of your lat/lon from FLOAT to INTEGER. Why not? The amount of data stored is the same for FLOAT and INTEGER: 32 bits. FLOAT gives plenty of precision for GPS-resolution data....

Lookup algorithm that returns regions?

java,algorithm,coordinates,quadtree

The data structure you need is called an R-Tree. Most RTrees permit a "Within" or "Intersection" query, which will return any geographic area containing or overlapping a given region, see, e.g. wikipedia. There is no reason that you cannot build your own R-Tree, its just a variant on a balanced...

Python: how to get coordinates on mouse click using matplotlib.canvas

python,matplotlib,coordinates

Your code works for me, as long as I insert plt.show() after mpl_connect in getCoord: def getCoord(self): fig = plt.figure() ax = fig.add_subplot(111) plt.imshow(self.img) cid = fig.canvas.mpl_connect('button_press_event', self.__onclick__) plt.show() return self.point ...

why is “+” added to all my coordinates in url builder?

java,string,url,format,coordinates

In your getCoordsLists() method you are joining the collectors with ", " thats why, after building the url it is adding spaces after every coordinate. so just replace the ", " with "," in the following line: String list = "( " + alternative.coords.stream().map(item -> String.format("%.4f , %.4f", item.x, item.y))...

Plotting Graph from Json Data using GraphView Library android

android,json,plot,coordinates,android-graphview

try something like this GraphView.GraphViewData[] recordGraphData=new GraphView.GraphViewData[records.size()]; for(int i=0; i<records.size();i++) { recordGraphData[i]=new GraphView.GraphViewData(i,records.get(i).get(1)); } graphView.addSeries(new GraphViewSeries(recordsGraphData)); ...

ggvis input_select on scale_numeric trans parameter

coordinates,transform,ggvis

According to the ggvis documentation it's only possible to modify the data of a plot with interactive controls (e.g. props) and not the underlying plot specification (e.g. scales). It's possible to use Shiny to achieve what you're trying to do though, for example: library(shiny) library(ggvis) data.example=data.frame( "V1"=c(rep("A",times=10),rep("B",times=10)), "V2"=c(runif(10,1,10000),runif(10,100,1000)) ) shinyApp(...

How to get mouse position in the same place with different resolutions

java,coordinates,screen-resolution,java-2d,mouselistener

the best way would be to not work with pixel coordinates but with percent coordinates. on the screenshot, your board has a top offset and a left offset, as well as a width and a height. for the current mouse x position, subtract the left offset and divide by the...

Coffeescript single co-ordinate of turtle

coffeescript,coordinates

Figured out the answer myself, inspired by '@mu is too short'. Basiclly, this is the code: jumpto -500,50 [co_x,co_y]=getxy() write co_x write co_y I assume that Coffeescript figures out the co-ords are two pieces of data, and splits it between the two variables, as opposed to cramming them both into...

Update custom annotation pin image to standard annotation pin in swift

ios,swift,annotations,mapkit,coordinates

I have solved my problem by creating custom annotation class like below - import UIKit import MapKit var ARROW_ANNOTATION : NSString = "ARROW_ANNOTATION" var PIN_ANNOTATION : NSString = "PIN_ANNOTATION" class Annotation: NSObject, MKAnnotation { var currentLocation: CLLocationCoordinate2D var _title : String var subTitle : String var direction : CLLocationDirection! var...

Have 2D sprite face 3d camera

javascript,c#,unity3d,sprite,coordinates

This is called billboarding (language is c#) : public class LookAtCamera : MonoBehaviour { public Camera cameraToLookAt; void Update() { transform.LookAt(cameraToLookAt.transform); } } this will orientate any game object to face the camera. Other way to do what you want is to create a prefab/s for the sprites with the...

Coordinate (x,y) list to be sort with a spiral algorithm

php,sorting,coordinates,spiral

Algorithm design First, free your mind and don't think of a spiral! :-) Then, let's formulate the algorithms constraints (let's use the salesman's perspective): I am currently in a city and am looking where to go next. I'll have to find a city: where I have not been before that...

wxpython tooltip at specific coordinates

wxpython,tooltip,coordinates,paint

You should try BalloonTip http://wxpython.org/Phoenix/docs/html/lib.agw.balloontip.html It creates a new Frame for the tooltip and sets it according to coordinates of the object....

extracting coordinates from polygon r

r,coordinates,s4,slots,sp

Are you sure? They look the same (only posting as an "answer" since it's too long for a comment): library(sp) Sr1 <- Polygon(cbind(c(2, 4, 4, 1, 2), c(2, 3, 5, 4, 2))) Sr2 <- Polygon(cbind(c(5, 4, 2, 5), c(2, 3, 2, 2))) Srs1 <- Polygons(list(Sr1), "s1") Srs2 <- Polygons(list(Sr2), "s2")...

How to sort floating point coordinates with no elimination of coordinates? [closed]

c#,sorting,floating-point,coordinates,grahams-scan

This is what i wrote and it worked for all the cases finally. Let me admit it can be improved for performance and this might be a quick and dirty way but this what i am using at the moment. P.S: I also admit that "Convex Hull" or "Graham Scan"...

How to get pixel coordinates from canvas polygon (filled area)

javascript,html5,google-maps,canvas,coordinates

What you need is reverse processing. You can simply iterate canvas and create index and related RGBA values by following formula and compare with filled color. var index = (x + y * imageData.width) * 4; sample execution is as follow: var imageData = ctx.getImageData(0, 0,canvas.width, canvas.height); var data =...

How could I compare two data sets of X,Y coordinates to look for similarities?

javascript,authentication,comparison,coordinates,gesture-recognition

Reading about handwriting recognition software it seems that the early phases such a recognising the strokes might be helpful. Decompose the gesture into a number of elements (lines or curves) then apply some matching algorithms.

Distance between two coordinates in 3D space of a prism

c,3d,coordinates,distance

This is what you could to to decrease your headache with so many variables: Create a structure to group all 3 coordinates of a point create and array for your points Like this: struct Point3 { double x, y, z; }; // <-- the semocolon (;) is mandatory here //...

Matlab: 3D Surface Plot of values from own vectors

matlab,plot,coordinates

Managed to solve the problem. As mentioned, the data was not uniform and because of that, surfwas jumping from one end of the plot to the other, creating a total mess. Solved it by organising the values linearly using linspaceand then using those values to create the meshgrid and then...

python from list of tuples, get tuple closest to a given value

python,list,tuples,coordinates

For your data cooList = [(11.6702634, 72.313323), (31.67342698, 78.465323)] coordinate = (11.6702698, 78.113323) the shortest Pythonic answer is: nearest = min(cooList, key=lambda x: distance(x, coordinate)) with a function distance(a, b) returning the distance between the points a and b as a float, which you have to define yourself. Now you...

Windows Forms Chart: Get mouse cursor coordinates in Chart axis scale?

winforms,charts,onclick,position,coordinates

Yep, there is a civilized way of doing that if I understand your question correctly. You can use the Axis.PixelPositionToValue method to do just that. E.g. (in C#) chart.ChartAreas[0].AxisX.PixelPositionToValue(pt.X) chart.ChartAreas[0].AxisY.PixelPositionToValue(pt.Y) ...

Find an angle representing the direction of travel from origin coordinates

java,canvas,javafx,coordinates,coordinate-systems

// calc the deltas as next minus current double delta_x = next.xPos - current.xPos; double delta_y = next.yPos - current.yPos; // Calc the angle IN RADIANS using the atan2 double theta = Math.atan2(delta_y, delta_x); // this.angle is now in degrees // or leave off *180/Math.PI if you want radians this.angle...

2D to 3D coordinates conversion

3d,2d,webgl,coordinates,computational-geometry

If i understand your problem correctly, what you need to do is: Convert your points into 3D points: A(2,2,0), B(4,2,0), C(4,6,0), D(2,0,0) Get "duplicate" points with a height: E(2,2,1), F(4,2,1), G(4,6,1), H(2,0,1) Create triangles from those points: (there might be mistakes in this example) Front side: E EF AB B...

Why don;t the height and the width of this frame increase?

animation,swift,height,width,coordinates

Check out here the answer: http://stackoverflow.com/a/28029425/1135714 This answer solved my issue....

Not allowing Google Maps api to place a marker more than once

javascript,html,google-maps,google-maps-api-3,coordinates

Use lastCoordinates as an object, store for each coordinate a property in the object with a name based on the coordinate, e.g. x+'_'+y; Before you create a marker check if lastCoordinates already contains a property with the particular name: var lastCoordinates={}; function gotdata(){ if (xmlhttp.readyState == 4){ var d =...

Coordinates of a JTextPane to make a Screenshot in Java

java,swing,coordinates,screenshot,jtextpane

When you call getX() and getY() on any Swing component, you get the x and y relative to the component's container, not the screen. Instead you want the location of the component relative to the screen and get position based on that via getLocationOnScreen() Point p = txtCodigo.getLocationOnScreen(); int x...

How to make and access global variables in Objective-C

objective-c,global-variables,coordinates

The easiest way to do this would probably be by using a singleton. You can create a new singleton class that is then accessed from anywhere in your app. So you might create CoordinateManager or something and then use this to handle location coordinates you want to be global. E.g....

OpenGL iOS screen coordinates to scene coordinates

ios,objective-c,opengl-es,coordinates,glkit

You can't read the z buffer on OpenGL ES. When I've needed to do this kind of 3D hit testing I've projected a 3d line through the scene and done the hit-testing myself. For OpenGL on Retina devices you need to multiply x and y by the scale. To support...

Trouble using fscanf to read coordinates in C

c,segmentation-fault,coordinates,fscanf

@Weather Vane well answered the major issue. Below are additional points. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { // Check argc if (argc < 1) Print_Error_And Quit(); int n = atoi(argv[1]); FILE *fp; fp = fopen("data.dat","r"); if (fp == NULL) { perror("Error"); } int number; char str[3];...

get nearest coordinate from sqlite database

sqlite,coordinates,distance

SQLite has no square root function, but for comparing distances, we can just as well use the square of the distance: SELECT * FROM MyTable ORDER BY min((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0), (x2-x0)*(x2-x0) + (y2-y0)*(y2-y0)) LIMIT 1 ...

Rotate line segment with Button

math,javafx,geometry,coordinates

You can use the Math.atan2(dy, dx) to get the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). Later use it to convert it to degrees. import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.scene.shape.Line; import javafx.stage.Stage; public class Main extends Application {...

Convert Grid square numbers to coordanates

javascript,arrays,grid,coordinates,converter

Just calculate the division and the module of that number by the array length: 6 / 4 = 1 (6 % 4)-1 = 1 Remember that arrays start at 0, so the 6th position is (1, 1) [][][][] [][^][][] [][][][] [][][][] ...

Only show results within range chosen by user

php,html,mysql,database,coordinates

If you have an mySQL database, look to these questions, they deal with the same problem. Mysql within distance query http://gis.stackexchange.com/questions/31628/find-points-within-a-distance-using-mysql You need to create a SQL statement where all your coordinates within a certain distance are the results. It may look like: SELECT *, ( 3959 * acos( cos(...

Position of Leap point not in sync with THREEJS Scene

3d,three.js,coordinates,leap-motion

Finally fixed it thanks to Peter's last example. It was Test 3 that helped me find out the issue. The problem actually was that I seem to have been using a different 'scene' (variable aptly named) than the scene that the rigged hand was using. I didn't realize they were...

R maps - Filter coordinates out when plotting points in map

r,maps,coordinates

assign polygon map to an object: m = getMap(resolution="low") convert events into an sp object -- first longitude, then latitude: pts = SpatialPoints(events[c(2,1)]) assign CRS: proj4string(pts) = proj4string(m) plot points inside any of the polygons: points(pts[m,], pch = 3) select points inside Italy: it = m[m$ISO_A2 == "IT",] points(pts[it,], col...

Matplotlib: Find a region on a graph by mouse click

python,matplotlib,coordinates,mouse,intervals

There are some built in tools to provide blocking mouse input (see plt.ginput). The other option is to roll your own. The easiest way to do this is to make a helper class to store the clicked values: class ClickKeeper(object): def __init__(self): self.last_point = None def on_click(self, event): self.last_point =...

How to convert MTM (canada) coordinates to latitude and longitude

google-maps,coordinates

I found how to do it. If you know how to convert UTM (Equations for UTM conversion to WGS84(lat,long) are here http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system#Locating_a_position_using_UTM_coordinates) to WGS84 latitude, longitude, you can convert MTM. MTM is like UTM but more precise, the zones are 3° large insted of 6° for UTM, the scaleTM is...

Inverse Distance Weighting in R

r,csv,coordinates,interpolation

Well, based on your summaries the range of x is 0.02 and the range of y is 0.01. However, in your expand.grid call you ask for sequences from the min to the max with a step size of 3.5. So your seq calls will return 1 value each, and your...

Move a whole enemy object to a new point

c#,unity3d,coordinates,unity3d-2dtools

C# is case-sensitive, meaning that update and Update are not the same. Unity looks for a method called Update to call each frame, and your update method doesn't match. Just capitalize that U and you should be good to go!...

How to find a corner in a list of coordinates?

python,coordinates

Another option is to pass a key function to max: >>> max(enumerate(dq), key=lambda x: (x[1][1], -x[1][0])) (11, (410, -410)) >>> idx, maxval = max(enumerate(dq), key=lambda x: (x[1][1], -x[1][0])) >>> idx 11 Here, where we're working with numbers, we can use the sign-flip trick to exchange min and max....

Is it possible to get real time coordinates of an ImageView while it is in Translate animation?

android,imageview,coordinates,translate-animation

Here's a complete example based on what user3249477 and Vikram said: final TextView positionTextView = (TextView)findViewById(R.id.positionTextView); ImageView myimage = (ImageView)findViewById(R.id.imageView); ObjectAnimator translateXAnimation= ObjectAnimator.ofFloat(myimage, "translationX", 0f, 100f); ObjectAnimator translateYAnimation= ObjectAnimator.ofFloat(myimage, "translationY", 0f, 100f); translateXAnimation.setRepeatCount(ValueAnimator.INFINITE); translateYAnimation.setRepeatCount(ValueAnimator.INFINITE); AnimatorSet...

Find the coords of the 90° angle of a right triangle [closed]

math,geometry,coordinates,trigonometry

If the given angle is φ, try: cx = ((ax-bx)*COS(2φ)+(by-ay)*SIN(2φ)-ax-bx)/2 cy = ((ay-by)*COS(2φ)+(ax-bx)*SIN(2φ)-ay-by)/2 Why? I calculated the coordinates of the mirror of B about the black line and defined C as the midpoint between B and its mirror. The rest is trig. Example: [ax,ay] = [7,1] [bx,by] = [6,4] φ...

How do I increase or decrease the size of a button in Swift?

ios,animation,swift,coordinates

use UIViewAnimationOptions.Repeat and UIViewAnimationOptions.Autoreverse together to do that. You just have to set one frame change inside the animation block. You cannot have more than one state change to the same property inside an animation block. UIView.animateWithDuration(1.0, delay: 0.6, options: UIViewAnimationOptions.Repeat | UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.AllowUserInteraction, animations: { println("Animation function animateStuff()...

android get actual image coordinates from an extended imageview after zoom and pan

java,android,imageview,zoom,coordinates

I managed to solve my issue by using the Mike Ortiz TouchImageView the code I used to map the coordinates to the original bitmap is this: private PointF mapBeginCoordinates(PointF beginCoordinate, PointF endCoordinate) { //TODO we only have one aspect ratio for the current picture, so we should remove redundancy float...

Getting Mouse Coordinates of each click

javascript,mouse,coordinates

you can get mouse Coordinates with very simple math. Are you going to attach event handler to image tag? If that is the case, you can copy below code. I understand you would be very frustrated if you don't have understanding of javascript events, DOM model, etc. It is not...

Assigning variable in for loop to the x coordinate of each point in an arraylist

android,for-loop,arraylist,coordinates,variable-assignment

If I've understood you correctly, your for loop needs to look something like for (int i = 0; i<mPoints.size(); i++) { float xi = mPoints.get(i).x; float yi = mPoints.get(i).y; System.out.println("Point " + i + " y: " + yi); System.out.println("Point " + i + " x: " + xi); }...

Plot points at a specific height from an existing 3D plot/data set

matlab,plot,coordinates

If I am interpreting your question correctly, you wish to isolate out points in your matrix that match a particular z coordinate. Failing an exact match, you wish to find the closest z coordinate to your desired query. Also, since your data is stored in a 3 x 1088 matrix,...

How do I calculate the coordinates of the points of an helix?

java,math,geometry,coordinates,helix

Helix is circular shape with progressive Y value. // Start point private double x; private double y; private double z; private double degree; private double rY; @Override public void run() { // We use the same formula that is used to find a point of a circumference double rX =...

Project array content with mongodb

arrays,mongodb,mongoose,coordinates,geospatial

You need to do an $unwind operator on the Location array first in your aggregation pipeline, then $group the resulting documents to apply the accumulator expressions $first and $last. Your aggregation pipeline should look like this (untested): db.foo.aggregate([ { "$unwind": "$location" }, { "$group": { "_id": "$_id", "longitude": { "$first":...

iTextSharp - Table in absolute coordinates

c#,table,itextsharp,coordinates,absolute

You have several errors in your code. When you add a table at absolute positions, it is forbidden to use BeginText() and EndText() as that would cause nested text objects. As explained in ISO-32000-1, you can not next BT/ET sequences and that's exactly what will happen if your table contains...

Loop structure for adding up coordinates in an array

javascript,arrays,loops,geolocation,coordinates

There are several ways, I would do it like this: int sum(int[] array) { int sum = 0; for(int i = 0; i < array.size(); i++) { sum += distance(array[i], array[i+1], array[i+2], array[i+3]); i +=4; } return sum; } ...

How do I calculate the distances between a varied location and fixed coordinates?

matlab,grid,coordinates,distance

Please check the following code. Since as per your information both A and DC positions are not fixed, I assumed A as fixed for the moment. Let me know if it does not suite your requirement. clear all; s1 = [100 20]; s2 = [20 150]; s3 = [50 450];...

How to set coordinates for sprite correctly in Phaser?

jquery,coordinates,phaser-framework,phaser

First, if you want to position your button according to the game size, you should probably use game.width/game.height which are more reliable. Now if you want to adapt your button's position according to the screen size, there's no magic solution. Here's a generic article about the topic for instance. You...

How do you convert from AltAz coordinates to equatorial coordinates in Astropy

python,coordinates,astropy

I don't know much about astronomy, but it seems like there's plenty of documentation: transforming between coordinates full API docs for coordinates For me, cAltAz.icrs works and returns the original c. I needed to tweak a bunch of stuff to make it work on newAltAzcoordiantes (need to define x, stop...

Drawing to the left of x,y coordinates

qt,drawing,coordinates,qml,qt-quick

You can not use negative values for this purpose since negative width or height is not supported in QML. But you can use Scale type to accomplish this : Rectangle { id: rectangle1 x: 257 y: 221 width: 50 height: 50 color: "#000000" transform: Scale { origin.x: 0; origin.y: 0;...

How to split list of (X,Y) coordinates of path into seperate list of X and Y coordinates?

python,python-2.7,split,coordinates,instance

You can transpose and map the tuples to lists or use map and itemgetter. from operator import itemgetter l = [(4, 4), (4, 5), (4, 6), (4, 7), (4, 8), (3, 8), (2, 8), (1, 8), (1, 9)] a,b = map(itemgetter(0),l), map(itemgetter(1),l) print(a,b) a,b = map(list,zip(*l)) print(a,b) [4, 4, 4,...

Draw SVG image on paths but as big as needed

javascript,svg,d3.js,coordinates,topojson

The solution is pretty easy. The size of the picture was just not correctly set. Also the userSpaceOnUse needs to be deleted and if needed you can set the creation position with x and y: svgimage.append("pattern") .attr("id","p1") .attr("width","10") .attr("height","10") .append("image") .attr("xlink:href", "pics/point.jpg" ) .attr("width", 5) .attr("height", 5) .attr("x", 1) .attr("y",...

Create and remove image at certain coordinates on android

android,layout,imageview,coordinates

You can create a ImageView programmatically with ImageView iv = new ImageView(context); Then you have to set the LayoutParameters for the view. If you plan to add the view to a RelativeLayout you must use RelayiveLayout.LayoutParams. So you can have to do the same as you know from xml: add...

Get SVG-Object_s at given coordinates?

svg,coordinates

There's document.elementFromPoint method, but it only returns the topmost element. To get all the elements under a point you could find the topmost one, hide it and look at the point again until no more elements are there: var elementsAt = function( x, y ){ var elements = [], current...

Why won't this query return results that are 0?

mysql,coordinates

You're using incorrect syntax: Change HAVING to WHERE and use a subquery so you can refer to the alias of the calculation rather than having to repeat the formula: select * from ( select *, ( 3959 * acos( cos( radians($locationLatitude) ) * cos( radians( endingLatitude ) ) * cos(...

Using the mouseClicked method in the JMapViewer does not update the getPosition return value

java,coordinates,mouselistener,mouseclick-event,jmapviewer

As you have observed, getPosition() "Calculates the latitude/longitude coordinate of the center of the currently displayed map area." You probably want Coordinate getPosition(java.awt.Point mapPoint) which "Converts the relative pixel coordinate … into a latitude / longitude coordinate." You can call it in your implementation of JMapController, as shown here for...

Java - Capturing screenshot with screen coordinates

java,image,coordinates,screenshot,area

My bet is that you are using the constructor for Rectangle which accepts point coordinates and dimensions, and you are passing in two points coordinates.

Putting geolocation coordinates into array

javascript,html,arrays,geolocation,coordinates

If you want to use an array, don't use new Array(), use the array literal [] instead, and then we can just assign the whole thing in one go: var mapArray = [ position.coords.latitude, position.coords.longitude ]; But, since you already have that convenient position object, why not just rely on...

how to parse nested elements using XmlPullparser?

android,xml,xml-parsing,coordinates,android-xmlpullparser

There are two problems with your code. First, this won't work : if (tagname.equalsIgnoreCase("coordinates")) { frame.setCoordinates(Integer.parseInt(text)); } You must have either the same name as the xml tag or use tagname.contains("coordinates"). Second, x and y will always be equal to 0 because you are erasing the previous value with a...

Convert latitude and longitude to degree [duplicate]

c#,dictionary,coordinates

double lat = -86.0490143029144; double lon = -45.197069205344; string latDir = (lat >= 0 ? "N" : "S"); lat = Math.Abs(lat); double latMinPart = ((lat - Math.Truncate(lat) / 1) * 60); double latSecPart = ((latMinPart - Math.Truncate(latMinPart) / 1) * 60); string lonDir = (lon >= 0 ? "E"...

Find inside coordinates of polygon in tile based map

java,awt,coordinates,polygon,java-2d

I toyed around with the A* algorithm this week. There may be other solutions to your request, but since I already have the code, it was just a matter of adapting it to your needs. However, for your specific requirement you could also simply use a primitive flood-fill algorithm and...

Trying to move y coordinate

c#,unity3d,coordinates

You can't directly use transform.position.y to set a value for it. Instead Unity is asking that you use some temporary value or simply write as following - if (transform.position.y > 5.5f) { transform.position = new Vector3(transform.position.x, -10.0f, transform.position.z); } if (transform.position.y < -10.5f) { transform.position = new Vector3(transform.position.x, 5.0f, transform.position.z);...