Double3.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // Double3.h
  3. //
  4. // Created by Giles Payne on 2020/05/22.
  5. //
  6. #pragma once
  7. #ifdef __cplusplus
  8. #import "opencv2/core.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. @class Mat;
  14. NS_ASSUME_NONNULL_BEGIN
  15. /**
  16. * Simple wrapper for a vector of three `double`
  17. */
  18. CV_EXPORTS @interface Double3 : NSObject
  19. #pragma mark - Properties
  20. /**
  21. * First vector element
  22. */
  23. @property double v0;
  24. /**
  25. * Second vector element
  26. */
  27. @property double v1;
  28. /**
  29. * Third vector element
  30. */
  31. @property double v2;
  32. #ifdef __cplusplus
  33. /**
  34. * The wrapped vector
  35. */
  36. @property(readonly) cv::Vec3d& nativeRef;
  37. #endif
  38. #pragma mark - Constructors
  39. /**
  40. * Create zero-initialize vecior
  41. */
  42. -(instancetype)init;
  43. /**
  44. * Create vector with specified element values
  45. * @param v0 First element
  46. * @param v1 Second element
  47. * @param v2 Third element
  48. */
  49. -(instancetype)initWithV0:(double)v0 v1:(double)v1 v2:(double)v2;
  50. /**
  51. * Create vector with specified element values
  52. * @param vals array of element values
  53. */
  54. -(instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
  55. #ifdef __cplusplus
  56. +(instancetype)fromNative:(cv::Vec3d&)vec3d;
  57. #endif
  58. /**
  59. * Update vector with specified element values
  60. * @param vals array of element values
  61. */
  62. -(void)set:(NSArray<NSNumber*>*)vals NS_SWIFT_NAME(set(vals:));
  63. /**
  64. * Get vector as an array
  65. */
  66. -(NSArray<NSNumber*>*)get;
  67. #pragma mark - Common Methods
  68. /**
  69. * Compare for equality
  70. * @param other Object to compare
  71. */
  72. -(BOOL)isEqual:(nullable id)other;
  73. @end
  74. NS_ASSUME_NONNULL_END