// ファイル名： Ch05/SolidLocator/SolidLocator.cc 
#include "./SolidLocator.hh" 
 
SolidLocator::SolidLocator() 
{} 
SolidLocator::~SolidLocator() 
{  
  for(Solid_Position* pSolPos : allSol_Pos){  
    delete pSolPos; } 
} 
void SolidLocator::placeSolid(Solid* pSolid, Point3D solidPos) 
{  
  Solid_Position* pSol_Pos = new Solid_Position(pSolid, solidPos); 
  allSol_Pos.push_back(pSol_Pos); 
} 
vector<Solid*> SolidLocator::isPointInSolids(Point3D testPoint) 
{  
  Solid* pSolid; Point3D solidPosition; Point3D testPointLocal; 
  for(Solid_Position* pSolPos : allSol_Pos){ 
    pSolid        = pSolPos->first; 
    solidPosition = pSolPos->second; 
    for(int i=0; i<testPoint.size(); i++){  
      testPointLocal[i]=testPoint[i]-solidPosition[i]; }   
    if( pSolid->isPointIn(testPointLocal) ) { 
      inSolids.push_back( pSolid ); } 
  } 
  return inSolids; 
}
