polygon

Finding Solr documents that intersect with a defined Radius

回眸只為那壹抹淺笑 提交于 2020-01-07 00:36:15
问题 We are using Apache Solr 5.x, and we currently have a bunch of defined shapes. Polygons, Circles, etc. These all correspond to a document, each shape of coordinates does. What I want to know is - is it possible to provide a circle , that is - a (lat,lng) pair along with a Radius for that circle - and then find all documents that have an intersection with that circle? I have tried a variety of options, most recently this one: solr_index_wkt:"IsWithin(CIRCLE((149.39999999999998 -34.92 d=0

Wrong area calculation objective-c?

可紊 提交于 2020-01-06 23:50:25
问题 I have an array with 5 CGPoints (v0, v1, v2, v3, v4) which are the vertex of the shape implemented like this: _arrayVertex = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithCGPoint:v0], [NSValue valueWithCGPoint:v1], [NSValue valueWithCGPoint:v2], [NSValue valueWithCGPoint:v3], [NSValue valueWithCGPoint:v4], nil]; Then, I calculate the area with those points: - (float)calculateArea { float area = 0; int N = (int)_arrayVertex.count; for (int i = 0; i < N-1; i++) { float term = ([

OpenCV threshold with mask

こ雲淡風輕ζ 提交于 2020-01-06 16:20:56
问题 I'm trying to use OpenCV's cv::threshold function (more specific THRESH_OTSU ), only that I'd like to do it with a mask (any shape), so that the outside (background) is ignored during calculation. Image is single channel (as it must be), red color bellow is only to mark an example polygon on an image. I tried using adaptiveThreshold , but there are a couple of problems that make it inappropriate in my case. 回答1: In general, you can simply compute the threshold using cv::threshold , and then

Does this polyline pass through this polygon?

我只是一个虾纸丫 提交于 2020-01-06 14:34:29
问题 I’m trying to test whether a Google Maps polyline passes through a Google Maps polygon. Sounds simple. But I’ve searched and searched... and found no real answers. Closest I got was this function. It works but, frustratingly, returns the occasional false positive. //nvert = the number of points in the polygon //vertx = an array of all the polygon's latitudes //verty = an array of all the polygon's longitudes //elat = the current point's latitude //elng = the current point's longitude function

Techniques for drawing coplanar polygons in OpenGL

梦想的初衷 提交于 2020-01-06 07:13:44
问题 I'm going to have meshes with several coplanar polygons, all lying in a certain plane, that I'm not going to be able to eliminate. These polygons have a specific draw order. Some polygons are behind other polygons. If I turn off depth testing I'll have the effect I want, but I want to be able to position this mesh in a 3D scene. I do not trust glPolygonOffset because I'll potentially have several of these overlapping polygons and am am worried about the cumulative effects of the offset. 回答1:

Rotating a 3d polygon into xy-plane while maintaining orientation

我的未来我决定 提交于 2020-01-06 04:00:08
问题 I have a polygon oriented any way and positioned anywhere in 3d space. I need to transform the polygon into the xy-plane so that I can perform various operations on it (in particular generating a grid of points across the bounding box of the polygon) in 2d rather than 3d, then transform it back. The problem comes with the orientation of the transformed polygon. If I just wanted to rotate into the plane, I could take the angle between the polygon's normal and the xy-plane and rotate around an

A script to draw, fill and group triangles in Livecode?

梦想的初衷 提交于 2020-01-06 02:24:07
问题 Appreciate any help in coming up with a Livecode script chunk to draw and fill a group of equilateral triangles. I'm working on an open source app that helps people create and share stories with a fractal pattern. A key challenge is drawing triangles that will represent the following elements of a story: Attractor Challenge Opportunity (a state change to resolve the tension) Strategy Test Decision Each of the six standard story elements above will be displayed in the app as an equilateral

Find indices of polygon vertices nearest to a point

我的梦境 提交于 2020-01-06 01:25:17
问题 Heading I need to find the indices of the polygon nearest to a point So in this case the ouput would be 4 and 0. Such that if the red point is added I know to where to place the vertex in the array. Does anyone know where to start? (Sorry if the title is misleading, I wasnt sure how to phrase it properly) In this case the ouput would be 0 and 1, rather than the closest 4. 回答1: Point P lies on the segment AB , if two simple conditions are met together: AP x PB = 0 //cross product, vectors are

C# Forms - Using Paint methods?

Deadly 提交于 2020-01-05 12:58:20
问题 In c# forms I have created a new paint method: private void thisPolygon(PaintEventArgs e) { Pen clrBlue = new Pen(Color.Blue, 3); Point[] Wst = new Point[5]; Wst[0] = new Point(20, 350); Wst[1] = new Point(110, 200); Wst[2] = new Point(200, 190); Wst[3] = new Point(210, 275); Wst[4] = new Point(190, 400); Wst[5] = new Point(50, 390); e.Graphics.DrawPolygon(clrBlue, Wst); } Now, how do I call it? I can't make it work, this doesn't work: private void Form1_Load(object sender, EventArgs e) {

Point inside rotated 2D rectangle (not using translation, trig functions, or dot product)

廉价感情. 提交于 2020-01-05 08:37:10
问题 I was wondering if the following algorithm to check if a point is inside a rectangle is valid. I've developed it using my own intuition (no strong trig/math basis to support it), so I'd love to hear from someone with more experience in the matter. Context: The rectangle is defined with 4 points. It could be rotated. Coordinates are always positive. By definition, the point is considered inside the rectangle if intersects it. Hypothesis: Use the distance between the point and the rectangle