computational-geometry

Converting coordinates to WGS84

允我心安 提交于 2020-01-03 02:48:11
问题 I have the following function which plots a Circle given the centroid, but I want the coordinates to be In WGS84. var coords = new List<Tuple<double, double>>(); const double EARTH_RADIUS_NM = 3437.670013352; var lat = (latIn * Math.PI) / 180; var lon = (lonIn * Math.PI) / 180; double d = radiusIn / EARTH_RADIUS_NM; for (int x = 0; x <= 360; x++) { double brng = (x * Math.PI) / 180; var latRadians = Math.Asin(Math.Sin(lat) * Math.Cos(d) + Math.Cos(lat) * Math.Sin(d) * Math.Cos(brng)); var

Is there an algorithm to find nearby points using only polar coordinates?

限于喜欢 提交于 2020-01-02 04:54:45
问题 Suppose I have a vector of points as polar coordinates. Suppose one of those points acts as a probe for which I want to find all the other points within a certain distance. Is there an algorithm to do this without converting them to Cartesian form? 回答1: You are looking for the distance for polar coordinates. You can find the formula in this link. The distance between points (r1, a1) and (r2, a2) is: D = sqrt(r1*r1 + r2*r2 - 2*r1*r2*cos(a1-a2)) 回答2: Be careful, if you plan to scale up your

Transforming coordinates of one rectangle to another rectangle

荒凉一梦 提交于 2020-01-02 04:06:11
问题 in the above image I have shown two rectangles rectangle 1 whose x can vary from -900 to 13700 and Y can vary from -600 to 6458 rectangle 2 whose coordinate X can vary from 0 to 3000 and y can vary from 0 to 2000 Also: rectangle 2 has its starting point at left top position(0,0) whereas rectangle 1 has starting point( width/2, height/2). What I need to do : to convert a point of rectangle 1 to point of rectangle 2 using scaling or translation. So, what should be scaling factor for x and y

3D Connected Points Labeling based on Euclidean distances

流过昼夜 提交于 2020-01-01 16:33:12
问题 Currently, I am working on a project that is trying to group 3d points from a dataset by specifying connectivity as a minimum euclidean distance. My algorithm right now is simply a 3d adaptation of the naive flood fill. size_t PointSegmenter::growRegion(size_t & seed, size_t segNumber) { size_t numPointsLabeled = 0; //alias for points to avoid retyping vector<Point3d> & points = _img.points; deque<size_t> ptQueue; ptQueue.push_back(seed); points[seed].setLabel(segNumber); while (!ptQueue

Algorithm to find all convex quadrilaterals from the given list of 2d points

依然范特西╮ 提交于 2020-01-01 09:16:13
问题 I have to make a program to find all convex quadrilaterals from the given list of 2d points. I have tried it with vector cross product but it doesn't seem to be a correct solution. Maybe there is some effective algorithm to this problem but I can not find it. This is an example case with inputs and outputs: Input Number of Points: 6 coordinates of points (x,y): 0 0 0 1 1 0 1 1 2 0 2 1 Output Number of convex quadrilaterals: 9 回答1: A quadrilateral is convex if its diagonals intersect.

Is it possible generate normal map from heightmap texture from math point of view?

回眸只為那壹抹淺笑 提交于 2020-01-01 07:21:30
问题 My view is that you can not generate normal map only from height map texture? Am I right or not? Math Arguments: Assume that surface is given a continuous bijection from S = [0,1] T = [0,1] Let's call SxT as image space. It can be proved from differentional geometry that normal to that parametric surface is If assume that mapping from SxT image space to geometric euclidian space is very simple then we can retrive: Then you can calculate such partial derivatives with some difference scheme. We

Merging and splitting overlapping rectangles to produce non-overlapping ones

余生长醉 提交于 2020-01-01 07:02:29
问题 I am looking for an algorithm as follows: Given a set of possibly overlapping rectangles (All of which are "not rotated", can be uniformly represented as (left,top,right,bottom) tuplets, etc...), it returns a minimal set of (non-rotated) non-overlapping rectangles, that occupy the same area. It seems simple enough at first glance, but prooves to be tricky (at least to be done efficiently). Are there some known methods for this/ideas/pointers? Methods for not necessarily minimal, but

Algorithm for finding the segment overlapping two collinear segments

a 夏天 提交于 2020-01-01 05:20:35
问题 UPDATES My original implementation in C# My final implementation in C#, based on the answers I got. Given the following conditions, how can I programatically find the overlapping segment between two lines? Also, for a different slope: And for vertical lines: And for horizontal lines: Note: For all the quadrants ! I've started by coding all possible conditions but it gets ugly. public Line GetOverlap (Line line1, Line line2) { double line1X1 = line1.X1; double line1Y1 = line1.Y1; double

How to fill polygon with points regularly?

只谈情不闲聊 提交于 2020-01-01 03:36:12
问题 It is simple to fill rectangle: simply make some grid. But if polygon is unconditioned the task becomes not so trivial. Probably "regularly" can be formulated as distance between each other point would be: R ± alpha. But I'm not sure about this. Maybe there is some known algorithm to achieve this. Added: I need to generate net, where no large holes, and no big gathering of the points. 回答1: Have you though about using a force-directed layout of the points? Scatter a number of points randomly

Compute the Centroid of a 3D Planar Polygon

℡╲_俬逩灬. 提交于 2020-01-01 03:14:10
问题 This is a similar question to this one here. Given a list of 3D coordinates that define the surface( Point3D1 , Point3D2 , Point3D3 , and so on), how to calculate the centroid of the surface? In 2D the computation is given by the following formula: What about the 3D analogue? 回答1: If it's a planar surface, you can transform to a coordinate system local to the plane, calculate the centroid using the formulas you presented, and then transform back to get its coordinates in 3D space. 回答2: Just