geometry_utils.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2020 by
  4. * The Salk Institute for Biological Studies and
  5. * Pittsburgh Supercomputing Center, Carnegie Mellon University
  6. *
  7. * Use of this source code is governed by an MIT-style
  8. * license that can be found in the LICENSE file or at
  9. * https://opensource.org/licenses/MIT.
  10. *
  11. ******************************************************************************/
  12. #ifndef SRC4_GEOMETRY_UTILS_H_
  13. #define SRC4_GEOMETRY_UTILS_H_
  14. #include "defines.h"
  15. namespace MCell {
  16. class Partition;
  17. class Wall;
  18. struct Vec3;
  19. struct Vec2;
  20. namespace GeometryUtils {
  21. // some commonly used utilities for which one does not need to
  22. // include the whole geometry_utils.inc
  23. static inline Vec3 uv2xyz(const Vec2& a, const Wall& w, const Vec3& wall_vert0) {
  24. return Vec3(a.u) * w.unit_u + Vec3(a.v) * w.unit_v + wall_vert0;
  25. }
  26. // only the needed functions for now
  27. static pos_t closest_interior_point(
  28. const Partition& p,
  29. const Vec3& pt,
  30. const Wall& w,
  31. Vec2& ip
  32. );
  33. } // namespace WallUtil
  34. } // namespace MCell
  35. #endif // SRC4_GEOMETRY_UTILS_H_