| 67 | 
  | 
using namespace oopse; | 
| 68 | 
  | 
 | 
| 69 | 
  | 
//typedef CGAL::Homogeneous<int>              Kernel; | 
| 70 | 
< | 
typedef CGAL::Simple_cartesian<double>     Kernel; | 
| 70 | 
> | 
typedef CGAL::Simple_cartesian<RealType>     Kernel; | 
| 71 | 
  | 
//typedef CGAL::Polyhedron_3<Kernel>         Polyhedron; | 
| 72 | 
  | 
 | 
| 73 | 
  | 
typedef Kernel::Point_3                    Point_3; | 
| 627 | 
  | 
}; | 
| 628 | 
  | 
 | 
| 629 | 
  | 
 | 
| 630 | 
< | 
bool GeometryBuilder::isInsidePolyhedron(double x, double y, double z) { | 
| 630 | 
> | 
bool GeometryBuilder::isInsidePolyhedron(RealType x, RealType y, RealType z) { | 
| 631 | 
  | 
         | 
| 632 | 
  | 
  Point_3 point(x,y,z); | 
| 633 | 
  | 
  Plane_iterator i; | 
| 637 | 
  | 
     | 
| 638 | 
  | 
    Vector_3 newVector = point - k->vertex()->point(); | 
| 639 | 
  | 
    Vector_3 normal = *i;                | 
| 640 | 
< | 
    double dot_product = newVector.x() * normal.x() + newVector.y() * normal.y() + newVector.z() * normal.z(); | 
| 640 | 
> | 
    RealType dot_product = newVector.x() * normal.x() + newVector.y() * normal.y() + newVector.z() * normal.z(); | 
| 641 | 
  | 
     | 
| 642 | 
  | 
    if (dot_product < 0) { | 
| 643 | 
  | 
      return false;      | 
| 648 | 
  | 
} | 
| 649 | 
  | 
 | 
| 650 | 
  | 
 | 
| 651 | 
< | 
GeometryBuilder::GeometryBuilder(double length,double width) { | 
| 651 | 
> | 
GeometryBuilder::GeometryBuilder(RealType length,RealType width) { | 
| 652 | 
  | 
  // Create the geometry for nanorod | 
| 653 | 
  | 
 buildSingleCrystal<HalfedgeDS> singleCrystalNanorod; | 
| 654 | 
  | 
   | 
| 655 | 
  | 
  nanoRodPolyhedron.delegate( singleCrystalNanorod); | 
| 656 | 
  | 
    | 
| 657 | 
< | 
  double y1 = singleCrystalNanorod.end1->point().y() - singleCrystalNanorod.neight1->point().y(); | 
| 658 | 
< | 
  double y2 = singleCrystalNanorod.end2->point().y() - singleCrystalNanorod.neight2->point().y(); | 
| 657 | 
> | 
  RealType y1 = singleCrystalNanorod.end1->point().y() - singleCrystalNanorod.neight1->point().y(); | 
| 658 | 
> | 
  RealType y2 = singleCrystalNanorod.end2->point().y() - singleCrystalNanorod.neight2->point().y(); | 
| 659 | 
  | 
   | 
| 660 | 
< | 
  double endDist = sqrt(pow(singleCrystalNanorod.neight2->point().x() - singleCrystalNanorod.neight3->point().x(),2)+ | 
| 660 | 
> | 
  RealType 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; | 
| 664 | 
> | 
  RealType endRatio1 = y1/endDist; | 
| 665 | 
> | 
  RealType endRatio2 = y2/endDist; | 
| 666 | 
  | 
   | 
| 667 | 
  | 
  std::cout << "End dist is " << endDist <<" ratio " << endRatio1 << std::endl; | 
| 668 | 
  | 
   | 
| 681 | 
  | 
  std::transform( nanoRodPolyhedron.points_begin(), nanoRodPolyhedron.points_end(), nanoRodPolyhedron.points_begin(), aff_tranformation); | 
| 682 | 
  | 
         | 
| 683 | 
  | 
   | 
| 684 | 
< | 
  double endDist2 = sqrt(pow(singleCrystalNanorod.neight2->point().x() -singleCrystalNanorod.neight3->point().x(),2)+ | 
| 684 | 
> | 
  RealType 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 | 
  | 
   | 
| 697 | 
  | 
 | 
| 698 | 
  | 
 | 
| 699 | 
  | 
 | 
| 700 | 
< | 
GeometryBuilder::GeometryBuilder(double length,double width, bool twinned) { | 
| 700 | 
> | 
GeometryBuilder::GeometryBuilder(RealType length,RealType width, bool twinned) { | 
| 701 | 
  | 
  // Create the geometry for nanorod | 
| 702 | 
  | 
   | 
| 703 | 
  | 
  buildtwinned1<HalfedgeDS> crystal1;   | 
| 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(); | 
| 721 | 
> | 
  RealType y1 = crystal1.end1->point().y() - crystal1.neight1->point().y(); | 
| 722 | 
> | 
  RealType y2 = crystal1.end2->point().y() - crystal1.neight2->point().y(); | 
| 723 | 
  | 
   | 
| 724 | 
< | 
  double endDist = sqrt(pow(crystal1.neight2->point().x() - crystal1.neight3->point().x(),2)+ | 
| 724 | 
> | 
  RealType 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; | 
| 728 | 
> | 
  RealType endRatio1 = y1/endDist; | 
| 729 | 
> | 
  RealType endRatio2 = y2/endDist; | 
| 730 | 
  | 
   | 
| 731 | 
  | 
  std::cout << "End dist is " << endDist <<" ratio " << endRatio1 << std::endl; | 
| 732 | 
  | 
   | 
| 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)+ | 
| 748 | 
> | 
  RealType 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 | 
  | 
   |