Why do I get the same output each time? Because you're not overriding the toString method. The value you're seeing is java's implementation of toString. Every object has this behavior. Put this method in your point class to override java's toString implementation. @Override public String toString(){ return "("+x+", "+y+")"; }...

Yes, there's a much better approach. For this and many other topological operations, the rgeos package has you well covered. Here, you're wanting rgeos::gWithin(): ## Required packages library(rgdal) library(raster) ## For example polygon & functions used to make example points library(rgeos) ## Reproducible example poly <- readOGR(system.file("external", package="raster"), "lux")[1,] points...

function,vector,gnuplot,points

I'm not completely sure, what the real problem is, but I think you cannot rely on the columns in the using statement to be evaluated from left to right, and your check $0 > 0 in the dx and dy some too late in my opinion. I usually put all...

The code first takes the nearest point to (0, 0) at the '0' index then start sorting the points by distance from the last spotted point.. C#: List<Point> SortByDistance(List<Point> lst) { List<Point> output = new List<Point>(); output.Add(lst[NearestPoint(new Point(0, 0), lst)]); lst.Remove(output[0]); int x = 0; for (int i = 0;...

Based on your diagram and example, you want a rectangle with vertical and horizontal sides. If you look at your current example, all you did was take x1 and y2 for one of the points, and x2/y1 for the other point. So, given Points p1 and p2, you could do...

tan, sin, and cos are actually measuring the ratios between two edges of a 3-edged object aka a triangle. Hence in your case, to form that triangle, you will need the lengths of two edges. They are the lengths between y1 and y2, and x1 and x2. That is why...

python,matplotlib,graph,points

You can turn xcoordinate and xcoordinate into a list instead, and append random points in it. xcoordinate=[] ycoordinate=[] for i in range(int(n)): xcoordinate.append(random.random()) ycoordinate.append(random.random()) The rest of your code remains unchanged. ...

google-maps,google-maps-api-3,geojson,points

Surfing the web I found an example that I adapted to your needs. I hope you will be useful. <!DOCTYPE html> <html> <head> <title>Simple json test</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> </head> <body>...

c++,matrix,rotation,sfml,points

Using the SFML, you first create a transformation : sf::Transform rotation; rotation.rotate(10, centerOfRotationX, centerOfRotationY); Then you apply this transformation to the position of each vertex : sf::Vector2f positionAfterRotation = rotation.transformPoint(positionBeforeRotation); Sources : sf::Transform::rotate and sf::Transform::transformPoint....

You have capitalised the 'L' of LeftEar in the final line.

Here is some code to get you started. I basically implemented Depth First Search... a very crude implementation of it anyway. Depth First Search is an algorithm that is used for the traversal of trees. Graphs are essentially a special case of trees where there are leaf nodes that connect...

c++,arrays,interpolation,points,spline

I had to write a Bezier spline creation routine for an "entity" that was following a path in a game I am working on. I created a base class to handle a "SplineInterface" and the created two derived classes, one based on the classic spline technique (e.g. Sedgewick/Algorithms) an a...

All depends on whether you need to to write queries to get particular points. ie find me all the thingies with Points with an X < 300. If you don't have much relational stuff to do, and you are going down the blob route then you should consider one of...

vector,three.js,distance,points

Basically you need to get the direction vector between the two points (D), normalize it, and you'll use it for get the new point in the way: NewPoint = PointA + D*Length. You could use length normalized (0..1) or as an absolute value from 0 to length of the direction...

c++,algorithm,set,points,closest-points

In the original code, y coordinate is the first element of a pair. That's why points in a set are ordered correctly.

You must rearrange your data for the boxplots. The statistics are computed over complete columns. So, you must rearrange your data like: # 1.0 1.2 1.4 ... 2.2 2.2 3.06 2.0 2.46 2.93 2.2 2.46 3.06 2.0 2.4 2.8 1.73 2.33 2.8 Then you can plot it with: set style...

