csg_detail.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Begin License:
  2. // Copyright (C) 2006-2014 Tobias Sargeant (tobias.sargeant@gmail.com).
  3. // All rights reserved.
  4. //
  5. // This file is part of the Carve CSG Library (http://carve-csg.com/)
  6. //
  7. // This file may be used under the terms of either the GNU General
  8. // Public License version 2 or 3 (at your option) as published by the
  9. // Free Software Foundation and appearing in the files LICENSE.GPL2
  10. // and LICENSE.GPL3 included in the packaging of this file.
  11. //
  12. // This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
  13. // INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
  14. // A PARTICULAR PURPOSE.
  15. // End:
  16. #pragma once
  17. #include <carve/carve.hpp>
  18. #include <carve/polyhedron_base.hpp>
  19. namespace carve {
  20. namespace csg {
  21. namespace detail {
  22. typedef std::map<carve::mesh::MeshSet<3>::vertex_t *,
  23. std::set<std::pair<carve::mesh::MeshSet<3>::face_t *, double> > > EdgeIntInfo;
  24. typedef std::unordered_set<carve::mesh::MeshSet<3>::vertex_t *> VSet;
  25. typedef std::unordered_set<carve::mesh::MeshSet<3>::face_t *> FSet;
  26. typedef std::set<carve::mesh::MeshSet<3>::vertex_t *> VSetSmall;
  27. typedef std::set<csg::V2> V2SetSmall;
  28. typedef std::set<carve::mesh::MeshSet<3>::face_t *> FSetSmall;
  29. typedef std::unordered_map<carve::mesh::MeshSet<3>::vertex_t *, VSetSmall> VVSMap;
  30. typedef std::unordered_map<carve::mesh::MeshSet<3>::edge_t *, EdgeIntInfo> EIntMap;
  31. typedef std::unordered_map<carve::mesh::MeshSet<3>::face_t *, VSetSmall> FVSMap;
  32. typedef std::unordered_map<carve::mesh::MeshSet<3>::vertex_t *, FSetSmall> VFSMap;
  33. typedef std::unordered_map<carve::mesh::MeshSet<3>::face_t *, V2SetSmall> FV2SMap;
  34. typedef std::unordered_map<
  35. carve::mesh::MeshSet<3>::edge_t *,
  36. std::vector<carve::mesh::MeshSet<3>::vertex_t *> > EVVMap;
  37. typedef std::unordered_map<carve::mesh::MeshSet<3>::vertex_t *,
  38. std::vector<carve::mesh::MeshSet<3>::edge_t *> > VEVecMap;
  39. class LoopEdges : public std::unordered_map<V2, std::list<FaceLoop *> > {
  40. typedef std::unordered_map<V2, std::list<FaceLoop *> > super;
  41. public:
  42. void addFaceLoop(FaceLoop *fl);
  43. void sortFaceLoopLists();
  44. void removeFaceLoop(FaceLoop *fl);
  45. };
  46. }
  47. }
  48. }
  49. static inline std::ostream &operator<<(std::ostream &o, const carve::csg::detail::FSet &s) {
  50. const char *sep="";
  51. for (carve::csg::detail::FSet::const_iterator i = s.begin(); i != s.end(); ++i) {
  52. o << sep << *i; sep=",";
  53. }
  54. return o;
  55. }