The goog.math.Bezier Class

goog.math.Bezier(x0, y0, x1, y1, x2, y2, x3, y3)

Object representing a cubic bezier curve.

x0 {number}
X coordinate of the start point.
y0 {number}
Y coordinate of the start point.
x1 {number}
X coordinate of the first control point.
y1 {number}
Y coordinate of the first control point.
x2 {number}
X coordinate of the second control point.
y2 {number}
Y coordinate of the second control point.
x3 {number}
X coordinate of the end point.
y3 {number}
Y coordinate of the end point.

.KAPPA {number}

Constant used to approximate ellipses. See: http://canvaspaint.org/blog/2006/12/ellipse/

.clone()

returns {!goog.math.Bezier}
A copy of this curve.

.equals(other)

Test if the given curve is exactly the same as this one.

other {goog.math.Bezier}
The other curve.
returns {boolean}
Whether the given curve is the same as this one.

.flip()

Modifies the curve in place to progress in the opposite direction.

.getPoint(t)

Computes the curve at a point between 0 and 1.

t {number}
The point on the curve to find.
returns {!goog.math.Coordinate}
The computed coordinate.

.solvePositionFromXValue(xVal)

Computes the position t of a point on the curve given its x coordinate. That is, for an input xVal, finds t s.t. getPoint(t).x = xVal. As such, the following should always be true up to some small epsilon: t ~ solvePositionFromXValue(getPoint(t).x) for t in [0, 1].

xVal {number}
The x coordinate of the point to find on the curve.
returns {number}
The position t.

.solveYValueFromXValue(xVal)

Computes the y coordinate of a point on the curve given its x coordinate.

xVal {number}
The x coordinate of the point on the curve.
returns {number}
The y coordinate of the point on the curve.

.subdivide(s, t)

Changes this curve in place to be the portion of itself from [s, t].

s {number}
The start of the desired portion of the curve.
t {number}
The end of the desired portion of the curve.

.subdivideLeft(t)

Changes this curve in place to be the portion of itself from [t, 1].

t {number}
The start of the desired portion of the curve.

.subdivideRight(t)

Changes this curve in place to be the portion of itself from [0, t].

t {number}
The end of the desired portion of the curve.

.x0 {number}

X coordinate of the first point.

.x1 {number}

X coordinate of the first control point.

.x2 {number}

X coordinate of the second control point.

.x3 {number}

X coordinate of the end point.

.y0 {number}

Y coordinate of the first point.

.y1 {number}

Y coordinate of the first control point.

.y2 {number}

Y coordinate of the second control point.

.y3 {number}

Y coordinate of the end point.