File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1037,18 +1037,19 @@ class Sketch
10371037 // We want the "cursor" along the sine wave to move at a
10381038 // random rate.
10391039 double d_rand = m_rand.get_double ();
1040- double d_M_PI = 3.14159265358979323846 ;
10411040 m_p += pow (m_randomness, d_rand * 2.0 - 1.0 );
1042- double r = sin (m_p / (m_length / (d_M_PI * 2.0 ))) * m_scale;
10431041 double den = m_last_x - *x;
10441042 double num = m_last_y - *y;
10451043 double len = num * num + den * den;
10461044 m_last_x = *x;
10471045 m_last_y = *y;
10481046 if (len != 0 ) {
1047+ const double d_M_PI = 3.14159265358979323846 ;
10491048 len = sqrt (len);
1050- *x += r * num / len;
1051- *y += r * -den / len;
1049+ double r = sin (m_p * 2.0 * d_M_PI / m_length) * m_scale;
1050+ double roverlen = r / len;
1051+ *x += roverlen * num;
1052+ *y += roverlen * -den;
10521053 }
10531054 } else {
10541055 m_last_x = *x;
You can’t perform that action at this time.
0 commit comments