83 |
|
typedef Polyhedron::Vertex_handle Vertex_handle; |
84 |
|
|
85 |
|
Polyhedron nanoRodPolyhedron; |
86 |
+ |
Polyhedron nanoRodTwinnedPolyhedron1; |
87 |
+ |
Polyhedron nanoRodTwinnedPolyhedron2; |
88 |
+ |
Polyhedron nanoRodTwinnedPolyhedron3; |
89 |
+ |
Polyhedron nanoRodTwinnedPolyhedron4; |
90 |
+ |
Polyhedron nanoRodTwinnedPolyhedron5; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
90 |
– |
|
91 |
– |
|
92 |
– |
|
95 |
|
//typedef CGAL::Scaling Scaling; |
96 |
|
//typedef Aff_transformation_3<Kernel> A;( const Scaling, |
97 |
|
// Kernel::RT s=RT(20), |
98 |
|
// Kernel::RT hw = RT(1)); |
99 |
|
|
100 |
+ |
|
101 |
+ |
|
102 |
+ |
|
103 |
+ |
|
104 |
|
// A modifier creating a triangle with the incremental builder. |
105 |
|
template <class HDS> |
106 |
|
class buildSingleCrystal : public CGAL::Modifier_base<HDS> { |
235 |
|
B.end_surface(); |
236 |
|
} |
237 |
|
}; |
238 |
+ |
|
239 |
+ |
|
240 |
+ |
|
241 |
+ |
/* First Crystal*/ |
242 |
+ |
|
243 |
+ |
template <class HDS> |
244 |
+ |
class buildtwinned1 : public CGAL::Modifier_base<HDS> { |
245 |
+ |
public: |
246 |
+ |
Vertex_handle end1; |
247 |
+ |
Vertex_handle neight1; |
248 |
+ |
Vertex_handle end2; |
249 |
+ |
Vertex_handle neight2; |
250 |
+ |
Vertex_handle neight3; |
251 |
+ |
|
252 |
+ |
buildtwinned1() {} |
253 |
+ |
void operator()( HDS& hds) { |
254 |
+ |
// Postcondition: `hds' is a valid polyhedral surface. |
255 |
+ |
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true); |
256 |
+ |
B.begin_surface( 12, 5, 6); |
257 |
+ |
typedef typename HDS::Vertex Vertex; |
258 |
+ |
typedef typename Vertex::Point Point; |
259 |
+ |
|
260 |
+ |
|
261 |
+ |
|
262 |
+ |
|
263 |
+ |
|
264 |
+ |
B.add_vertex( Point(-0.7887222926324, 0.4874571845315, -0.2562714077342)); |
265 |
+ |
B.add_vertex( Point(-0.4874571845316, 0.4874571845315, 0.6709272557930)); |
266 |
+ |
B.add_vertex( Point(-0.7887222926324, -0.4874571845315, -0.2562714077342)); //End vertex |
267 |
+ |
end1 = B.add_vertex( Point( 0.0000000000000, 1.0000000000000, 0.0000000000000)); |
268 |
+ |
neight3 = B.add_vertex( Point(-0.4874571845315, -0.4874571845316, 0.6709272557930)); |
269 |
+ |
neight1 = B.add_vertex( Point(-0.0000000000000, 0.4874571845316, -0.8293116961175)); |
270 |
+ |
B.add_vertex( Point( 0.0000000000000, -0.4874571845316, -0.8293116961175)); |
271 |
+ |
B.add_vertex( Point( 0.4874571845315, 0.4874571845316, 0.6709272557930)); |
272 |
+ |
end2 = B.add_vertex( Point(-0.0000000000000, -1.0000000000000, 0.0000000000000)); //End Vertex |
273 |
+ |
B.add_vertex( Point( 0.7887222926324, 0.4874571845315, -0.2562714077342)); |
274 |
+ |
neight2 = B.add_vertex( Point( 0.4874571845316, -0.4874571845315, 0.6709272557930)); |
275 |
+ |
B.add_vertex( Point( 0.7887222926324, -0.4874571845315, -0.2562714077342)); |
276 |
+ |
|
277 |
+ |
B.begin_facet(); |
278 |
+ |
B.add_vertex_to_facet( 8); |
279 |
+ |
B.add_vertex_to_facet( 4); |
280 |
+ |
B.add_vertex_to_facet( 1); |
281 |
+ |
B.add_vertex_to_facet( 3); |
282 |
+ |
B.end_facet(); |
283 |
+ |
|
284 |
+ |
B.begin_facet(); |
285 |
+ |
B.add_vertex_to_facet( 3); |
286 |
+ |
B.add_vertex_to_facet( 0); |
287 |
+ |
B.add_vertex_to_facet( 2); |
288 |
+ |
B.add_vertex_to_facet( 8); |
289 |
+ |
B.end_facet(); |
290 |
+ |
|
291 |
+ |
B.begin_facet(); |
292 |
+ |
B.add_vertex_to_facet( 0); |
293 |
+ |
B.add_vertex_to_facet( 1); |
294 |
+ |
B.add_vertex_to_facet( 4); |
295 |
+ |
B.add_vertex_to_facet( 2); |
296 |
+ |
B.end_facet(); |
297 |
+ |
|
298 |
+ |
|
299 |
+ |
B.begin_facet(); |
300 |
+ |
B.add_vertex_to_facet( 3); |
301 |
+ |
B.add_vertex_to_facet( 1); |
302 |
+ |
B.add_vertex_to_facet( 0); |
303 |
+ |
B.end_facet(); |
304 |
+ |
|
305 |
+ |
B.begin_facet(); |
306 |
+ |
B.add_vertex_to_facet( 4); |
307 |
+ |
B.add_vertex_to_facet( 8); |
308 |
+ |
B.add_vertex_to_facet( 2); |
309 |
+ |
B.end_facet(); |
310 |
+ |
|
311 |
+ |
B.end_surface(); |
312 |
+ |
} |
313 |
+ |
}; |
314 |
+ |
|
315 |
+ |
|
316 |
+ |
|
317 |
+ |
|
318 |
+ |
/*second crystal*/ |
319 |
+ |
template <class HDS> |
320 |
+ |
class buildtwinned2 : public CGAL::Modifier_base<HDS> { |
321 |
+ |
public: |
322 |
+ |
Vertex_handle end1; |
323 |
+ |
Vertex_handle neight1; |
324 |
+ |
Vertex_handle end2; |
325 |
+ |
Vertex_handle neight2; |
326 |
+ |
Vertex_handle neight3; |
327 |
+ |
|
328 |
+ |
buildtwinned2() {} |
329 |
+ |
void operator()( HDS& hds) { |
330 |
+ |
// Postcondition: `hds' is a valid polyhedral surface. |
331 |
+ |
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true); |
332 |
+ |
B.begin_surface( 12, 5, 6); |
333 |
+ |
typedef typename HDS::Vertex Vertex; |
334 |
+ |
typedef typename Vertex::Point Point; |
335 |
+ |
|
336 |
+ |
|
337 |
+ |
|
338 |
+ |
|
339 |
+ |
|
340 |
+ |
B.add_vertex( Point(-0.7887222926324, 0.4874571845315, -0.2562714077342)); |
341 |
+ |
B.add_vertex( Point(-0.4874571845316, 0.4874571845315, 0.6709272557930)); |
342 |
+ |
B.add_vertex( Point(-0.7887222926324, -0.4874571845315, -0.2562714077342)); //End vertex |
343 |
+ |
end1 = B.add_vertex( Point( 0.0000000000000, 1.0000000000000, 0.0000000000000)); |
344 |
+ |
neight3 = B.add_vertex( Point(-0.4874571845315, -0.4874571845316, 0.6709272557930)); |
345 |
+ |
neight1 = B.add_vertex( Point(-0.0000000000000, 0.4874571845316, -0.8293116961175)); |
346 |
+ |
B.add_vertex( Point( 0.0000000000000, -0.4874571845316, -0.8293116961175)); |
347 |
+ |
B.add_vertex( Point( 0.4874571845315, 0.4874571845316, 0.6709272557930)); |
348 |
+ |
end2 = B.add_vertex( Point(-0.0000000000000, -1.0000000000000, 0.0000000000000)); //End Vertex |
349 |
+ |
B.add_vertex( Point( 0.7887222926324, 0.4874571845315, -0.2562714077342)); |
350 |
+ |
neight2 = B.add_vertex( Point( 0.4874571845316, -0.4874571845315, 0.6709272557930)); |
351 |
+ |
B.add_vertex( Point( 0.7887222926324, -0.4874571845315, -0.2562714077342)); |
352 |
+ |
|
353 |
+ |
B.begin_facet(); |
354 |
+ |
B.add_vertex_to_facet( 8); |
355 |
+ |
B.add_vertex_to_facet( 2); |
356 |
+ |
B.add_vertex_to_facet( 0); |
357 |
+ |
B.add_vertex_to_facet( 3); |
358 |
+ |
B.end_facet(); |
359 |
+ |
|
360 |
+ |
B.begin_facet(); |
361 |
+ |
B.add_vertex_to_facet( 3); |
362 |
+ |
B.add_vertex_to_facet( 5); |
363 |
+ |
B.add_vertex_to_facet( 6); |
364 |
+ |
B.add_vertex_to_facet( 8); |
365 |
+ |
B.end_facet(); |
366 |
+ |
|
367 |
+ |
B.begin_facet(); |
368 |
+ |
B.add_vertex_to_facet( 5); |
369 |
+ |
B.add_vertex_to_facet( 0); |
370 |
+ |
B.add_vertex_to_facet( 2); |
371 |
+ |
B.add_vertex_to_facet( 6); |
372 |
+ |
B.end_facet(); |
373 |
+ |
|
374 |
+ |
|
375 |
+ |
B.begin_facet(); |
376 |
+ |
B.add_vertex_to_facet( 3); |
377 |
+ |
B.add_vertex_to_facet( 0); |
378 |
+ |
B.add_vertex_to_facet( 5); |
379 |
+ |
B.end_facet(); |
380 |
+ |
|
381 |
+ |
B.begin_facet(); |
382 |
+ |
B.add_vertex_to_facet( 8); |
383 |
+ |
B.add_vertex_to_facet( 6); |
384 |
+ |
B.add_vertex_to_facet( 2); |
385 |
+ |
B.end_facet(); |
386 |
+ |
|
387 |
+ |
B.end_surface(); |
388 |
+ |
} |
389 |
+ |
}; |
390 |
|
|
391 |
+ |
/* Third Crystal*/ |
392 |
|
|
393 |
+ |
template <class HDS> |
394 |
+ |
class buildtwinned3 : public CGAL::Modifier_base<HDS> { |
395 |
+ |
public: |
396 |
+ |
Vertex_handle end1; |
397 |
+ |
Vertex_handle neight1; |
398 |
+ |
Vertex_handle end2; |
399 |
+ |
Vertex_handle neight2; |
400 |
+ |
Vertex_handle neight3; |
401 |
+ |
|
402 |
+ |
buildtwinned3() {} |
403 |
+ |
void operator()( HDS& hds) { |
404 |
+ |
// Postcondition: `hds' is a valid polyhedral surface. |
405 |
+ |
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true); |
406 |
+ |
B.begin_surface( 12, 5, 6); |
407 |
+ |
typedef typename HDS::Vertex Vertex; |
408 |
+ |
typedef typename Vertex::Point Point; |
409 |
+ |
|
410 |
+ |
|
411 |
+ |
|
412 |
+ |
|
413 |
+ |
|
414 |
+ |
B.add_vertex( Point(-0.7887222926324, 0.4874571845315, -0.2562714077342)); |
415 |
+ |
B.add_vertex( Point(-0.4874571845316, 0.4874571845315, 0.6709272557930)); |
416 |
+ |
B.add_vertex( Point(-0.7887222926324, -0.4874571845315, -0.2562714077342)); //End vertex |
417 |
+ |
end1 = B.add_vertex( Point( 0.0000000000000, 1.0000000000000, 0.0000000000000)); |
418 |
+ |
neight3 = B.add_vertex( Point(-0.4874571845315, -0.4874571845316, 0.6709272557930)); |
419 |
+ |
neight1 = B.add_vertex( Point(-0.0000000000000, 0.4874571845316, -0.8293116961175)); |
420 |
+ |
B.add_vertex( Point( 0.0000000000000, -0.4874571845316, -0.8293116961175)); |
421 |
+ |
B.add_vertex( Point( 0.4874571845315, 0.4874571845316, 0.6709272557930)); |
422 |
+ |
end2 = B.add_vertex( Point(-0.0000000000000, -1.0000000000000, 0.0000000000000)); //End Vertex |
423 |
+ |
B.add_vertex( Point( 0.7887222926324, 0.4874571845315, -0.2562714077342)); |
424 |
+ |
neight2 = B.add_vertex( Point( 0.4874571845316, -0.4874571845315, 0.6709272557930)); |
425 |
+ |
B.add_vertex( Point( 0.7887222926324, -0.4874571845315, -0.2562714077342)); |
426 |
+ |
|
427 |
+ |
B.begin_facet(); |
428 |
+ |
B.add_vertex_to_facet( 8); |
429 |
+ |
B.add_vertex_to_facet( 6); |
430 |
+ |
B.add_vertex_to_facet( 5); |
431 |
+ |
B.add_vertex_to_facet( 3); |
432 |
+ |
B.end_facet(); |
433 |
+ |
|
434 |
+ |
B.begin_facet(); |
435 |
+ |
B.add_vertex_to_facet( 3); |
436 |
+ |
B.add_vertex_to_facet( 9); |
437 |
+ |
B.add_vertex_to_facet( 11); |
438 |
+ |
B.add_vertex_to_facet( 8); |
439 |
+ |
B.end_facet(); |
440 |
+ |
|
441 |
+ |
B.begin_facet(); |
442 |
+ |
B.add_vertex_to_facet( 9); |
443 |
+ |
B.add_vertex_to_facet( 5); |
444 |
+ |
B.add_vertex_to_facet( 6); |
445 |
+ |
B.add_vertex_to_facet( 11); |
446 |
+ |
B.end_facet(); |
447 |
+ |
|
448 |
+ |
|
449 |
+ |
B.begin_facet(); |
450 |
+ |
B.add_vertex_to_facet( 3); |
451 |
+ |
B.add_vertex_to_facet( 5); |
452 |
+ |
B.add_vertex_to_facet( 9); |
453 |
+ |
B.end_facet(); |
454 |
+ |
|
455 |
+ |
B.begin_facet(); |
456 |
+ |
B.add_vertex_to_facet( 8); |
457 |
+ |
B.add_vertex_to_facet( 11); |
458 |
+ |
B.add_vertex_to_facet( 6); |
459 |
+ |
B.end_facet(); |
460 |
+ |
|
461 |
+ |
B.end_surface(); |
462 |
+ |
} |
463 |
+ |
}; |
464 |
|
|
465 |
+ |
/*Fourth Segment*/ |
466 |
+ |
template <class HDS> |
467 |
+ |
class buildtwinned4 : public CGAL::Modifier_base<HDS> { |
468 |
+ |
public: |
469 |
+ |
Vertex_handle end1; |
470 |
+ |
Vertex_handle neight1; |
471 |
+ |
Vertex_handle end2; |
472 |
+ |
Vertex_handle neight2; |
473 |
+ |
Vertex_handle neight3; |
474 |
+ |
|
475 |
+ |
buildtwinned4() {} |
476 |
+ |
void operator()( HDS& hds) { |
477 |
+ |
// Postcondition: `hds' is a valid polyhedral surface. |
478 |
+ |
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true); |
479 |
+ |
B.begin_surface( 12, 5, 6); |
480 |
+ |
typedef typename HDS::Vertex Vertex; |
481 |
+ |
typedef typename Vertex::Point Point; |
482 |
+ |
|
483 |
+ |
|
484 |
+ |
|
485 |
+ |
|
486 |
+ |
|
487 |
+ |
B.add_vertex( Point(-0.7887222926324, 0.4874571845315, -0.2562714077342)); |
488 |
+ |
B.add_vertex( Point(-0.4874571845316, 0.4874571845315, 0.6709272557930)); |
489 |
+ |
B.add_vertex( Point(-0.7887222926324, -0.4874571845315, -0.2562714077342)); //End vertex |
490 |
+ |
end1 = B.add_vertex( Point( 0.0000000000000, 1.0000000000000, 0.0000000000000)); |
491 |
+ |
neight3 = B.add_vertex( Point(-0.4874571845315, -0.4874571845316, 0.6709272557930)); |
492 |
+ |
neight1 = B.add_vertex( Point(-0.0000000000000, 0.4874571845316, -0.8293116961175)); |
493 |
+ |
B.add_vertex( Point( 0.0000000000000, -0.4874571845316, -0.8293116961175)); |
494 |
+ |
B.add_vertex( Point( 0.4874571845315, 0.4874571845316, 0.6709272557930)); |
495 |
+ |
end2 = B.add_vertex( Point(-0.0000000000000, -1.0000000000000, 0.0000000000000)); //End Vertex |
496 |
+ |
B.add_vertex( Point( 0.7887222926324, 0.4874571845315, -0.2562714077342)); |
497 |
+ |
neight2 = B.add_vertex( Point( 0.4874571845316, -0.4874571845315, 0.6709272557930)); |
498 |
+ |
B.add_vertex( Point( 0.7887222926324, -0.4874571845315, -0.2562714077342)); |
499 |
+ |
|
500 |
+ |
B.begin_facet(); |
501 |
+ |
B.add_vertex_to_facet( 8); |
502 |
+ |
B.add_vertex_to_facet( 11); |
503 |
+ |
B.add_vertex_to_facet( 9); |
504 |
+ |
B.add_vertex_to_facet( 3); |
505 |
+ |
B.end_facet(); |
506 |
+ |
|
507 |
+ |
B.begin_facet(); |
508 |
+ |
B.add_vertex_to_facet( 3); |
509 |
+ |
B.add_vertex_to_facet( 7); |
510 |
+ |
B.add_vertex_to_facet( 10); |
511 |
+ |
B.add_vertex_to_facet( 8); |
512 |
+ |
B.end_facet(); |
513 |
+ |
|
514 |
+ |
B.begin_facet(); |
515 |
+ |
B.add_vertex_to_facet( 7); |
516 |
+ |
B.add_vertex_to_facet( 9); |
517 |
+ |
B.add_vertex_to_facet( 11); |
518 |
+ |
B.add_vertex_to_facet( 10); |
519 |
+ |
B.end_facet(); |
520 |
+ |
|
521 |
+ |
|
522 |
+ |
B.begin_facet(); |
523 |
+ |
B.add_vertex_to_facet( 3); |
524 |
+ |
B.add_vertex_to_facet( 9); |
525 |
+ |
B.add_vertex_to_facet( 7); |
526 |
+ |
B.end_facet(); |
527 |
+ |
|
528 |
+ |
B.begin_facet(); |
529 |
+ |
B.add_vertex_to_facet( 8); |
530 |
+ |
B.add_vertex_to_facet( 10); |
531 |
+ |
B.add_vertex_to_facet( 11); |
532 |
+ |
B.end_facet(); |
533 |
+ |
|
534 |
+ |
B.end_surface(); |
535 |
+ |
} |
536 |
+ |
}; |
537 |
+ |
|
538 |
+ |
|
539 |
+ |
/*Fifth Segment*/ |
540 |
+ |
template <class HDS> |
541 |
+ |
class buildtwinned5 : public CGAL::Modifier_base<HDS> { |
542 |
+ |
public: |
543 |
+ |
Vertex_handle end1; |
544 |
+ |
Vertex_handle neight1; |
545 |
+ |
Vertex_handle end2; |
546 |
+ |
Vertex_handle neight2; |
547 |
+ |
Vertex_handle neight3; |
548 |
+ |
|
549 |
+ |
buildtwinned5() {} |
550 |
+ |
void operator()( HDS& hds) { |
551 |
+ |
// Postcondition: `hds' is a valid polyhedral surface. |
552 |
+ |
CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true); |
553 |
+ |
B.begin_surface( 12, 5, 6); |
554 |
+ |
typedef typename HDS::Vertex Vertex; |
555 |
+ |
typedef typename Vertex::Point Point; |
556 |
+ |
|
557 |
+ |
|
558 |
+ |
|
559 |
+ |
|
560 |
+ |
|
561 |
+ |
B.add_vertex( Point(-0.7887222926324, 0.4874571845315, -0.2562714077342)); |
562 |
+ |
B.add_vertex( Point(-0.4874571845316, 0.4874571845315, 0.6709272557930)); |
563 |
+ |
B.add_vertex( Point(-0.7887222926324, -0.4874571845315, -0.2562714077342)); //End vertex |
564 |
+ |
end1 = B.add_vertex( Point( 0.0000000000000, 1.0000000000000, 0.0000000000000)); |
565 |
+ |
neight3 = B.add_vertex( Point(-0.4874571845315, -0.4874571845316, 0.6709272557930)); |
566 |
+ |
neight1 = B.add_vertex( Point(-0.0000000000000, 0.4874571845316, -0.8293116961175)); |
567 |
+ |
B.add_vertex( Point( 0.0000000000000, -0.4874571845316, -0.8293116961175)); |
568 |
+ |
B.add_vertex( Point( 0.4874571845315, 0.4874571845316, 0.6709272557930)); |
569 |
+ |
end2 = B.add_vertex( Point(-0.0000000000000, -1.0000000000000, 0.0000000000000)); //End Vertex |
570 |
+ |
B.add_vertex( Point( 0.7887222926324, 0.4874571845315, -0.2562714077342)); |
571 |
+ |
neight2 = B.add_vertex( Point( 0.4874571845316, -0.4874571845315, 0.6709272557930)); |
572 |
+ |
B.add_vertex( Point( 0.7887222926324, -0.4874571845315, -0.2562714077342)); |
573 |
+ |
|
574 |
+ |
B.begin_facet(); |
575 |
+ |
B.add_vertex_to_facet( 8); |
576 |
+ |
B.add_vertex_to_facet( 4); |
577 |
+ |
B.add_vertex_to_facet( 1); |
578 |
+ |
B.add_vertex_to_facet( 3); |
579 |
+ |
B.end_facet(); |
580 |
+ |
|
581 |
+ |
B.begin_facet(); |
582 |
+ |
B.add_vertex_to_facet( 3); |
583 |
+ |
B.add_vertex_to_facet( 7); |
584 |
+ |
B.add_vertex_to_facet( 10); |
585 |
+ |
B.add_vertex_to_facet( 8); |
586 |
+ |
B.end_facet(); |
587 |
+ |
|
588 |
+ |
B.begin_facet(); |
589 |
+ |
B.add_vertex_to_facet( 7); |
590 |
+ |
B.add_vertex_to_facet( 1); |
591 |
+ |
B.add_vertex_to_facet( 4); |
592 |
+ |
B.add_vertex_to_facet( 10); |
593 |
+ |
B.end_facet(); |
594 |
+ |
|
595 |
+ |
|
596 |
+ |
B.begin_facet(); |
597 |
+ |
B.add_vertex_to_facet( 1); |
598 |
+ |
B.add_vertex_to_facet( 7); |
599 |
+ |
B.add_vertex_to_facet( 3); |
600 |
+ |
B.end_facet(); |
601 |
+ |
|
602 |
+ |
B.begin_facet(); |
603 |
+ |
B.add_vertex_to_facet( 10); |
604 |
+ |
B.add_vertex_to_facet( 4); |
605 |
+ |
B.add_vertex_to_facet( 8); |
606 |
+ |
B.end_facet(); |
607 |
+ |
|
608 |
+ |
B.end_surface(); |
609 |
+ |
} |
610 |
+ |
}; |
611 |
+ |
|
612 |
+ |
|
613 |
+ |
|
614 |
+ |
|
615 |
+ |
|
616 |
+ |
|
617 |
|
struct Normal_vector { |
618 |
|
template <class Facet> |
619 |
|
typename Facet::Plane_3 operator()( Facet& f) { |
650 |
|
|
651 |
|
GeometryBuilder::GeometryBuilder(double length,double width) { |
652 |
|
// Create the geometry for nanorod |
653 |
< |
buildSingleCrystal<HalfedgeDS> nanorod; |
653 |
> |
buildSingleCrystal<HalfedgeDS> singleCrystalNanorod; |
654 |
|
|
655 |
< |
nanoRodPolyhedron.delegate( nanorod); |
655 |
> |
nanoRodPolyhedron.delegate( singleCrystalNanorod); |
656 |
|
|
657 |
< |
double y1 = nanorod.end1->point().y() - nanorod.neight1->point().y(); |
658 |
< |
double y2 = nanorod.end2->point().y() - nanorod.neight2->point().y(); |
657 |
> |
double y1 = singleCrystalNanorod.end1->point().y() - singleCrystalNanorod.neight1->point().y(); |
658 |
> |
double y2 = singleCrystalNanorod.end2->point().y() - singleCrystalNanorod.neight2->point().y(); |
659 |
|
|
660 |
< |
double endDist = sqrt(pow(nanorod.neight2->point().x() - nanorod.neight3->point().x(),2)+ |
661 |
< |
pow(nanorod.neight2->point().y() - nanorod.neight3->point().y(),2)+ |
662 |
< |
pow(nanorod.neight2->point().z() - nanorod.neight3->point().z(),2)); |
660 |
> |
double endDist = sqrt(pow(singleCrystalNanorod.neight2->point().x() - singleCrystalNanorod.neight3->point().x(),2)+ |
661 |
> |
pow(singleCrystalNanorod.neight2->point().y() - singleCrystalNanorod.neight3->point().y(),2)+ |
662 |
> |
pow(singleCrystalNanorod.neight2->point().z() - singleCrystalNanorod.neight3->point().z(),2)); |
663 |
|
|
664 |
|
double endRatio1 = y1/endDist; |
665 |
|
double endRatio2 = y2/endDist; |
681 |
|
std::transform( nanoRodPolyhedron.points_begin(), nanoRodPolyhedron.points_end(), nanoRodPolyhedron.points_begin(), aff_tranformation); |
682 |
|
|
683 |
|
|
684 |
< |
double endDist2 = sqrt(pow(nanorod.neight2->point().x() - nanorod.neight3->point().x(),2)+ |
685 |
< |
pow(nanorod.neight2->point().y() - nanorod.neight3->point().y(),2)+ |
686 |
< |
pow(nanorod.neight2->point().z() - nanorod.neight3->point().z(),2)); |
684 |
> |
double endDist2 = sqrt(pow(singleCrystalNanorod.neight2->point().x() -singleCrystalNanorod.neight3->point().x(),2)+ |
685 |
> |
pow(singleCrystalNanorod.neight2->point().y() - singleCrystalNanorod.neight3->point().y(),2)+ |
686 |
> |
pow(singleCrystalNanorod.neight2->point().z() - singleCrystalNanorod.neight3->point().z(),2)); |
687 |
|
|
688 |
< |
Point_3 point1(nanorod.end1->point().x(), endDist2*endRatio1 + nanorod.neight1->point().y(), nanorod.end1->point().z()); |
689 |
< |
Point_3 point2(nanorod.end2->point().x(), endDist2*endRatio2 + nanorod.neight2->point().y(), nanorod.end2->point().z()); |
690 |
< |
nanorod.end1->point() = point1; |
691 |
< |
nanorod.end2->point() = point2; |
688 |
> |
Point_3 point1(singleCrystalNanorod.end1->point().x(), endDist2*endRatio1 + singleCrystalNanorod.neight1->point().y(), singleCrystalNanorod.end1->point().z()); |
689 |
> |
Point_3 point2(singleCrystalNanorod.end2->point().x(), endDist2*endRatio2 + singleCrystalNanorod.neight2->point().y(), singleCrystalNanorod.end2->point().z()); |
690 |
> |
singleCrystalNanorod.end1->point() = point1; |
691 |
> |
singleCrystalNanorod.end2->point() = point2; |
692 |
|
|
693 |
|
// Construct normal vector for each face. |
694 |
|
std::transform( nanoRodPolyhedron.facets_begin(), nanoRodPolyhedron.facets_end(), nanoRodPolyhedron.planes_begin(), |
695 |
|
Normal_vector()); |
696 |
|
} |
697 |
+ |
|
698 |
+ |
|
699 |
+ |
|
700 |
+ |
GeometryBuilder::GeometryBuilder(double length,double width, bool twinned) { |
701 |
+ |
// Create the geometry for nanorod |
702 |
+ |
|
703 |
+ |
buildtwinned1<HalfedgeDS> crystal1; |
704 |
+ |
buildtwinned2<HalfedgeDS> crystal2; |
705 |
+ |
buildtwinned3<HalfedgeDS> crystal3; |
706 |
+ |
buildtwinned4<HalfedgeDS> crystal4; |
707 |
+ |
buildtwinned5<HalfedgeDS> crystal5; |
708 |
+ |
|
709 |
+ |
|
710 |
+ |
nanoRodTwinnedPolyhedron1.delegate( crystal1); |
711 |
+ |
nanoRodTwinnedPolyhedron2.delegate( crystal2); |
712 |
+ |
nanoRodTwinnedPolyhedron3.delegate( crystal3); |
713 |
+ |
nanoRodTwinnedPolyhedron4.delegate( crystal4); |
714 |
+ |
nanoRodTwinnedPolyhedron5.delegate( crystal5); |
715 |
+ |
|
716 |
+ |
|
717 |
+ |
|
718 |
+ |
|
719 |
+ |
|
720 |
+ |
|
721 |
+ |
double y1 = crystal1.end1->point().y() - crystal1.neight1->point().y(); |
722 |
+ |
double y2 = crystal1.end2->point().y() - crystal1.neight2->point().y(); |
723 |
+ |
|
724 |
+ |
double endDist = sqrt(pow(crystal1.neight2->point().x() - crystal1.neight3->point().x(),2)+ |
725 |
+ |
pow(crystal1.neight2->point().y() - crystal1.neight3->point().y(),2)+ |
726 |
+ |
pow(crystal1.neight2->point().z() - crystal1.neight3->point().z(),2)); |
727 |
+ |
|
728 |
+ |
double endRatio1 = y1/endDist; |
729 |
+ |
double endRatio2 = y2/endDist; |
730 |
+ |
|
731 |
+ |
std::cout << "End dist is " << endDist <<" ratio " << endRatio1 << std::endl; |
732 |
+ |
|
733 |
+ |
CGAL::Aff_transformation_3<Kernel> aff_tranformation( width, |
734 |
+ |
0.0, |
735 |
+ |
0.0, |
736 |
+ |
0.0, |
737 |
+ |
0.0, |
738 |
+ |
length, |
739 |
+ |
0.0, |
740 |
+ |
0.0, |
741 |
+ |
0.0, |
742 |
+ |
0.0, |
743 |
+ |
width, |
744 |
+ |
0.0); |
745 |
+ |
std::transform(nanoRodTwinnedPolyhedron1.points_begin(), nanoRodTwinnedPolyhedron1.points_end(), nanoRodTwinnedPolyhedron1.points_begin(), aff_tranformation); |
746 |
+ |
|
747 |
+ |
|
748 |
+ |
double endDist2 = sqrt(pow(crystal1.neight2->point().x() - crystal1.neight3->point().x(),2)+ |
749 |
+ |
pow(crystal1.neight2->point().y() - crystal1.neight3->point().y(),2)+ |
750 |
+ |
pow(crystal1.neight2->point().z() - crystal1.neight3->point().z(),2)); |
751 |
+ |
|
752 |
+ |
Point_3 point1(crystal1.end1->point().x(), endDist2*endRatio1 + crystal1.neight1->point().y(), crystal1.end1->point().z()); |
753 |
+ |
Point_3 point2(crystal1.end2->point().x(), endDist2*endRatio2 + crystal1.neight2->point().y(), crystal1.end2->point().z()); |
754 |
+ |
crystal1.end1->point() = point1; |
755 |
+ |
crystal1.end2->point() = point2; |
756 |
+ |
|
757 |
+ |
// Construct normal vector for each face. |
758 |
+ |
std::transform( nanoRodTwinnedPolyhedron1.facets_begin(), nanoRodTwinnedPolyhedron1.facets_end(), nanoRodTwinnedPolyhedron1.planes_begin(), |
759 |
+ |
Normal_vector()); |
760 |
+ |
} |
761 |
+ |
|
762 |
+ |
|
763 |
+ |
|
764 |
+ |
|
765 |
+ |
|
766 |
+ |
|
767 |
+ |
|
768 |
+ |
|
769 |
+ |
|
770 |
|
void GeometryBuilder::dumpGeometry(const std::string& geomFileName){ |
771 |
|
|
772 |
|
std::ofstream newGeomFile; |