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 #[unsafe(method(calculateArea:forContour:orientedArea:error:_))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn calculateArea_forContour_orientedArea_error(
82 area: NonNull<c_double>,
83 contour: &VNContour,
84 oriented_area: bool,
85 ) -> Result<(), Retained<NSError>>;
86
87 #[cfg(feature = "VNGeometry")]
88 /// 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.
89 /// Note that because this is based on a geometric shape the aspect ratio is important when using normalized points.
90 /// This takes the aspect ratio of the contour into account when using a VNContour as an input.
91 ///
92 ///
93 /// Parameter `perimeter`: Output parameter to be populated with calculated contour perimeter
94 ///
95 ///
96 /// Parameter `contour`: A VNContour object whose perimeter is being calculated
97 ///
98 ///
99 /// Parameter `error`: An output parameter, populated only in case of algorithmic failure
100 ///
101 ///
102 /// Returns: Perimeter calculation status, YES indicates success, NO - failure. The failure case is accompanied by populating an 'error' output parameter
103 #[unsafe(method(calculatePerimeter:forContour:error:_))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn calculatePerimeter_forContour_error(
106 perimeter: NonNull<c_double>,
107 contour: &VNContour,
108 ) -> Result<(), Retained<NSError>>;
109 );
110}
111
112/// Methods declared on superclass `NSObject`.
113impl VNGeometryUtils {
114 extern_methods!(
115 #[unsafe(method(init))]
116 #[unsafe(method_family = init)]
117 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
118
119 #[unsafe(method(new))]
120 #[unsafe(method_family = new)]
121 pub unsafe fn new() -> Retained<Self>;
122 );
123}