I think this is what you're looking for: http://blog.sklambert.com/finding-the-control-points-of-a-bezier-curve/ It goes into detail on calculating the various points on a Bezier curve. You may also be interested in this more specific example for your application: http://www.codeproject.com/Articles/223159/Midpoint-Algorithm-Divide-and-Conquer-Method-for-D If you really want to get into it, then I suggest this Primer: http://pomax.github.io/bezierinfo/...

Try this: points( x=100*diff(scale)/diff(range(x1)), #could also use remap(100, scale, range(x1)) y=remap(600, scale, range(x2) ), col="red", cex=3) ...

process,statistics,point,spatstat

For point processes the distinction between marks and covariates are: Marks are values attached to each point (settlement) and often the mark is not meaningful at other locations. Covariates are conceptually meaningful/available throughout the entire survey region (observation window). Mark values can in principle be anything, but basically only two...

c#,coordinates,point,rectangles

Since the rectangle's sides were not parallel to X and Y axis, I thought that it was better to look for the PIP (Point in Polygon) problem, something more general that a rectangle. So, I tested the code in the following post and it seemed to work for polygon with...

I'm assuming that you want the find the closest two points in two lists, where one of the points is in one list and the other point is in the other list. You can solve this by using an inner and an outer loop. The outer loop iterates through all...

java,arrays,coordinates,multidimensional-array,point

Is this what you're trying to do? public static void main(String[] args){ Object [][] objArray = new Object[10][10]; for (int i=0;i<10;i++){ for (int j=0;j<10;j++){ objArray[i][j]= new Class1(i, j); } } } public class Class1{ ArrayList<Point> coordArray = new ArrayList<Point>(); Class1(int x, int y){ coordArray.add(new Point(x,y)); } } ...

java,list,sorting,point,nearest-neighbor

You need an algorithm that does this, starting with a set of points. If there are no points in the set, then stop. Make a new set (the current object), and choose any point out of the original set to be the first point in the new set. Remove the...

r,ggplot2,data-visualization,point,jitter

If we look at the source we first find this: PositionJitter <- proto(Position, { objname <- "jitter" adjust <- function(., data) { if (empty(data)) return(data.frame()) check_required_aesthetics(c("x", "y"), names(data), "position_jitter") if (is.null(.$width)) .$width <- resolution(data$x, zero = FALSE) * 0.4 if (is.null(.$height)) .$height <- resolution(data$y, zero = FALSE) * 0.4 trans_x...

You're not overriding the Object#equals() method properly -- its signature should be as follows: public boolean equals(Object obj) { The parameter must be of type Object, you would then convert it to Point: @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return...

The getX() and getY() functions of the Point class return a double because that's what its parent class (Point2D) requires. This is so all of its subclasses (Point2D.Double and Point2D.Float) will all work in the same places. Using point.x and point.y directly instead of using the getter functions is probably...

I have asked pcl-users.org and the solution was to press letter R from the keyboard.

Both are same. Here is what 'move' does public void move(int x, int y) { this.x = x; this.y = y; } and here is what 'setLocation' does public void setLocation(int x, int y) { move(x, y); } It just calls move method. 'move' accepts only integer arguments whereas 'setLocation'...

Circle takes a Point instance as its first constructor argument Circle c = new Circle(new Point(3.0,3.0), 3.0); ...

Your problem may be as simple as your not extending your for loops out far enough. Try changing this: for (int i = 0; i < gs - 1; i++) { for (int j = 0; j < gs - 1; j++) { to this: for (int i = 0;...

double,bit-manipulation,point,floating

I agree with the comment that it should be done in binary, rather than by conversion to decimal and decimal multiplication. I used Exploring Binary to do the arithmetic. The first step is to find the actual binary significands. Neither input is subnormal, so they are 1.000101 and 1.00100001. Multiply...

SELECT ST_Length(ST_GeographyFromText(ST_AsText(ST_Line_Substring(line,ST_Line_Locate_Point(line,ST_ClosestPoint(line,fpt)),ST_Line_Locate_Point(line,ST_ClosestPoint(line,tpt)))))) As length_m, ST_Distance(ST_ClosestPoint(line,tpt)::geography, tpt::geography) as to_point_to_line_m, ST_Distance(ST_ClosestPoint(line,fpt)::geography, fpt::geography) as from_point_to_line_m, ST_AsText(ST_ClosestPoint(line,tpt)) as to_point_on_line, ST_AsText(ST_ClosestPoint(line,fpt)) as from_point_on_line, ST_AsText(tpt) as to_point,...

double x = (point.getY() - oppRec * point.getX() - line.getPoint1().getY() + slope * line.getPoint1().getX()) / (slope - oppRec); double y = oppRec * x + point.getY() - oppRec * point.getX(); ...

In the absence of any more authoritative solution, this is what I am using, to draw a 3x3 array of points round the central one: void spot(int x, int y) // draws 9 points round the point at x,y { for(int i=-1;i<3;i++) { for(int j=-1;j<3;j++) {point(x+i,y+j);} } } I will...

Upto two decimal places. ^(\d+)[.,](\d{1,2})\d*$ Replace the matched chars with $1.$2. For three decimal places, you need to use ^(\d+)[.,](\d{1,3})\d*$ DEMO > '43,999999'.replace(/^(\d+)[.,](\d{1,2})\d*$/g, '$1.$2') '43.99' > '43,999999'.replace(/[.,](\d{1,2})\d*$/g, '.$1') '43.99' ...

Have a look at ST_Mem_Size. This gives you the size of toast tables, as well, so is more suitable than pg_total_relation_size and other built in Postgres functions, which do not -- although this only applies to larger geometries. Returning to your question, for a point, SELECT ST_Mem_Size(ST_MakePoint(0, 0)); returns 32...

I think that what you want to do is to compare between two points... Then, you'll have to modify isLower() public int isLower(point p){ if(y > p.y){ return p.y; } else{ return y; } } ... System.out.println(point1.isLower(point2)); You can enhance this to compare between all of the given points, or...

You are mistaken. The code you talked about woks just fine and there is no difference between PointF and your PointD: public Form1() { InitializeComponent(); MyStruct ms = new MyStruct(); this.Text = ms.p.X.ToString() + ms.d.X.ToString(); } public struct PointD { public double X; public double Y; } public struct MyStruct...

Iterating from segment to segment, for each segment, find the closest point from this segment to the point (a,b) There are three cases: Horizontal line (x1, y) to (x2, y) and point (a,b) has x1 <= a <= x2, so closest point is (a,y) Vertical line (x, y1) to (x,...

mongodb,matrix,distance,point,asymmetric

What measure of "distance" are you using, out of curiosity? Technically, you can't call a function d(X, Y) a "distance" unless d(X, Y) = d(Y, X) always. Distance between points on a sphere is symmetric so you can't be using that metric. If all you want to do is store...

kinect,point,point-cloud-library,point-clouds

A point cloud is a data structure. It is basically an array/a vector of points (each containing x,y,z coordinates for each point and possibly more information). Depth data is the information about depth taken from a sensor that the point cloud can express. There are other data structures with which...

Try the intersectsLine(Line2D l) method of java.awt.geom.Rectangle2D: Rectangle2D.Double rect = new Rectangle2D.Double(double x, double y, double w, double h); System.out.println(rect.intersectsLine(new Line2D.Double(double xA, double yA, double xB, double yB))); where xA,yA, xB,yB are the x and y coordinates, respectively, of points A and B which you wish to check if the...

The problem is with your move method. All the new points are being set before the image can be repainted. Add the following to the Turtle class. public class Turtle extends Animal { private int steps=0; And then replace the move method with: @Override public void move() { if(steps<5) setLocation(new...

A Line2D.Double only has 2 points P1 and P2, the start and end of a straight line. You can get them with getP1() and getP2(). Do you actually want to iterate over a Path2D.Double? If so you would iterate over a path like this: PathIterator pathIter = path.getPathIterator(null); while(!pathIter.isDone()) {...

There are several places in your code where you invoke undefined behavior, which means anything can happen. a can be 1, 100 or "puppy". First off, you can't do scanf("%p",&p); printf("p point to %p\r\n",p); *p=100; because you probably don't own that memory. Even if you did, writing to it might...

math,point,sage,elliptic-curve

Since you did not include code to reproduce your situation, I take an example curve from the Sage documentation: sage: E = EllipticCurve(GF(101),[23,34]) Generating random points You can repeatedly use random_element or random_point to choose points at random: sage: E.random_point() (99 : 92 : 1) sage: E.random_point() (27 : 80...

javascript,algorithm,math,point,angle

I'm going to propose a solution similar to David's, but using vertices rather than line segments. My solution also requires a consistent ordering of points, so I'll go with a clockwise ordering as well. The following pseudocode will generate an ordered listing (in the same order as that of the...

For some unfathomable reason I found myself fascinated by this question. But I will provide my answer in terms of C# code. Building off Donald Berk's answer (which I found to have an error as originally posted, see my comment to his answer), I created the following console application. To...

m= (y2-y1)/(x2-x1) = (y4-y1)/(x4-x1)=1 as slope is 45 degree. so x4=x1+y4-y1; substitute y4=y3; then X4 = x1+y3-y1; ...

This should help you: String text = "(25, 4) (1, -6)"; ArrayList<String> list = new ArrayList<String>(); try { Pattern pattern = Pattern.compile("-?\\d+"); Matcher matcher = pattern.matcher(text); while (matcher.find()) { list.add(matcher.group()); } for (Iterator<String> iterator = list.iterator(); iterator.hasNext();) { System.out.println(iterator.next()); } } catch (PatternSyntaxException ex) { } ...

python,variables,printing,point,floating

You should use %f instead: my_height = 1.75 #meters >>> print "I'm %f meters tall." % my_height I'm 1.750000 meters tall. To specify a certain precision, you do it as: my_height = 1.75 #meters >>> print "I'm %.2f meters tall." % my_height #the 2 denoting two figures after decimal point...

Combine your points into a matrix or data frame first. data_points <- matrix(c(c(3.1,4.4),c(17.2, 5),c(13.0,7.1)), ncol = 2, byrow = T) data_points # [,1] [,2] #[1,] 3.1 4.4 #[2,] 17.2 5.0 #[3,] 13.0 7.1 plot(data_points[, 1], data_points[, 2]) ...

You're still going to have to iterate through every point, but there are two optimizations you can perform: 1) You can eliminate obvious points by checking if x1 < radius and if y1 < radius (like Brent already mentioned in another answer). 2) Instead of calculating the distance, you can...

In the link you posted, you can find the center of the image here: /// Get the mass centers: vector<Point2f> mc( contours.size() ); for( int i = 0; i < contours.size(); i++ ) { mc[i] = Point2f( mu[i].m10/mu[i].m00 , mu[i].m01/mu[i].m00 ); } You can find the center of your image...

I think one way would be something like ... dAngle = (targetAngle - angle) % two_pi; //Range of (-two_pi .. two_pi) dAngle += (dAngle > pi? -two_pi : dAngle < -pi? two_pi : 0); //Range of [-pi .. pi] angle += 0.05 * dAngle; Also, if you want it always...

You can use rgb() to specify color so you can control alpha: plot(1:5, cex = 0) points(1:5, pch=20, cex=2, col = rgb(0, 1, 0, c(0.1,0.2, 0.3, 0.4, 0.5))) In your example: points(DF$x_values, DF$y_values, pch=20, cex=2, col = rgb(0, 1, 0, alpha)) ...

getpts needs a handle to either a figure or an axes, not a matrix as given by imread. The simple solution is to display the image, then input either gca or gcf to getpts. Or you can manage handles on your own, but I don't think you wan't to do...

java,geometry,line,point,trigonometry

I'd avoid all that trigonometry. For one of the edge directions, you want a vector which is at the same time perpendicular to V1 − V2 and to the Y axis. The cross product can be used to obtain a vector which is perpendicular to two given ones. So you...

performance,algorithm,computational-geometry,point,convex-hull

Looks like you can. Sort vertices in a[] by polar angle relative to one of vertices (call it A). O(N log N), like convex hull computation. Read point, determine its polar angle. O(1) Find two neighbor vertices, one of them should have polar angle less than point from step 2,...

I think the problem is that std::map requires the type that has operator < implemented, however QPoint does not. To resolve this, you could define your map, for example, in the following way: std::map<int, QPoint> pointMap; Otherwice you need to define your custom "Less than" operator for QPoint, like: bool...

java,mouseevent,panel,point,mouselistener

Just do int x = event.getX(); int y = event.getY(); if you want a point: Point p = event.getPoint(); then to compare: int start = 0; int end = 100; if(x >= start && x <= end && y >= start && y <= end) System.out.println("working"); ...