Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

geoconstants.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //-----------------------------------------------------------------------------
  2. // Project : SDK Core
  3. //
  4. // Category : SDK Core Interfaces
  5. // Filename : pluginterfaces/base/geoconstants.h
  6. // Created by : Steinberg, 11/2014
  7. // Description : Defines orientations and directions as also used by fpoint.h and frect.h
  8. //
  9. //-----------------------------------------------------------------------------
  10. // This file is part of a Steinberg SDK. It is subject to the license terms
  11. // in the LICENSE file found in the top-level directory of this distribution
  12. // and at www.steinberg.net/sdklicenses.
  13. // No part of the SDK, including this file, may be copied, modified, propagated,
  14. // or distributed except according to the terms contained in the LICENSE file.
  15. //-----------------------------------------------------------------------------
  16. #pragma once
  17. //------------------------------------------------------------------------
  18. namespace Steinberg {
  19. //------------------------------------------------------------------------
  20. enum Direction
  21. {
  22. kNorth,
  23. kNorthEast,
  24. kEast,
  25. kSouthEast,
  26. kSouth,
  27. kSouthWest,
  28. kWest,
  29. kNorthWest,
  30. kNoDirection, //same position or center point of a geometry
  31. kNumberOfDirections
  32. };
  33. //------------------------------------------------------------------------
  34. enum Orientation
  35. {
  36. kHorizontal,
  37. kVertical,
  38. kNumberOfOrientations
  39. };
  40. //------------------------------------------------------------------------
  41. namespace GeoConstants {
  42. //------------------------------------------------------------------------
  43. inline Direction toOpposite (Direction dir)
  44. {
  45. switch (dir)
  46. {
  47. case kNorth : return kSouth;
  48. case kNorthEast : return kSouthWest;
  49. case kEast : return kWest;
  50. case kSouthEast : return kNorthWest;
  51. case kSouth : return kNorth;
  52. case kSouthWest : return kNorthEast;
  53. case kWest : return kEast;
  54. case kNorthWest : return kSouthEast;
  55. case kNoDirection : return kNoDirection;
  56. default:
  57. return kNumberOfDirections;
  58. }
  59. }
  60. //------------------------------------------------------------------------
  61. inline Orientation toOrientation (Direction dir)
  62. {
  63. switch (dir)
  64. {
  65. case kNorth : return kVertical;
  66. case kEast : return kHorizontal;
  67. case kSouth : return kVertical;
  68. case kWest : return kHorizontal;
  69. default:
  70. return kNumberOfOrientations;
  71. }
  72. }
  73. //------------------------------------------------------------------------
  74. inline Orientation toOrthogonalOrientation (Orientation dir)
  75. {
  76. switch (dir)
  77. {
  78. case kVertical : return kHorizontal;
  79. case kHorizontal : return kVertical;
  80. default:
  81. return kNumberOfOrientations;
  82. }
  83. }
  84. //------------------------------------------------------------------------
  85. } // namespace GeoConstants
  86. } // namespace Steinberg