1 // 2 // Point3f.h 3 // 4 // Created by Giles Payne on 2019/10/09. 5 // 6 7 #pragma once 8 9 #ifdef __cplusplus 10 #import "opencv2/core.hpp" 11 #else 12 #define CV_EXPORTS 13 #endif 14 15 #import <Foundation/Foundation.h> 16 17 @class Point2f; 18 19 NS_ASSUME_NONNULL_BEGIN 20 21 /** 22 * Represents a three dimensional point the coordinate values of which are of type `float` 23 */ 24 CV_EXPORTS @interface Point3f : NSObject 25 26 # pragma mark - Properties 27 28 @property float x; 29 @property float y; 30 @property float z; 31 #ifdef __cplusplus 32 @property(readonly) cv::Point3f& nativeRef; 33 #endif 34 35 # pragma mark - Constructors 36 37 - (instancetype)init; 38 - (instancetype)initWithX:(float)x y:(float)y z:(float)z; 39 - (instancetype)initWithPoint:(Point2f*)point; 40 - (instancetype)initWithVals:(NSArray<NSNumber*>*)vals; 41 42 #ifdef __cplusplus 43 + (instancetype)fromNative:(cv::Point3f&)point; 44 - (void)update:(cv::Point3f&)point; 45 #endif 46 47 # pragma mark - Methods 48 49 /** 50 * Calculate the dot product of this point and another point 51 * @param point The other point 52 */ 53 - (double)dot:(Point3f*)point; 54 55 /** 56 * Calculate the cross product of this point and another point 57 * @param point The other point 58 */ 59 - (Point3f*)cross:(Point3f*)point; 60 61 /** 62 * Set the point coordinates from the values of an array 63 * @param vals The array of values from which to set the coordinates 64 */ 65 - (void)set:(NSArray<NSNumber*>*)vals NS_SWIFT_NAME(set(vals:)); 66 67 # pragma mark - Common Methods 68 69 /** 70 * Clone object 71 */ 72 - (Point3f*)clone; 73 74 /** 75 * Compare for equality 76 * @param other Object to compare 77 */ 78 - (BOOL)isEqual:(nullable id)other; 79 80 /** 81 * Calculate hash value for this object 82 */ 83 - (NSUInteger)hash; 84 85 /** 86 * Returns a string that describes the contents of the object 87 */ 88 - (NSString *)description; 89 @end 90 91 NS_ASSUME_NONNULL_END 92