@@ -505,7 +505,7 @@ function curves(p5, fn){
505
505
* noFill();
506
506
* strokeWeight(1);
507
507
* stroke(0);
508
- * curve (5, 26, 73, 24, 73, 61, 15, 65);
508
+ * spline (5, 26, 73, 24, 73, 61, 15, 65);
509
509
*
510
510
* // Draw red spline curves from the anchor points to the control points.
511
511
* stroke(255, 0, 0);
@@ -653,8 +653,6 @@ function curves(p5, fn){
653
653
* @chainable
654
654
*/
655
655
fn . spline = function ( ...args ) {
656
- // p5._validateParameters('curve', args);
657
-
658
656
if ( ! this . _renderer . states . strokeColor && ! this . _renderer . states . fillColor ) {
659
657
return this ;
660
658
}
@@ -666,9 +664,9 @@ function curves(p5, fn){
666
664
/**
667
665
* Calculates coordinates along a spline curve using interpolation.
668
666
*
669
- * `curvePoint ()` calculates coordinates along a spline curve using the
667
+ * `splinePoint ()` calculates coordinates along a spline curve using the
670
668
* anchor and control points. It expects points in the same order as the
671
- * <a href="#/p5/curve">curve ()</a> function. `curvePoint ()` works one axis
669
+ * <a href="#/p5/spline">spline ()</a> function. `splinePoint ()` works one axis
672
670
* at a time. Passing the anchor and control points' x-coordinates will
673
671
* calculate the x-coordinate of a point on the curve. Passing the anchor and
674
672
* control points' y-coordinates will calculate the y-coordinate of a point on
@@ -685,7 +683,7 @@ function curves(p5, fn){
685
683
* is the first anchor point, 1 is the second anchor point, and 0.5 is halfway
686
684
* between them.
687
685
*
688
- * @method curvePoint
686
+ * @method splinePoint
689
687
* @param {Number } a coordinate of first anchor point.
690
688
* @param {Number } b coordinate of first control point.
691
689
* @param {Number } c coordinate of second control point.
@@ -713,24 +711,24 @@ function curves(p5, fn){
713
711
*
714
712
* // Draw the curve.
715
713
* noFill();
716
- * curve (x1, y1, x2, y2, x3, y3, x4, y4);
714
+ * spline (x1, y1, x2, y2, x3, y3, x4, y4);
717
715
*
718
716
* // Draw circles along the curve's path.
719
717
* fill(255);
720
718
*
721
719
* // Top.
722
- * let x = curvePoint (x1, x2, x3, x4, 0);
723
- * let y = curvePoint (y1, y2, y3, y4, 0);
720
+ * let x = splinePoint (x1, x2, x3, x4, 0);
721
+ * let y = splinePoint (y1, y2, y3, y4, 0);
724
722
* circle(x, y, 5);
725
723
*
726
724
* // Center.
727
- * x = curvePoint (x1, x2, x3, x4, 0.5);
728
- * y = curvePoint (y1, y2, y3, y4, 0.5);
725
+ * x = splinePoint (x1, x2, x3, x4, 0.5);
726
+ * y = splinePoint (y1, y2, y3, y4, 0.5);
729
727
* circle(x, y, 5);
730
728
*
731
729
* // Bottom.
732
- * x = curvePoint (x1, x2, x3, x4, 1);
733
- * y = curvePoint (y1, y2, y3, y4, 1);
730
+ * x = splinePoint (x1, x2, x3, x4, 1);
731
+ * y = splinePoint (y1, y2, y3, y4, 1);
734
732
* circle(x, y, 5);
735
733
*
736
734
* describe('A black curve on a gray square. The endpoints and center of the curve are marked with white circles.');
@@ -761,12 +759,12 @@ function curves(p5, fn){
761
759
*
762
760
* // Draw the curve.
763
761
* noFill();
764
- * curve (x1, y1, x2, y2, x3, y3, x4, y4);
762
+ * spline (x1, y1, x2, y2, x3, y3, x4, y4);
765
763
*
766
764
* // Calculate the circle's coordinates.
767
765
* let t = 0.5 * sin(frameCount * 0.01) + 0.5;
768
- * let x = curvePoint (x1, x2, x3, x4, t);
769
- * let y = curvePoint (y1, y2, y3, y4, t);
766
+ * let x = splinePoint (x1, x2, x3, x4, t);
767
+ * let y = splinePoint (y1, y2, y3, y4, t);
770
768
*
771
769
* // Draw the circle.
772
770
* fill(255);
@@ -775,8 +773,7 @@ function curves(p5, fn){
775
773
* </code>
776
774
* </div>
777
775
*/
778
- fn . curvePoint = function ( a , b , c , d , t ) {
779
- // p5._validateParameters('curvePoint', arguments);
776
+ fn . splinePoint = function ( a , b , c , d , t ) {
780
777
const s = this . _renderer . states . splineProperties . tightness ,
781
778
t3 = t * t * t ,
782
779
t2 = t * t ,
@@ -793,9 +790,9 @@ function curves(p5, fn){
793
790
* Tangent lines skim the surface of a curve. A tangent line's slope equals
794
791
* the curve's slope at the point where it intersects.
795
792
*
796
- * `curveTangent ()` calculates coordinates along a tangent line using the
793
+ * `splineTangent ()` calculates coordinates along a tangent line using the
797
794
* spline curve's anchor and control points. It expects points in the same
798
- * order as the <a href="#/p5/curve">curve ()</a> function. `curveTangent ()`
795
+ * order as the <a href="#/p5/spline">spline ()</a> function. `splineTangent ()`
799
796
* works one axis at a time. Passing the anchor and control points'
800
797
* x-coordinates will calculate the x-coordinate of a point on the tangent
801
798
* line. Passing the anchor and control points' y-coordinates will calculate
@@ -812,7 +809,7 @@ function curves(p5, fn){
812
809
* is the first anchor point, 1 is the second anchor point, and 0.5 is halfway
813
810
* between them.
814
811
*
815
- * @method curveTangent
812
+ * @method splineTangent
816
813
* @param {Number } a coordinate of first control point.
817
814
* @param {Number } b coordinate of first anchor point.
818
815
* @param {Number } c coordinate of second anchor point.
@@ -840,48 +837,48 @@ function curves(p5, fn){
840
837
*
841
838
* // Draw the curve.
842
839
* noFill();
843
- * curve (x1, y1, x2, y2, x3, y3, x4, y4);
840
+ * spline (x1, y1, x2, y2, x3, y3, x4, y4);
844
841
*
845
842
* // Draw tangents along the curve's path.
846
843
* fill(255);
847
844
*
848
845
* // Top circle.
849
846
* stroke(0);
850
- * let x = curvePoint (x1, x2, x3, x4, 0);
851
- * let y = curvePoint (y1, y2, y3, y4, 0);
847
+ * let x = splinePoint (x1, x2, x3, x4, 0);
848
+ * let y = splinePoint (y1, y2, y3, y4, 0);
852
849
* circle(x, y, 5);
853
850
*
854
851
* // Top tangent line.
855
852
* // Scale the tangent point to draw a shorter line.
856
853
* stroke(255, 0, 0);
857
- * let tx = 0.2 * curveTangent (x1, x2, x3, x4, 0);
858
- * let ty = 0.2 * curveTangent (y1, y2, y3, y4, 0);
854
+ * let tx = 0.2 * splineTangent (x1, x2, x3, x4, 0);
855
+ * let ty = 0.2 * splineTangent (y1, y2, y3, y4, 0);
859
856
* line(x + tx, y + ty, x - tx, y - ty);
860
857
*
861
858
* // Center circle.
862
859
* stroke(0);
863
- * x = curvePoint (x1, x2, x3, x4, 0.5);
864
- * y = curvePoint (y1, y2, y3, y4, 0.5);
860
+ * x = splinePoint (x1, x2, x3, x4, 0.5);
861
+ * y = splinePoint (y1, y2, y3, y4, 0.5);
865
862
* circle(x, y, 5);
866
863
*
867
864
* // Center tangent line.
868
865
* // Scale the tangent point to draw a shorter line.
869
866
* stroke(255, 0, 0);
870
- * tx = 0.2 * curveTangent (x1, x2, x3, x4, 0.5);
871
- * ty = 0.2 * curveTangent (y1, y2, y3, y4, 0.5);
867
+ * tx = 0.2 * splineTangent (x1, x2, x3, x4, 0.5);
868
+ * ty = 0.2 * splineTangent (y1, y2, y3, y4, 0.5);
872
869
* line(x + tx, y + ty, x - tx, y - ty);
873
870
*
874
871
* // Bottom circle.
875
872
* stroke(0);
876
- * x = curvePoint (x1, x2, x3, x4, 1);
877
- * y = curvePoint (y1, y2, y3, y4, 1);
873
+ * x = splinePoint (x1, x2, x3, x4, 1);
874
+ * y = splinePoint (y1, y2, y3, y4, 1);
878
875
* circle(x, y, 5);
879
876
*
880
877
* // Bottom tangent line.
881
878
* // Scale the tangent point to draw a shorter line.
882
879
* stroke(255, 0, 0);
883
- * tx = 0.2 * curveTangent (x1, x2, x3, x4, 1);
884
- * ty = 0.2 * curveTangent (y1, y2, y3, y4, 1);
880
+ * tx = 0.2 * splineTangent (x1, x2, x3, x4, 1);
881
+ * ty = 0.2 * splineTangent (y1, y2, y3, y4, 1);
885
882
* line(x + tx, y + ty, x - tx, y - ty);
886
883
*
887
884
* describe(
@@ -891,9 +888,7 @@ function curves(p5, fn){
891
888
* </code>
892
889
* </div>
893
890
*/
894
- fn . curveTangent = function ( a , b , c , d , t ) {
895
- // p5._validateParameters('curveTangent', arguments);
896
-
891
+ fn . splineTangent = function ( a , b , c , d , t ) {
897
892
const s = this . _renderer . states . splineProperties . tightness ,
898
893
tt3 = t * t * 3 ,
899
894
t2 = t * 2 ,
0 commit comments