The formulation seems fine to me. Lets expand the expression R^2 = (Bx - Ax + R dy)^2 + (By - Ay - R dx)^2 this gives R^2 = Bx^2 + Ax^2 + R^2 dy^2 + 2 Bx R dy - 2 Ax Bx - 2 Ax R dy +...

matlab,image-processing,interpolation,contour,points

One intuitive approach (IMO) is to create an independent variable for both x and y. Base it on arc length, and interpolate on it. % close the contour, temporarily xc = [x(:); x(1)]; yc = [y(:); y(1)]; % current spacing may not be equally spaced dx = diff(xc); dy =...

Here is the recommended way to save a List<Point>. Point is Serializeable, so these few lines will do to save and load a List<Point> points: string yourPointsFile = "d:\\myPoints.xml"; XmlSerializer xmls = new XmlSerializer(typeof(List<Point>)); // save the points maybe when closing the program: using (Stream writer = new FileStream(yourPointsFile, FileMode.Create))...

java,object,encapsulation,points

The problem is you haven't actually created your getter and setter methods (specifically the getter methods). In Java, getter and setter methods aren't automatically created for you; you have to explicitly create them yourself. So, just add the following code: public double getX() { return x; } public void setX(double...

The problem is you're moving a linear number of items to close the gap. If that's necessary, you can't avoid the linear time requirement. However, if the order of the elements in the array isn't important, you could just move the last element directly into the gap. This means you're...

matlab,plot,filter,points,scatter

Alright, I'm guessing a lot, but we will see. First for the sake of completeness, your data (shortened): data = [... 211.312500 242.803571 5.000000 ... 362.387500 243.662500 7.000000 371.720000 279.490000 7.000000] Then you need to set a threshold, you suggested 1.5 I'd rather go for at least 3. thresh =...

Keep a counter variable that will hold the number of correct answers. Integer scoreCount = 0; //initial score if (answer == 16) { scoreCount += 1; //increase score count System.out.println("Correct! You now have " + scoreCount + " points"); //show latest score } ...

python,matplotlib,plot,lines,points

This is the line of problem: ... plt.plot(pair[0][0],pair[0][1],pair[1][0],pair[1][1],color='r',linewidth=2) ... You're trying to draw the referring to x,y,x1,y1, which in fact should be ((x, x1), (y, y1)). Correcting this seems working fine: def testPlot(): minx = miny = -1 maxx = maxy = 30 # some points randomly generated points =...

python,pandas,dataframes,points,spatial-query

Probably a better way, but since this has been sitting out there for awhile.. Using Pandas boolean indexing to filter the dfc data frame instead of np.where() def findGrid(dfp): c = dfc[(dfp['x'] > dfc['minx']) & (dfp['x'] < dfc['maxx']) & (dfp['y'] > dfc['miny']) & (dfp['y'] < dfc['maxy'])].Code if len(c) == 0:...

Assuming you are using the hexbin package... library(hexbin) library(grid) # some data from the ?hexbin help set.seed(101) x <- rnorm(10000) y <- rnorm(10000) z <- w <- -3:3 # hexbin bin <- hexbin(x, y) # plot - look at str(p) p <- plot(bin) # push plot viewport pushHexport(p$plot.vp) # add...

c,arrays,segmentation-fault,append,points

Probably you might have a bug in the if condition: if( pa->len < pa->reserved ) What you probably want is: if ( <there are no more free slots in the array> ) reallocate which translates to: if (pa->len >= pa->reserved) ... do the reallocation ...

android,graph,achartengine,points

Rather than using a line chart, use a scatter chart. Change: Intent intent = ChartFactory.getLineChartIntent(context, dataset, renderer,"Anesthesia Sheet"); To: Intent intent = ChartFactory.getScatterChartIntent(context, dataset, renderer,"Anesthesia Sheet"); I tried switching the line charts in my app to scatter charts and it worked as expected - the points were plotted with no...