geometry

Calculating the similarity of 2 sets of convex polygons?

点点圈 提交于 2021-02-11 12:20:01
问题 I have generated 2 sets of convex polygons from with different algorithms. Every polygon in each set is described by an array of coordinates[n_points, xy_coords], so a square is described by an array [4,2] but a pentagon with rounded corners has [80,2], with the extra 75 points being used to describe the curvatures. My goal is to quantify how similar the two sets of geometries are. Can anyone recommend any methods of doing so? So far I've come across: Hamming Distance Hausdorff distance I

Calculating the similarity of 2 sets of convex polygons?

安稳与你 提交于 2021-02-11 12:17:48
问题 I have generated 2 sets of convex polygons from with different algorithms. Every polygon in each set is described by an array of coordinates[n_points, xy_coords], so a square is described by an array [4,2] but a pentagon with rounded corners has [80,2], with the extra 75 points being used to describe the curvatures. My goal is to quantify how similar the two sets of geometries are. Can anyone recommend any methods of doing so? So far I've come across: Hamming Distance Hausdorff distance I

Scaling lengths in an AutoCAD diagram

人走茶凉 提交于 2021-02-11 12:08:36
问题 This is a followup to my previous post here I've a 2D geometry created using the following code, ref. (defun graph ( pts sls tls ) ( (lambda ( l ) (foreach x l (text (cdr x) (itoa (car x)) 0.0 1)) (mapcar '(lambda ( a b / p q r ) (setq p (cdr (assoc a l)) q (cdr (assoc b l)) r (angle p q) ) (entmake (list '(0 . "LINE") (cons 10 p) (cons 11 q) '(62 . 8))) (text (mapcar '(lambda ( x y ) (/ (+ x y) 2.0)) p q) (rtos (distance p q) 2) (if (and (< (* pi 0.5) r) (<= r (* pi 1.5))) (+ r pi) r) 2 ) )

what is wrong with this shapely error message

只谈情不闲聊 提交于 2021-02-11 06:32:21
问题 I have a dictionary called Rsize which have number-List as key-value pair. The dictionary is like this {10: [0.6621485767296484, 0.6610747762560114, 0.659607022086639, 0.6567761845867727, 0.6535392433801197, 0.6485977028504701, 0.6393024556394106, 0.6223866436257335, 0.5999232392636733, 0.5418403536642005, 0.4961461379219235, 0.4280278015788386, 0.35462315989740956, 0.2863017237662875, 0.2312185739351389, 0.18306363413831017], 12: [0.6638977494825118, 0.663295576452323, 0.662262804664348, 0

How to set panning limits on WPF Canvas based on zoom level?

时间秒杀一切 提交于 2021-02-10 20:48:14
问题 I'm trying to set zooming and panning limits on a control I found here: https://wpfextensions.codeplex.com I managed to set zooming limits, but now I'm having trouble setting the panning limits so that you can't pan the object inside the canvas, outside the view. I succeeded in setting the limits, but only when the zoom level is 1 ( Zoom == 1 , so no zoom), but the moment you increase the zoom (by rotating the mouse wheel) things start to go wrong : the limits are set, but they are not set

How to set panning limits on WPF Canvas based on zoom level?

落花浮王杯 提交于 2021-02-10 20:47:19
问题 I'm trying to set zooming and panning limits on a control I found here: https://wpfextensions.codeplex.com I managed to set zooming limits, but now I'm having trouble setting the panning limits so that you can't pan the object inside the canvas, outside the view. I succeeded in setting the limits, but only when the zoom level is 1 ( Zoom == 1 , so no zoom), but the moment you increase the zoom (by rotating the mouse wheel) things start to go wrong : the limits are set, but they are not set

Test intersection of two MULTIPOLYGONS based on year cycles in R

筅森魡賤 提交于 2021-02-10 17:36:23
问题 I have two multipolygons and I want to test intersections between their geometries based on groups of years. Basically I have a flood multipolygon that contains flood events and their geometry and an election dataset which has each election as ward*year units, containing the geometry of that ward. I want to see if there are any intersections in the electoral ward each cycle prior to each election. So if the election was in 2009 and the cycle was 2007-2009 I want to see if its ward was flooded

How to map rectangle image to quadrilateral with PIL?

倾然丶 夕夏残阳落幕 提交于 2021-02-10 13:18:11
问题 Python PIL library allows me to map any quadrilateral in an image to rectangle using im.transform(size, QUAD, data) What I need is a function that does the opposite, i.e. map a rectangular image to specified quadrilateral. I figured this might be achieved with the above mentioned function like this: I.e. I would find such quad (the red one in the image) that would, using the function im.transform(size, QUAD, data) transform the image to quad I want. The problem is I don't know how to find the

Volume of 3d shape using numerical integration with scipy

限于喜欢 提交于 2021-02-10 08:45:36
问题 I have written a function for computing volume of intersection of a cube and a half-space and now I'm writing tests for it. I've tried computing the volume numerically like this: integral = scipy.integrate.tplquad(lambda z, y, x: int(Vector(x, y, z).dot(normal) < distance), -0.5, 0.5, lambda x: -0.5, lambda x: 0.5, lambda x, y: -0.5, lambda x, y: 0.5, epsabs=1e-5, epsrel=1e-5) ... basically I integrate over the whole cube and each point gets value 1 or 0 based on if it is inside the half

Companion to hypot()

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 13:11:18
问题 The hypot function, introduced into C in the 1999 revision of the language, calculates the hypotenuse of a right triangle given the other sides as arguments, but with care taken to avoid the over/underflow which would result from the naive implementation as double hypot(double a, double b) { return sqrt(a*a + b*b); } I find myself with the need for companion functionality: given a side and the hypotenuse of a triangle, find the third side (avoiding under/overflow). I can think of a few ways