arsovski

Before

Jun 3rd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1.  
  2. double Entity::getDistanceTo(const Entity& newEntity)
  3. {
  4.     Point2D *cast2D = dynamic_cast<Point2D*>(this->location);
  5.     Point2D *castTo2D = dynamic_cast<Point2D*>(newEntity.location);
  6.     double distance;
  7.     if (cast2D !=nullptr && castTo2D !=nullptr)
  8.     {
  9.         distance = getDistanceTo2D(newEntity);
  10.     }
  11.     else
  12.     {
  13.         distance = getDistanceTo3D(newEntity);
  14.     }
  15.     return distance;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment