Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1.     //above code draw pentagons and points of their lines intersections
  2.     // get models
  3.     bioessence_vector models = DataMgr()->getBioCard()->getModels();
  4.     std::vector<std::vector<mathix::vector3>> intersections;
  5.  
  6.     // copy current model to MathEssence data structure
  7.     int current_model = 0;
  8.     MathEssence* M = WorldMgr()->createEssence<MathEssence>(
  9.         "type:MathEssence,name:$unique_name,copy_essence:" + models[current_model]->getName());
  10.  
  11.     // prepare planes to intersect
  12.     std::vector<contours::Plane> planes;
  13.     vector3 A = nose;
  14.     vector3 B = mouthR;
  15.     vector3 C = vector3(0, 0, -1);
  16.     planes.push_back(contours::Plane(A, B, C));
  17.  
  18.     // intersect model by planes
  19.     // vector of edges included in 'intersections' for each plane
  20.     contours::calculateIntersections(M->getName(), planes, intersections);
  21.     for (auto it = 0; it != intersections.size(); it++)
  22.         {
  23.             for (auto jt = intersections[it].begin(); jt != intersections[it].end(); jt++)
  24.             {
  25.             string point_name = unique_name();
  26.             string pointMeshName = unique_name();
  27.             WorldMgr()->createEssence<GraphicsEssence>("type : GraphicsEssence, position : " + to_string(*jt) + ", name : " +
  28.                 point_name + ", entity : { mesh_name : " + pointMeshName + ", mesh_type : MT_SPHERE, radius: " +
  29.                 to_string(0.006124 ) + "}, custom_material_name : Yellow");
  30.             }
  31.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement