point

Position on Screen Right Bottom

北战南征 提交于 2019-11-28 01:12:14
I need to position JFrame on my screen. But I can't make them appear on the right side of the screen bottom. Please can someone explain me how to position them, if you can describe how to do it, it would be great. Here is the code so far. //Gets the screen size and positions the frame left bottom of the screen GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); int x = (int)rect.getMinX(); int y = (int)rect.getMaxY()- frame.getHeight(); frame

Python Seaborn Distplot Y value corresponding to a given X value

ぐ巨炮叔叔 提交于 2019-11-27 22:46:35
问题 I need to plot points on a Seaborn distplot corresponding to certain X values such that they fall either on the density curve or below it. Here is a distplot from the following URL: From the Seaborn site - distplot examples Here is an image with the code: So for example, in the plot shown above, I need to determine programmatically what is the Y axis value corresponding to the X value of 0 that falls on the density curve. From the figure, it seems like it is somewhere around 0.37. How can I

Distance between point and a line (from two points)

荒凉一梦 提交于 2019-11-27 20:49:07
I'm using Python+Numpy (can maybe also use Scipy) and have three 2D points (P1, P2, P3); I am trying to get the distance from P3 perpendicular to a line drawn between P1 and P2. Let P1=(x1,y1) , P2=(x2,y2) and P3=(x3,y3) In vector notation this would be pretty easy, but I'm fairly new to python/numpy and can't get anythng that works (or even close). Any tips appreciated, thanks! Try using the norm function from numpy.linalg d = norm(np.cross(p2-p1, p1-p3))/norm(p2-p1) np.cross returns the z-coordinate of the cross product only for 2D vectors. So the first norm in the accepted answer is not

Point and ellipse (rotated) position test: algorithm

≯℡__Kan透↙ 提交于 2019-11-27 19:30:47
How to test if a point P = [xp,yp] is inside/outside some rotated ellipse given by the centre C=[x,y], a, b, and phi ( angle of rotation)? At this moment I am using the following solution: rotate ellipse and point by the angle -phi and then the common test for a position of the point and "non rotated" ellipse. But there are a lot of tested points (thousands) and I find this solution as slow. Is there any direct and more efficient way to get a position of the rotated ellipse and point? I do not need a code but the algorithm. Thanks for your help. Another option is just to throw everything into

Python: checking if point is inside a polygon

梦想的初衷 提交于 2019-11-27 17:27:15
I have a class describing a Point (has 2 coordinates x and y) and a class describing a Polygon which has a list of Points which correspond to corners (self.corners) I need to check if a Point is in a Polygon Here is the function that is supposed to check if the Point in in the Polygon. I am using the Ray Casting Method def in_me(self, point): result = False n = len(self.corners) p1x = int(self.corners[0].x) p1y = int(self.corners[0].y) for i in range(n+1): p2x = int(self.corners[i % n].x) p2y = int(self.corners[i % n].y) if point.y > min(p1y,p2y): if point.x <= max(p1x,p2x): if p1y != p2y:

How can I label points in this scatterplot?

匆匆过客 提交于 2019-11-27 17:23:25
Can you help me on putting labels on the following graph? The code i use is: valbanks<-scan("banks.txt", what=list(0,0,""), sep="", skip=1, comment.char="#") valbanks valj2007<-valbanks[[1]] valj2009<-valbanks[[2]] namebank<-valbanks[[3]] percent_losses<-(valj2009-valj2007)/valj2007 percent_losses abs_losses<-(valj2007-valj2009) abs_losses plot(abs_losses, percent_losses,main="Absolute Losses vs. Relative Losses(in%)",xlab="Losses (absolute, in miles of millions)",ylab="Losses relative (in % of January´2007 value",col="blue", pch = 19, cex = 1, lty = "solid", lwd = 2,text(percet_losses, abs

Create polygon from set of points distributed

折月煮酒 提交于 2019-11-27 16:55:11
问题 I need help on the R language from my code: inter1= read.table("C:/inter.csv", header=TRUE) inter1$xx<-inter1$long inter1$yy<-inter1$lat coordinates(inter1) = ~long + lat #Plot the results: plot(inter1) I had this plot : http://i.stack.imgur.com/98aTf.png I'm looking now for each set of points on the plot draw a polygon, I do not know the process i must prceder to get there, thank you for your help inter.csv: long lat var1.pred 1 4.2 19 31.8216045615229 2 4.3 19 31.913824396486 3 4.4 19 32

Gnuplot: How to make scatter plots with transparent points

人走茶凉 提交于 2019-11-27 14:47:41
问题 How can I plot an image with partial transparent scatter points just like in this picture with gnuplot? The problem is I don't know how to set the points to be transparent. 回答1: Try this: set style fill transparent solid 0.35 noborder set style circle radius 0.02 plot 'test' u 1:2 with circles lc rgb "blue", \ '' u 1:2 every 100 w circles lc rgb "red" fs solid 1.0 border lt -1 which outputs As you can see, you can specify for each data set whether to use transparency and which color to use.

Get polygons close to a lat,long in MySQL

我们两清 提交于 2019-11-27 14:31:06
Does anyone know of a way to fetch all polygons in a MySQL db within a given distance from a point? The actual distance is not that important since it's calculated for each found polygon later, but it would be a huge optimization to just do that calculation for the polygons that are "close". I've looked at the MBR and contains functions but the problem is that some of the polygons are not contained within a bounding box drawn around the point since they are very big, but some of their vertices are still close. Any suggestions? A slow version (without spatial indexes): SELECT * FROM mytable

Test of Point inside polygon in Android

末鹿安然 提交于 2019-11-27 14:08:30
The other day I did a class in Java to calculate if a point(X,Y) is inside a polygon. ( X and Y are double , because will be geo-coordinates). I know that Java has the class Polygon , but I had to use Path2D and Point2D , because Polygon don't allow double 's, just integers :( Once I have the polygon done in Path2D , I used the method contains ( Path2D had it), and my problem was solved. But now, I want to import to Android, and the problem is here, because Path2D needs to import: import java.awt.geom.Path2D; import java.awt.geom.Point2D; and in Android don't exist awt, so I can't use. So, is