32 int c = (int) (
TWOPI*radius + 0.5);
33 double rad = c*1.0L/
TWOPI;
39 cout <<
"Generating a tubular deltagraph" << endl;
42 cout <<
"Radius: " << rad << endl;
43 cout <<
"Height: " << height << endl;
46 for ( nv=0, i=0; i<=height; i++ ) {
47 loc[2] = (i-height/2.0)*sqrt(3.0)/2.0;
50 ea =
TWOPI - da/2 + sa;
51 for ( a=sa; a<ea; a+=da ) {
52 loc[0] = radius*cos(a);
53 loc[1] = radius*sin(a);
85 double c = sqrt(h*h + h*k + k*k);
87 double bottom = -height/2.0, top = height/2.0;
93 cout <<
"Generating a tubular deltagraph" << endl;
96 cout <<
"Lattice parameters: " << h <<
" " << k << endl;
97 cout <<
"Radius: " << rad << endl;
98 cout <<
"Height: " << height << endl;
101 double a = atan2(k*sqrt(3.0)/2, h+k/2.0);
105 while ( w[0] > 0 ) w -= u;
108 while ( lat[1] < top ) {
109 for ( lat = start; lat[0] < c; lat += u ) {
110 if ( lat[0] >= 0 && lat[0] < c && lat[1] >= bottom && lat[1] <= top ) {
115 for ( close=0, comp2 =
model->
comp; comp2 && !close; comp2 = comp2->
next )
131 cout <<
"Number of components generated: " << nv << endl << endl;
155 if ( type & 2 ) order = 5;
165 double a, sa(0), ea, f;
166 double da =
TWOPI/(1.0L*order);
167 double hra = da/(2*radius);
172 cout <<
"Generating a cylindrical deltagraph" << endl;
179 comp->
loc[2] = -height*sqrt(3.0)/4.0 - 0.5*radius;
181 for ( i=1; i<=radius; i++ ) {
182 start[2] = -height*sqrt(3.0)/4.0 - 0.5*(radius - i);
183 for ( a=0; a<ea; a+=da ) {
186 vec[0] = i*cos(a+da) - start[0];
187 vec[1] = i*sin(a+da) - start[1];
188 for ( f=0; f<0.95; f+=1.0L/i ) {
193 comp->
loc = start + vec*f;
199 for ( i=1; i<height; i++ ) {
200 start[2] = (i-height/2.0)*sqrt(3.0)/2.0;
203 ea =
TWOPI - hra + sa;
204 for ( a=sa; a<ea; a+=da ) {
205 start[0] = radius*cos(a);
206 start[1] = radius*sin(a);
207 if ( height%2 == 0 || start[2] < 0 ) {
208 vec[0] = radius*cos(a+da-2*sa) - start[0];
209 vec[1] = radius*sin(a+da-2*sa) - start[1];
210 if ( sa && radius > 1 ) vec *= radius/(radius - 1.0);
213 start[0] = radius*cos(a+2*hra);
214 start[1] = radius*sin(a+2*hra);
215 vec[0] = radius*cos(a+da) - start[0];
216 vec[1] = radius*sin(a+da) - start[1];
217 if ( radius > 1 ) vec *= radius/(radius - 1.0);
219 vec[0] = radius*cos(a+da) - start[0];
220 vec[1] = radius*sin(a+da) - start[1];
223 for ( f=0; f<0.95; f+=1.0L/radius ) {
227 comp->
loc = start + vec*f;
233 if ( sa > 0 ) sa = 0;
235 for ( i=radius; i>0; i-- ) {
236 start[2] = height*sqrt(3.0)/4.0 + 0.5*(radius - i);
237 ea =
TWOPI - hra + sa;
238 for ( a=sa; a<ea; a+=da ) {
241 vec[0] = i*cos(a+da) - start[0];
242 vec[1] = i*sin(a+da) - start[1];
243 for ( f=0; f<0.95; f+=1.0L/i ) {
248 comp->
loc = start + vec*f;
258 comp->
loc[2] = height*sqrt(3.0)/4.0 + 0.5*radius;