11
11
void circle4 (const double x0 , const double y0 , const double ht );
12
12
void circlearcs (const double x0 , const double y0 , const double ht );
13
13
void yinyang (const double x0 , const double y0 , const double ht , const int n );
14
+ void plot_lr (const double xc , const double yc , const double r1 , const double r2 );
14
15
void plot_ur (const double xc , const double yc , const double r1 , const double r2 );
15
16
void rotate (double * x , double * y , const double st , const double ct );
16
17
@@ -61,7 +62,8 @@ int main(int argc, char * const argv[])
61
62
62
63
/* Draw four circle and arc plots */
63
64
circle4 (w4 , h4 , maxy / 2.0 );
64
- circlearcs (xc + w4 , h4 , maxy / 2.0 );
65
+ // circlearcs(xc + w4, h4, maxy / 2.0);
66
+ plot_lr (xc + w4 , h4 , maxx / 5.0 , maxy / 5.0 );
65
67
yinyang (w4 , yc + h4 , maxy / 2.0 , 3 );
66
68
plot_ur (xc + w4 , yc + h4 , maxx / 5.0 , maxy / 5.0 );
67
69
@@ -84,6 +86,41 @@ void circle4(const double x0, const double y0, const double ht)
84
86
}
85
87
86
88
89
+ void plot_lr (const double xc , const double yc , const double r1 , const double r2 )
90
+ {
91
+ /* Inspired by "Handbook of Designs and Devices" by
92
+ Clarence P. Hornung, ISBN 0-486-20125-2, page 22,
93
+ The Ringed Interlacement, fig. 190 */
94
+ const int n = 9 ;
95
+ const double delta = (2.0 * M_PI ) / (double )n ;
96
+ const double degrees = 180.0 + (delta * (180.0 / M_PI ));
97
+ const double r = r2 * 0.8 ;
98
+ int i ;
99
+
100
+ for (i = 0 ; i < n ; i ++ ) {
101
+ const double theta = delta * (double )i ;
102
+
103
+ const double x = r * cos (theta );
104
+ const double y = r * sin (theta );
105
+ const double xn = r * cos (theta + delta );
106
+ const double yn = r * sin (theta + delta );
107
+ const double xp = r * cos (theta - delta );
108
+ const double yp = r * sin (theta - delta );
109
+ const double x1 = (x + xn ) / 2.0 ;
110
+ const double y1 = (y + yn ) / 2.0 ;
111
+ const double x2 = (x * 0.4 ) + (xp * 0.6 );
112
+ const double y2 = (y * 0.4 ) + (yp * 0.6 );
113
+
114
+ // moveto(xc, yc);
115
+ // lineto(xc + x1, yc + y1);
116
+
117
+ moveto (xc + x2 , yc + y2 );
118
+ arc (xc + x , yc + y , degrees );
119
+ arc (xc + x1 , yc + y1 , 180.0 );
120
+ }
121
+ }
122
+
123
+
87
124
void circlearcs (const double x0 , const double y0 , const double ht )
88
125
{
89
126
/* Intersection of circles or arcs:
0 commit comments