In mathematics, a curve (also called a curved line in older texts) is, generally speaking, an object similar to a line but which is not required to be straight.
Questions tagged [curve]
1306 questions
63
votes
5 answers
Quadratic Bézier Curve: Calculate Points
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…

Christian Engel
- 3,738
- 5
- 28
- 44
55
votes
5 answers
ggplot2: histogram with normal curve
I've been trying to superimpose a normal curve over my histogram with ggplot 2.
My formula:
data <- read.csv (path...)
ggplot(data, aes(V2)) +
geom_histogram(alpha=0.3, fill='white', colour='black', binwidth=.04)
I tried several things:
+…

Bloomy
- 2,103
- 4
- 17
- 9
52
votes
6 answers
Closest point on a cubic Bezier curve?
How can I find the point B(t) along a cubic Bezier curve that is closest to an arbitrary point P in the plane?

Adrian Lopez
- 1,695
- 1
- 16
- 22
45
votes
5 answers
Catmull-rom curve with no cusps and no self-intersections
I have the following code to calculate points between four control points to generate a catmull-rom curve:
CGPoint interpolatedPosition(CGPoint p0, CGPoint p1, CGPoint p2, CGPoint p3, float t)
{
float t3 = t * t * t;
float t2 = t * t;
…

Øyvind
- 839
- 2
- 15
- 22
45
votes
2 answers
Draw a curve with css
I want to create an animation with css that simulate a wave movement.
I need to change a line-or div- to a curve for this...
The CSS rules that I'm familiar to, make the entire div to semicircular or change element border.
For…

Kiyarash
- 2,437
- 7
- 32
- 61
42
votes
2 answers
What is the difference between cubic bezier and quadratic bezier and their use cases?
I have been playing around with canvas recently and have been drawing several shapes (tear drops, flower petals, clouds, rocks) using methods associated with these curves. With that said, I can't seem to figure out the difference between the use…

Conqueror
- 4,265
- 7
- 35
- 41
35
votes
4 answers
Draw a quadratic Bézier curve through three given points
I have three points in 2D and I want to draw a quadratic Bézier curve passing through them. How do I calculate the middle control point (x1 and y1 as in quadTo)? I know linear algebra from college but need some simple help on this.
How can I…

Alex
- 353
- 1
- 3
- 4
35
votes
3 answers
In Scipy how and why does curve_fit calculate the covariance of the parameter estimates
I have been using scipy.optimize.leastsq to fit some data. I would like to get some confidence intervals on these estimates so I look into the cov_x output but the documentation is very unclear as to what this is and how to get the covariance matrix…

HansHarhoff
- 1,917
- 2
- 22
- 32
32
votes
4 answers
Compute the 'elbow' for a curve automatically and mathematically
One example for curve is shown as below. The elbow point might be x=3 or 4.
How to compute the elbow for a curve automatically and mathematically?

Jie
- 387
- 1
- 4
- 9
29
votes
3 answers
svg multiple color on circle stroke
I want to create a rainbow circle, like the picture below:
How can I draw the curved and multiple color stop gradient?
Here's my current code:
28
votes
4 answers
plotting a curve around a set of points
I have a set of points on a plane. They are partitioned into subsets.
I want to plot a closed curve around points that belong to the same subset, so that points that belong to a subset will be inside the curve, and those that aren't will be outside.…

amit
- 3,332
- 6
- 24
- 32
26
votes
2 answers
How to create a faceted line-graph using ggplot?
I have a data frame created with this code:
require(reshape2)
foo <- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.8),rnorm(3, mean=.9),rnorm(3, mean=1))))
qux <- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.3),rnorm(3, mean=.4),rnorm(1,…

neversaint
- 60,904
- 137
- 310
- 477
23
votes
2 answers
How to reduce the number of points in a curve while preserving its overall shape?
I have a list of points that make a curve, and I would like to reduce the number of points, but still keep the overall shape of the curve.
Basically, I want to go from this:
To this:
So the algorithm would remove the points that are redundant but…

laurent
- 88,262
- 77
- 290
- 428
21
votes
2 answers
How to use the D3 diagonal function to draw curved lines?
I looked at sample http://bl.ocks.org/mbostock/raw/4063570/:
It produces nice merged lines from source target from left to right.
In my case I need to layout nodes manually and put x, y coordinates. In this case the lines are not merged at source…

John Smith
- 261
- 1
- 3
- 8
21
votes
3 answers
Javascript physics engine and simulated infinite curve
I'm trying to do a Tiny Wings like in javascript.
I first saw a technique using Box2D, I'm using the closure-web version (because of the memory leaks fix).
In short, I explode the curve into polygons so it looks like that:
I also tried with…

SuperSkunk
- 1,268
- 12
- 24