Point3f.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // Point3f.h
  3. //
  4. // Created by Giles Payne on 2019/10/09.
  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 Point2f;
  14. NS_ASSUME_NONNULL_BEGIN
  15. /**
  16. * Represents a three dimensional point the coordinate values of which are of type `float`
  17. */
  18. CV_EXPORTS @interface Point3f : NSObject
  19. # pragma mark - Properties
  20. @property float x;
  21. @property float y;
  22. @property float z;
  23. #ifdef __cplusplus
  24. @property(readonly) cv::Point3f& nativeRef;
  25. #endif
  26. # pragma mark - Constructors
  27. - (instancetype)init;
  28. - (instancetype)initWithX:(float)x y:(float)y z:(float)z;
  29. - (instancetype)initWithPoint:(Point2f*)point;
  30. - (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
  31. #ifdef __cplusplus
  32. + (instancetype)fromNative:(cv::Point3f&)point;
  33. - (void)update:(cv::Point3f&)point;
  34. #endif
  35. # pragma mark - Methods
  36. /**
  37. * Calculate the dot product of this point and another point
  38. * @param point The other point
  39. */
  40. - (double)dot:(Point3f*)point;
  41. /**
  42. * Calculate the cross product of this point and another point
  43. * @param point The other point
  44. */
  45. - (Point3f*)cross:(Point3f*)point;
  46. /**
  47. * Set the point coordinates from the values of an array
  48. * @param vals The array of values from which to set the coordinates
  49. */
  50. - (void)set:(NSArray<NSNumber*>*)vals NS_SWIFT_NAME(set(vals:));
  51. # pragma mark - Common Methods
  52. /**
  53. * Clone object
  54. */
  55. - (Point3f*)clone;
  56. /**
  57. * Compare for equality
  58. * @param other Object to compare
  59. */
  60. - (BOOL)isEqual:(nullable id)other;
  61. /**
  62. * Calculate hash value for this object
  63. */
  64. - (NSUInteger)hash;
  65. /**
  66. * Returns a string that describes the contents of the object
  67. */
  68. - (NSString *)description;
  69. @end
  70. NS_ASSUME_NONNULL_END