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