1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vngeometryutils?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNGeometryUtils;
);
extern_conformance!(
unsafe impl NSObjectProtocol for VNGeometryUtils {}
);
impl VNGeometryUtils {
extern_methods!(
#[cfg(feature = "VNGeometry")]
/// Calculates a bounding circle that includes a collection of points or a VNContour object. Note that because this is based on a geometric shape the aspect ratio is important when using normalized points.
/// This takes the aspect ratio of the contour into account when using a VNContour as an input.
/// boundingCircleForPoints and boundingCircleForSIMDPoints assume that the aspect ratio is correctly applied to the points.
///
///
/// Parameter `contour`: A contour around which to find the bounding circle.
///
///
/// Parameter `points`: A collection of points around which to find the bounding circle.
///
///
/// Parameter `pointCount`: Number of points in points
///
///
/// Parameter `contour`: VNContour object whose bounding circle needs to be calculated
///
///
/// Parameter `error`: An output parameter, populated only in case of algorithmic failure
///
///
/// Returns: the VNCircle object describing the bounding circle or nil, if the algorithm failed. The latter case is accompanied by populating an 'error' output parameter
#[unsafe(method(boundingCircleForContour:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn boundingCircleForContour_error(
contour: &VNContour,
) -> Result<Retained<VNCircle>, Retained<NSError>>;
#[cfg(feature = "VNGeometry")]
#[unsafe(method(boundingCircleForPoints:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn boundingCircleForPoints_error(
points: &NSArray<VNPoint>,
) -> Result<Retained<VNCircle>, Retained<NSError>>;
#[cfg(feature = "VNGeometry")]
/// Calculates a closed contour area using Green's theorem. The contour is represented by a set of points in VNContour object,
/// It's important to note that a random set of points, or a contour with self-crossing edges will likely produce undefined results
/// Note that because this is based on a geometric shape the aspect ratio is important when using normalized points.
/// This takes the aspect ratio of the contour into account when using a VNContour as an input.
///
///
/// Parameter `area`: Output parameter to be populated with calculated contour area
///
///
/// Parameter `contour`: A VNContour object whose area is being calculated
///
///
/// Parameter `orientedArea`: If true, returns signed area - positive for CCW oriented contours and negative for CW oriented contours.
/// If false, returned area is always positive.
///
///
/// Parameter `error`: An output parameter, populated only in case of algorithmic failure
///
///
/// Returns: Area calculation status, YES indicates success, NO - failure. The failure case is accompanied by populating an 'error' output parameter
///
/// # Safety
///
/// `area` must be a valid pointer.
#[unsafe(method(calculateArea:forContour:orientedArea:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn calculateArea_forContour_orientedArea_error(
area: NonNull<c_double>,
contour: &VNContour,
oriented_area: bool,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "VNGeometry")]
/// Calculates perimeter, or a sum of all arc-lengths (edges), of a closed contour. The contour is represented by a set of points in VNContour object.
/// Note that because this is based on a geometric shape the aspect ratio is important when using normalized points.
/// This takes the aspect ratio of the contour into account when using a VNContour as an input.
///
///
/// Parameter `perimeter`: Output parameter to be populated with calculated contour perimeter
///
///
/// Parameter `contour`: A VNContour object whose perimeter is being calculated
///
///
/// Parameter `error`: An output parameter, populated only in case of algorithmic failure
///
///
/// Returns: Perimeter calculation status, YES indicates success, NO - failure. The failure case is accompanied by populating an 'error' output parameter
///
/// # Safety
///
/// `perimeter` must be a valid pointer.
#[unsafe(method(calculatePerimeter:forContour:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn calculatePerimeter_forContour_error(
perimeter: NonNull<c_double>,
contour: &VNContour,
) -> Result<(), Retained<NSError>>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNGeometryUtils {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}