area

Algorithm for fitting 2D polygons in an area?

旧街凉风 提交于 2019-12-05 15:54:10
Is there a standard for this? Algorithm name? Say: I have 10 polygons of different sizes. I have an area of specific size. I want to know how to fill the most polygons in that area, and how they are fitted. Note: Polygons may be rotated depending on the restriction set. One possible name is a Packing Problem . It is related to the Knapsack Problem . These problems tend to be NP-hard, and many require heuristics. If you can constrain the allowed forms of polygons and of the area, there may exist a more efficient algorithm for your special case. You can have a look at "Dancing Links" in

gnuplot: fill area curve keeping tics on top

允我心安 提交于 2019-12-05 12:15:32
in gnuplot, when you try to fill an area under a curve, the tics of both axes are hinded behind the solid area. Is there any way to give them to the front? I am using postcript terminal, where no transparent features are allowed (i guess) Thanks There sure is! Before plotting, run this interactively or in a script: set tics front Try help tics interactively for more info. user3207862 After trying many options I realized that the following works properly: set tics front It seems important to write it before the plot command. ;-) 来源: https://stackoverflow.com/questions/21193547/gnuplot-fill-area

How to calculate an area of a Windows region (HRGN) in pixels?

独自空忆成欢 提交于 2019-12-05 11:57:45
What is the fastest way of getting the area of any arbitrary Windows region? I know I can enumerate all points of bounding rectangle and call the PtInRegion() function but it seems not very fast. Maybe you know some faster way? When you call GetRegionData , you'll get a list of non-overlapping rectangles that make up the region. Add up their areas, something like this: function GetRegionArea(rgn: HRgn): Cardinal; var x: DWord; Data: PRgnData; Header: PRgnDataHeader; Rects: PRect; Width, Height: Integer; i: Integer; begin x := GetRegionData(rgn, 0, nil); Win32Check(x <> 0); GetMem(Data, x); try

How Do I Calculate the Area of a Polygon in a MySQL Database When the Polygon's Points are Lat Longs?

痞子三分冷 提交于 2019-12-05 11:37:59
How do I calculate the area of a polygon stored in a MySql database? The polygons' points are lat longs. So, degrees and minutes seem to be causing a problem. I've tried: SELECT AREA( my_polygon ) FROM `my_table` WHERE name = 'Newport' Because, the points are lat longs, I get weird results. (I'm not able to switch to Postgre). Is there a way to do this in MySQL? I'd like to get the results in sq. meters or sq. km or sq. miles-- any of these would be fine. You've got to transform those lats and lons into a more appropriate coordinate system. Since the earth is a sphere, you're talking about

how to select the object with the largest area?

徘徊边缘 提交于 2019-12-05 08:06:59
I have used bwconvhull to detect a certain part of the image, as you can see in the image, there are number of objects with certain centroids. What I want to do is to detect the object with the largest area (1st big one from the left) and neglect the others. Which method should I follow? I will be very thankful for your help. The following is the code (it's very roughly written as I am still working on it. Sorry for any inconvenience in advance) CH_objects = bwconvhull(c,'objects'); imshow(CH_objects); title('Objects Convex Hull'); bwarea(CH_objects) Ilabel = bwlabel(CH_objects,8); stat =

Calculating the area of a confidence ellipse in a certain region of space

ぐ巨炮叔叔 提交于 2019-12-05 00:16:53
问题 I was wondering if someone had an idea on how to calculate the blue shaded area inside my confidence ellipse. Any suggestions or places to look are greatly appreciated. Also, I am hoping to find a general formula since the ellipse does not necessarily have to lie in that region in application (i.e., the ellipse could have been bigger). Here is my code for my picture if it helps: library(car) x = c(7,4,1) y = c(4,6,7) plot(x,y,xlim=c(0,10),ylim=c(0,10)) rect(x,y,max(x)+100000,max(y)+100000,col

Border-radius and :hover state area issue

放肆的年华 提交于 2019-12-04 19:17:07
I'm looking everywhere to answer this question but nowhere can I find anything about it. Can anyone tell me whether we can affect the area which received the item hover border-radius property. So that the effect of changes such as color took place after hitting a real area viewed item? Do not block that physically exists in the DOM as a square? This is simple img. and some simple fiddle: www.jsfiddle.net/nawAE Well, you can use SVG and pointer-events: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events?redirectlocale=en-US&redirectslug=CSS%2Fpointer-events Or just use SVG, maybe

Calculating an area under a continuous density plot

一世执手 提交于 2019-12-04 13:21:35
问题 I have two density curves plotted using this: Network <- Mydf$Networks quartiles <- quantile(Mydf$Avg.Position, probs=c(25,50,75)/100) density <- ggplot(Mydf, aes(x = Avg.Position, fill = Network)) d <- density + geom_density(alpha = 0.2) + xlim(1,11) + opts(title = "September 2010") + geom_vline(xintercept = quartiles, colour = "red") print(d) I'd like to compute the area under each curve for a given Avg.Position range. Sort of like pnorm for the normal curve. Any ideas? 回答1: Calculate the

Finding the area of intersection of multiple overlapping rectangles in Python

泄露秘密 提交于 2019-12-04 11:59:22
I tried to using the algorithm shown here: https://discuss.leetcode.com/topic/15733/my-java-solution-sum-of-areas-overlapped-area However, that algorithm only deals with finding the areas of only TWO overlapped rectangles. How would I go on about finding the area of the intersection of say 3, or 4 or 5, etc number of overlapping rectangles, if I know the length, breadth of each rectangle? benten Shapely is a good library for stuff like this. from shapely.geometry import box # make some rectangles (for demonstration purposes and intersect with each other) rect1 = box(0,0,5,2) rect2 = box(0.5,0

How to test if a point inside area with lat/lon and radius using Java?

扶醉桌前 提交于 2019-12-04 11:44:17
I've to write a method that has the following signature public class Position { double longitude; double latitude; } boolean isInsideTheArea(Position center, double radius, Position point); So if point is inside the area that has the center as its center and radius as its radius in miles , this should return true , false otherwise. Use the Haversine formula to compute the distance between center and point . If that distance is greater than radius , return false ; otherwise return true . Pseudocode: def haversineDistance(a, b): # snip... return foo def isInsideTheArea (center, radius, point):