bezier

bezier-detail

bezier-point

bezier-tangent

curve

curve-detail

curve-point

curve-tangent

curve-tightness

bezier

Arguments
[x1 y1 z1 cx1 cy1 cz1 cx2 cy2 cz2 x2 y2 z2][x1 y1 cx1 cy1 cx2 cy2 x2 y2]
Docstring

Draws a Bezier curve on the screen. These curves are defined by a series of anchor and control points. The first two parameters specify the first anchor point and the last two parameters specify the other anchor point. The middle parameters specify the control points which define the shape of the curve.

Works only inside sketch functions?
Yes
Original Processing method
bezier()
Original p5js method
bezier()
Example
(q/background 255)
(q/camera 0 0 300 0 0 0 0 1 0)
(q/no-fill)
(q/bezier-detail 5)
(q/bezier 0 0 0 0 100 0 0 100 0 100 0 0)
try example
(q/background 255)
(q/camera 200 200 200 0 0 0 0 0 -1)
(q/no-fill)
(q/bezier 0 0 0 0 100 0 0 100 0 100 0 0)
try example
(q/no-fill)
(q/with-translation [100 100]
  (q/bezier 0 0 50 100 100 -100 150 0))
try example

bezier-detail

Arguments
[detail]
Docstring

Sets the resolution at which Beziers display. The default value is 20. This function is only useful when using the :p3d or :opengl renderer as the default (:java2d) renderer does not use this information.

Works only inside sketch functions?
Yes
Original Processing method
bezierDetail()
Original p5js method
bezierDetail()
Example
(q/background 255)
(q/camera 0 0 300 0 0 0 0 1 0)
(q/no-fill)
(q/bezier-detail 5)
(q/bezier 0 0 0 0 100 0 0 100 0 100 0 0)
try example

bezier-point

Arguments
[a b c d t]
Docstring

Evaluates the Bezier at point t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are points on the curve, and b and c are the control points. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a bezier curve at t.

Works only inside sketch functions?
Yes
Original Processing method
bezierPoint()
Original p5js method
bezierPoint()
Example
; see https://p5js.org/reference/#/p5/bezierPoint for better example
(q/fill 0)
(dotimes [i 5]
  (let [v (/ i 4)
        res (q/bezier-point 0 5 7 0 v)
        txt (str "(q/bezier-point 0 5 7 0 " v ") = " res)]
    (q/text txt 10 (+ 20 (* i 20)))))
try example

bezier-tangent

Arguments
[a b c d t]
Docstring

Calculates the tangent of a point on a Bezier curve. (See http://en.wikipedia.org/wiki/Tangent)

Works only inside sketch functions?
Yes
Original Processing method
bezierTangent()
Original p5js method
bezierTangent()
Example
; see https://p5js.org/reference/#/p5/bezierTangent for better example
(q/fill 0)
(dotimes [i 5]
  (let [v (/ i 4)
        res (q/bezier-tangent 0 5 7 0 v)
        txt (str "(q/bezier-tangent 0 5 7 0 " v ") = " res)]
    (q/text txt 10 (+ 20 (* i 20)))))
try example

curve

Arguments
[x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4][x1 y1 x2 y2 x3 y3 x4 y4]
Docstring

Draws a curved line on the screen. The first and second parameters specify the beginning control point and the last two parameters specify the ending control point. The middle parameters specify the start and stop of the curve. Longer curves can be created by putting a series of curve functions together or using curve-vertex. An additional function called curve-tightness provides control for the visual quality of the curve. The curve function is an implementation of Catmull-Rom splines.

Works only inside sketch functions?
Yes
Original Processing method
curve()
Original p5js method
curve()
Example
(q/background 255)
(q/camera 200 200 200 0 0 0 0 0 -1)
(q/no-fill)
(q/curve 0 0 50 100 100 -100 150 0)
(q/curve 0 0 0 0 100 0 0 0 100 100 0 0)
try example

curve-detail

Arguments
[detail]
Docstring

Sets the resolution at which curves display. The default value is 20. This function is only useful when using the :p3d or :opengl renderer as the default (:java2d) renderer does not use this information.

Works only inside sketch functions?
Yes
Original Processing method
curveDetail()
Original p5js method
curveDetail()
Example
(q/background 255)
(q/camera 0 0 300 0 0 0 0 1 0)
(q/no-fill)
(q/curve-detail 5)
(q/curve 0 0 50 100 100 -100 150 0)
(q/curve-detail 20)
(q/curve 0 0 -50 100 -100 -100 -150 0)
try example

curve-point

Arguments
[a b c d t]
Docstring

Evaluates the curve at point t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are points on the curve, and b and c are the control points. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a curve at t.

Works only inside sketch functions?
Yes
Original Processing method
curvePoint()
Original p5js method
curvePoint()
Example
; see https://p5js.org/reference/#/p5/curvePoint for better example
(q/fill 0)
(dotimes [i 5]
  (let [v (/ i 4)
        res (q/curve-point 0 5 7 0 v)
        txt (str "(q/curve-point 0 5 7 0 " v ") = " res)]
    (q/text txt 10 (+ 20 (* i 20)))))
try example

curve-tangent

Arguments
[a b c d t]
Docstring

Calculates the tangent of a point on a curve. See: http://en.wikipedia.org/wiki/Tangent

Works only inside sketch functions?
Yes
Original Processing method
curveTangent()
Original p5js method
curveTangent()
Example
; see https://p5js.org/reference/#/p5/curveTangent for better example
(q/fill 0)
(dotimes [i 5]
  (let [v (/ i 4)
        res (q/curve-tangent 0 5 7 0 v)
        txt (str "(q/curve-tangent 0 5 7 0 " v ") = " res)]
    (q/text txt 10 (+ 20 (* i 20)))))
try example

curve-tightness

Arguments
[tightness]
Docstring

Modifies the quality of forms created with curve and curve-vertex. The parameter tightness determines how the curve fits to the vertex points. The value 0.0 is the default value for tightness (this value defines the curves to be Catmull-Rom splines) and the value 1.0 connects all the points with straight lines. Values within the range -5.0 and 5.0 will deform the curves but will leave them recognizable and as values increase in magnitude, they will continue to deform.

Works only inside sketch functions?
Yes
Original Processing method
curveTightness()
Original p5js method
curveTightness()
Example
(q/no-fill)
; try different tightnesses
(doseq [[ind t] [[0 -5] [1 -1] [2 0] [3 1] [4 5]]]
  (q/curve-tightness t)
  (q/with-translation [100 (+ 50 (* ind 70))]
    (q/curve 0 0 0 0 50 30 100 -30)
    (q/curve 0 0 50 30 100 -30 150 0)
    (q/curve 50 30 100 -30 150 0 150 0)))
try example