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