point

c# - how to move point a given distance d (and get a new coordinates)

痴心易碎 提交于 2019-12-03 00:31:47
Hi I was wondering if there is any efficent way to calculating coordinates of point (which was moved distance d from it's original location). Let's say I have a point P(0.3,0.5) and I need to move that point random direction with distance d. So far I did it by random picking new x and y coordinates and I was checking if distance between old and new point equals d. I do realize that is't too eficient way to do that. How would You do it ?? Given a point (x1, y1) , we want to find a "random" point (x2, y2) at a distance d from it. Pick a random angle theta . Then: x2 = x1 + d * cos(theta) y2 = y1

Point in polygon

南笙酒味 提交于 2019-12-02 21:57:40
问题 I'm trying to do some SPOJ problem it's https://www.spoj.pl/problems/FSHEEP/ We have to find out if point is inside the polygon. As we see it's not convex polygon ( image from problem ). I was trying to solve it in O(n*m) time with Ray Casting algorithm described on wikipedia or any other site. But how to solve it in O(n log m ) ? So in other words how to check if point is in polygon in logarithmic time ? Cheers 回答1: Since this is a homework-esque problem, I'll give you homework-esque help.

Android, How can I rotate an arrow (image) around a fixed point?

让人想犯罪 __ 提交于 2019-12-02 21:13:12
I have an arrow image that I want to rotate from 0 to 180 degree (like the needle in a meter.) One point of the arrow is fixed in middle and at bottom of the screen and head of arrow should move. Length of arrow is fix (it is image). Also I have two buttons and I want arrow to turn left when button left is touched and turn right when right button is touched. What is the logic of this process? This is actually pretty simple if you are using a canvas to do your drawing(as you should in your case). Given that you know the coordinates for the point around which the image should rotate, you can do

How to find out Y coordinate of specific point in bezier curve in canvas?

依然范特西╮ 提交于 2019-12-02 21:04:13
I need to find out Y coordinate of specific point of bezier curve in canvas. Do you know, how to find it out? Thank you Using de Casteljau's algorithm you can find the coordinates x and y of a bezier curve for any t, the percentage or interpolation step. So a t of .1 would give you the x and y at 10% of the curve from the beginning. A t of .9 would be 90% from the beginning, and so on. In our cubic bezier we have p0 (point 0), cp0 (control point 0), cp1 (control point 1), and p1 (point 1). In the first step of the algorithm we draw a line connecting p0 and cp0, another line connecting cp0 and

Translating/transforming? list of points from its center with an offset/distance

心已入冬 提交于 2019-12-02 12:23:39
Well, I'm currently trying to move a list of points using its center as reference with a desired offset. But I'm having problems. I have implemented the current function: public static IEnumerable<Point> Translate(this IEnumerable<Vector2> points, float offset, Vector2 pivot) { foreach (Vector2 v in points) { float magnitude = (v - pivot).magnitude; Vector2 n = (v - pivot).normalized; Vector2 _v = n * (magnitude + offset) + pivot; yield return new Point(_v); } } Note: Point class is an own implementation very similar to System.Drawing.Point . I calculate the normal (the direction between the

jQuery - how to add mark to image

99封情书 提交于 2019-12-02 11:43:34
问题 I am thinking how to add some marks to an image (I mean something like in google maps - marks for places). I have an image and if the user will clicked to this image, co I want on that place, where user clicked, add some other image. For example, if the user will click on 3 places in image, I would like to add on this places 3 my images... I know, how to get the directions, where the user clicked, but I don't know, how on that places add my image... And will be needed AJAX for it? So I would

How to insert point in mySQL table

流过昼夜 提交于 2019-12-02 09:16:12
问题 I get an mySQL error saying 'ADDRESS_LONGI_LATIT_LOCATION' can not be null. Likely that 'geomfromtext/pointfromtext' is returning a null. Whats wrong here? Any help is appreciated. INSERT INTO address (ADDRESS_NICKNAME,ADDRESS_LONGI_LATIT_LOCATION) VALUES ('Testing',geomfromtext('Point(10.20.45 34.23.79)')) Another way INSERT INTO address (ADDRESS_NICKNAME,ADDRESS_LONGI_LATIT_LOCATION) VALUES ('Testing',pointfromtext('10.20.45 34.23.79')) 回答1: As per the specification of ST_geomFromText() (

jQuery - how to add mark to image

社会主义新天地 提交于 2019-12-02 05:47:07
I am thinking how to add some marks to an image (I mean something like in google maps - marks for places). I have an image and if the user will clicked to this image, co I want on that place, where user clicked, add some other image. For example, if the user will click on 3 places in image, I would like to add on this places 3 my images... I know, how to get the directions, where the user clicked, but I don't know, how on that places add my image... And will be needed AJAX for it? So I would like to ask you about help, I will appropriate for each of hints. Thank you. There are several ways of

How to determine if a latitude & longitude is within an ellipse

☆樱花仙子☆ 提交于 2019-12-02 01:08:20
问题 I have data describing a rotated ellipse (the center of the ellipse in latitude longitude coordinates, the lengths of the major and minor axes in kilometers, and the angle that the ellipse is oriented). I do not know the location of the foci, but assume there is a way to figure them out somehow. I would like to determine if a specific latitude longitude point is within this ellipse. I have found a good way to determine if a point is within an ellipse on a Cartesian grid, but don't know how to

distance from point within a polygon to polygon edge

别来无恙 提交于 2019-12-01 22:32:17
问题 I am working with a huge area, 7 states of forest and nonforest using the NLCD data. Within some of the forested areas is a plot (this is my master's thesis I am working on). I have stumped everyone I have asked with this large dataset but we are certain there is a resolution out there. The forest/nonforest area is a signed and discrete raster. I was able to make the forested area into polygons by subsetting out the forested area. I am not able to make the nonforest area into polygons (too