point

Quadratic Bézier Curve: Calculate Points

百般思念 提交于 2019-11-26 21:27:08
I'd like to calculate a point on a quadratic curve. To use it with the canvas element of HTML5. When I use the quadraticCurveTo() function in JavaScript, I have a source point, a target point and a control point. How can I calculate a point on the created quadratic curve at let's say t=0.5 with "only" knowing this three points? xan Use the quadratic Bézier formula, found, for instance, on the Wikipedia page for Bézier Curves : In pseudo-code, that's t = 0.5; // given example value x = (1 - t) * (1 - t) * p[0].x + 2 * (1 - t) * t * p[1].x + t * t * p[2].x; y = (1 - t) * (1 - t) * p[0].y + 2 *

What is the fastest way to find the “visual” center of an irregularly shaped polygon?

心已入冬 提交于 2019-11-26 19:43:22
I need to find a point that is a visual center of an irregularly shaped polygon. By visual center, I mean a point that appears to be in the center of a large area of the polygon visually. The application is to put a label inside the polygon. Here is a solution that uses inside buffering: https://web.archive.org/web/20150708063910/http://proceedings.esri.com/library/userconf/proc01/professional/papers/pap388/p388.htm If this is to be used, what is an effective and fast way to find the buffer? If any other way is to be used, which is that way? A good example of really tough polygons is a giant

Test of Point inside polygon in Android

孤街浪徒 提交于 2019-11-26 18:22:58
问题 The other day I did a class in Java to calculate if a point(X,Y) is inside a polygon. ( X and Y are double , because will be geo-coordinates). I know that Java has the class Polygon , but I had to use Path2D and Point2D , because Polygon don't allow double 's, just integers :( Once I have the polygon done in Path2D , I used the method contains ( Path2D had it), and my problem was solved. But now, I want to import to Android, and the problem is here, because Path2D needs to import: import java

Why is the ELF execution entry point virtual address of the form 0x80xxxxx and not zero 0x0?

非 Y 不嫁゛ 提交于 2019-11-26 17:34:10
When executed, program will start running from virtual address 0x80482c0. This address doesn't point to our main() procedure, but to a procedure named _start which is created by the linker. My Google research so far just led me to some (vague) historical speculations like this: There is folklore that 0x08048000 once was STACK_TOP (that is, the stack grew downwards from near 0x08048000 towards 0) on a port of *NIX to i386 that was promulgated by a group from Santa Cruz, California. This was when 128MB of RAM was expensive, and 4GB of RAM was unthinkable. Can anyone confirm/deny this? As Mads

How do I know if a Lat,Lng point is contained within a circle?

情到浓时终转凉″ 提交于 2019-11-26 13:08:12
问题 Ok pretty self explanatory. I\'m using google maps and I\'m trying to find out if a lat,long point is within a circle of radius say x (x is chosen by the user). Bounding box will not work for this. I have already tried using the following code: distlatLng = new google.maps.LatLng(dist.latlng[0],dist.latlng[1]); var latLngBounds = circle.getBounds(); if(latLngBounds.contains(distlatLng)){ dropPins(distlatLng,dist.f_addr); } This still results in markers being places outside the circle. I\'m

Convert Pixels to Points

↘锁芯ラ 提交于 2019-11-26 12:05:36
I have a need to convert Pixels to Points in C#. I've seen some complicated explanations about the topic, but can't seem to locate a simple formula. Let's assume a standard 96dpi, how do I calulate this conversion? There are 72 points per inch ; if it is sufficient to assume 96 pixels per inch, the formula is rather simple: points = pixels * 72 / 96 There is a way to get the configured pixels per inch of your display in Windows using GetDeviceCaps . Microsoft has a guide called "Developing DPI-Aware Applications" , look for the section "Creating DPI-Aware Fonts". The W3C has defined the pixel

Find if point lays on line segment

六眼飞鱼酱① 提交于 2019-11-26 10:58:30
问题 I have line segment defined by two points A(x1,y1,z1) and B(x2,y2,z2) and point p(x,y,z). How can I check if the point lays on the line segment? 回答1: If the point is on the line then: (x - x1) / (x2 - x1) = (y - y1) / (y2 - y1) = (z - z1) / (z2 - z1) Calculate all three values, and if they are the same (to some degree of tolerance), your point is on the line. To test if the point is in the segment, not just on the line, you can check that x1 < x < x2, assuming x1 < x2, or y1 < y < y2,

Java: Calculating the angle between two points in degrees

孤街醉人 提交于 2019-11-26 10:32:36
问题 I need to calculate the angle in degrees between two points for my own Point class, Point a shall be the center point. Method: public float getAngle(Point target) { return (float) Math.toDegrees(Math.atan2(target.x - x, target.y - y)); } Test 1: // returns 45 Point a = new Point(0, 0); System.out.println(a.getAngle(new Point(1, 1))); Test 2: // returns -90, expected: 270 Point a = new Point(0, 0); System.out.println(a.getAngle(new Point(-1, 0))); How can i convert the returned result into a

Control point border thickness in ggplot

試著忘記壹切 提交于 2019-11-26 09:35:09
问题 When using ggplot, I can set shape to 21-25 to get shapes that have independent setting for the internal ( fill ) and border ( col ) colors, like so: df <- data.frame(id=runif(12), x=1:12, y=runif(12)) ggplot(df, aes(x=x, y=y)) + geom_point(aes(fill=id, size=id), colour=\"black\", shape=21) However, I can\'t figure out how to control the thickness of the shape borders, either setting them absolutely or as an aesthetic mapping. I note that if I set an lwd value, it overrides the size aesthetic

Quadratic Bézier Curve: Calculate Points

前提是你 提交于 2019-11-26 07:57:06
问题 I\'d like to calculate a point on a quadratic curve. To use it with the canvas element of HTML5. When I use the quadraticCurveTo() function in JavaScript, I have a source point, a target point and a control point. How can I calculate a point on the created quadratic curve at let\'s say t=0.5 with \"only\" knowing this three points? 回答1: Use the quadratic Bézier formula, found, for instance, on the Wikipedia page for Bézier Curves: In pseudo-code, that's t = 0.5; // given example value x = (1