PolyhedronTest.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // Copyright (C) 2014 OpenSim Ltd.
  3. //
  4. // This program is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU Lesser General Public License
  6. // as published by the Free Software Foundation; either version 2
  7. // of the License, or (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. //
  17. #ifndef __INET_POLYHEDRONTEST_H
  18. #define __INET_POLYHEDRONTEST_H
  19. #include "inet/common/geometry/shape/polyhedron/Polyhedron.h"
  20. #include "inet/common/geometry/common/Coord.h"
  21. #include <vector>
  22. namespace inet {
  23. /*
  24. * This class takes a 3D point set, creates a Polyhedron with its point set
  25. * and then writes the faces and edges out to the standard output.
  26. */
  27. class INET_API PolyhedronTest : public cSimpleModule
  28. {
  29. protected:
  30. Polyhedron *polyhedron;
  31. std::vector<Coord> points;
  32. bool testWithConvexCombations;
  33. protected:
  34. virtual int numInitStages() const { return NUM_INIT_STAGES; }
  35. virtual void initialize(int stage);
  36. virtual void handleMessage(cMessage *msg) { throw cRuntimeError("This module doesn't handle self messages"); }
  37. void parsePoints(const char *strPoints);
  38. void test() const;
  39. void printFaces() const;
  40. public:
  41. PolyhedronTest();
  42. virtual ~PolyhedronTest();
  43. };
  44. } /* namespace inet */
  45. #endif // ifndef __INET_POLYHEDRONTEST_H