objc2_vision/generated/
VNGeometry.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15 #[unsafe(super(NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 pub struct VNPoint;
23);
24
25unsafe impl NSCoding for VNPoint {}
26
27unsafe impl NSCopying for VNPoint {}
28
29unsafe impl CopyingHelper for VNPoint {
30 type Result = Self;
31}
32
33unsafe impl NSObjectProtocol for VNPoint {}
34
35unsafe impl NSSecureCoding for VNPoint {}
36
37impl VNPoint {
38 extern_methods!(
39 #[unsafe(method(zeroPoint))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn zeroPoint() -> Retained<VNPoint>;
43
44 #[unsafe(method(pointByApplyingVector:toPoint:))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn pointByApplyingVector_toPoint(
54 vector: &VNVector,
55 point: &VNPoint,
56 ) -> Retained<VNPoint>;
57
58 #[deprecated]
60 #[unsafe(method(distanceBetweenPoint:point:))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn distanceBetweenPoint_point(point1: &VNPoint, point2: &VNPoint) -> c_double;
63
64 #[unsafe(method(distanceToPoint:))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn distanceToPoint(&self, point: &VNPoint) -> c_double;
72
73 #[unsafe(method(initWithX:y:))]
75 #[unsafe(method_family = init)]
76 pub unsafe fn initWithX_y(
77 this: Allocated<Self>,
78 x: c_double,
79 y: c_double,
80 ) -> Retained<Self>;
81
82 #[cfg(feature = "objc2-core-foundation")]
83 #[unsafe(method(initWithLocation:))]
85 #[unsafe(method_family = init)]
86 pub unsafe fn initWithLocation(this: Allocated<Self>, location: CGPoint) -> Retained<Self>;
87
88 #[cfg(feature = "objc2-core-foundation")]
89 #[unsafe(method(location))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn location(&self) -> CGPoint;
93
94 #[unsafe(method(x))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn x(&self) -> c_double;
98
99 #[unsafe(method(y))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn y(&self) -> c_double;
103 );
104}
105
106impl VNPoint {
108 extern_methods!(
109 #[unsafe(method(init))]
110 #[unsafe(method_family = init)]
111 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
112
113 #[unsafe(method(new))]
114 #[unsafe(method_family = new)]
115 pub unsafe fn new() -> Retained<Self>;
116 );
117}
118
119extern_class!(
120 #[unsafe(super(NSObject))]
126 #[derive(Debug, PartialEq, Eq, Hash)]
127 pub struct VNPoint3D;
128);
129
130unsafe impl NSCoding for VNPoint3D {}
131
132unsafe impl NSCopying for VNPoint3D {}
133
134unsafe impl CopyingHelper for VNPoint3D {
135 type Result = Self;
136}
137
138unsafe impl NSObjectProtocol for VNPoint3D {}
139
140unsafe impl NSSecureCoding for VNPoint3D {}
141
142impl VNPoint3D {
143 extern_methods!(
144 #[unsafe(method(init))]
145 #[unsafe(method_family = init)]
146 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
147 );
148}
149
150impl VNPoint3D {
152 extern_methods!(
153 #[unsafe(method(new))]
154 #[unsafe(method_family = new)]
155 pub unsafe fn new() -> Retained<Self>;
156 );
157}
158
159extern_class!(
160 #[unsafe(super(NSObject))]
164 #[derive(Debug, PartialEq, Eq, Hash)]
165 pub struct VNVector;
166);
167
168unsafe impl NSCoding for VNVector {}
169
170unsafe impl NSCopying for VNVector {}
171
172unsafe impl CopyingHelper for VNVector {
173 type Result = Self;
174}
175
176unsafe impl NSObjectProtocol for VNVector {}
177
178unsafe impl NSSecureCoding for VNVector {}
179
180impl VNVector {
181 extern_methods!(
182 #[unsafe(method(zeroVector))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn zeroVector() -> Retained<VNVector>;
186
187 #[unsafe(method(unitVectorForVector:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn unitVectorForVector(vector: &VNVector) -> Retained<VNVector>;
191
192 #[unsafe(method(vectorByMultiplyingVector:byScalar:))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn vectorByMultiplyingVector_byScalar(
196 vector: &VNVector,
197 scalar: c_double,
198 ) -> Retained<VNVector>;
199
200 #[unsafe(method(vectorByAddingVector:toVector:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn vectorByAddingVector_toVector(
204 v1: &VNVector,
205 v2: &VNVector,
206 ) -> Retained<VNVector>;
207
208 #[unsafe(method(vectorBySubtractingVector:fromVector:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn vectorBySubtractingVector_fromVector(
212 v1: &VNVector,
213 v2: &VNVector,
214 ) -> Retained<VNVector>;
215
216 #[unsafe(method(dotProductOfVector:vector:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn dotProductOfVector_vector(v1: &VNVector, v2: &VNVector) -> c_double;
220
221 #[unsafe(method(initWithXComponent:yComponent:))]
223 #[unsafe(method_family = init)]
224 pub unsafe fn initWithXComponent_yComponent(
225 this: Allocated<Self>,
226 x: c_double,
227 y: c_double,
228 ) -> Retained<Self>;
229
230 #[unsafe(method(initWithR:theta:))]
233 #[unsafe(method_family = init)]
234 pub unsafe fn initWithR_theta(
235 this: Allocated<Self>,
236 r: c_double,
237 theta: c_double,
238 ) -> Retained<Self>;
239
240 #[unsafe(method(initWithVectorHead:tail:))]
242 #[unsafe(method_family = init)]
243 pub unsafe fn initWithVectorHead_tail(
244 this: Allocated<Self>,
245 head: &VNPoint,
246 tail: &VNPoint,
247 ) -> Retained<Self>;
248
249 #[unsafe(method(x))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn x(&self) -> c_double;
253
254 #[unsafe(method(y))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn y(&self) -> c_double;
258
259 #[unsafe(method(r))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn r(&self) -> c_double;
263
264 #[unsafe(method(theta))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn theta(&self) -> c_double;
268
269 #[unsafe(method(length))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn length(&self) -> c_double;
273
274 #[unsafe(method(squaredLength))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn squaredLength(&self) -> c_double;
278 );
279}
280
281impl VNVector {
283 extern_methods!(
284 #[unsafe(method(init))]
285 #[unsafe(method_family = init)]
286 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
287
288 #[unsafe(method(new))]
289 #[unsafe(method_family = new)]
290 pub unsafe fn new() -> Retained<Self>;
291 );
292}
293
294extern_class!(
295 #[unsafe(super(NSObject))]
299 #[derive(Debug, PartialEq, Eq, Hash)]
300 pub struct VNCircle;
301);
302
303unsafe impl NSCoding for VNCircle {}
304
305unsafe impl NSCopying for VNCircle {}
306
307unsafe impl CopyingHelper for VNCircle {
308 type Result = Self;
309}
310
311unsafe impl NSObjectProtocol for VNCircle {}
312
313unsafe impl NSSecureCoding for VNCircle {}
314
315impl VNCircle {
316 extern_methods!(
317 #[unsafe(method(zeroCircle))]
319 #[unsafe(method_family = none)]
320 pub unsafe fn zeroCircle() -> Retained<VNCircle>;
321
322 #[unsafe(method(initWithCenter:radius:))]
324 #[unsafe(method_family = init)]
325 pub unsafe fn initWithCenter_radius(
326 this: Allocated<Self>,
327 center: &VNPoint,
328 radius: c_double,
329 ) -> Retained<Self>;
330
331 #[unsafe(method(initWithCenter:diameter:))]
333 #[unsafe(method_family = init)]
334 pub unsafe fn initWithCenter_diameter(
335 this: Allocated<Self>,
336 center: &VNPoint,
337 diameter: c_double,
338 ) -> Retained<Self>;
339
340 #[unsafe(method(containsPoint:))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn containsPoint(&self, point: &VNPoint) -> bool;
344
345 #[unsafe(method(containsPoint:inCircumferentialRingOfWidth:))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn containsPoint_inCircumferentialRingOfWidth(
349 &self,
350 point: &VNPoint,
351 ring_width: c_double,
352 ) -> bool;
353
354 #[unsafe(method(center))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn center(&self) -> Retained<VNPoint>;
358
359 #[unsafe(method(radius))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn radius(&self) -> c_double;
363
364 #[unsafe(method(diameter))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn diameter(&self) -> c_double;
368 );
369}
370
371impl VNCircle {
373 extern_methods!(
374 #[unsafe(method(init))]
375 #[unsafe(method_family = init)]
376 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
377
378 #[unsafe(method(new))]
379 #[unsafe(method_family = new)]
380 pub unsafe fn new() -> Retained<Self>;
381 );
382}
383
384extern_class!(
385 #[unsafe(super(NSObject))]
394 #[derive(Debug, PartialEq, Eq, Hash)]
395 pub struct VNContour;
396);
397
398unsafe impl NSCopying for VNContour {}
399
400unsafe impl CopyingHelper for VNContour {
401 type Result = Self;
402}
403
404unsafe impl NSObjectProtocol for VNContour {}
405
406#[cfg(feature = "VNRequestRevisionProviding")]
407unsafe impl VNRequestRevisionProviding for VNContour {}
408
409impl VNContour {
410 extern_methods!(
411 #[unsafe(method(new))]
412 #[unsafe(method_family = new)]
413 pub unsafe fn new() -> Retained<Self>;
414
415 #[unsafe(method(init))]
416 #[unsafe(method_family = init)]
417 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
418
419 #[unsafe(method(indexPath))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn indexPath(&self) -> Retained<NSIndexPath>;
423
424 #[unsafe(method(childContourCount))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn childContourCount(&self) -> NSInteger;
430
431 #[unsafe(method(childContours))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn childContours(&self) -> Retained<NSArray<VNContour>>;
437
438 #[unsafe(method(childContourAtIndex:error:_))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn childContourAtIndex_error(
448 &self,
449 child_contour_index: NSUInteger,
450 ) -> Result<Retained<VNContour>, Retained<NSError>>;
451
452 #[unsafe(method(pointCount))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn pointCount(&self) -> NSInteger;
456
457 #[cfg(feature = "objc2-core-graphics")]
458 #[unsafe(method(normalizedPath))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn normalizedPath(&self) -> Retained<CGPath>;
464
465 #[unsafe(method(aspectRatio))]
467 #[unsafe(method_family = none)]
468 pub unsafe fn aspectRatio(&self) -> c_float;
469
470 #[unsafe(method(polygonApproximationWithEpsilon:error:_))]
482 #[unsafe(method_family = none)]
483 pub unsafe fn polygonApproximationWithEpsilon_error(
484 &self,
485 epsilon: c_float,
486 ) -> Result<Retained<VNContour>, Retained<NSError>>;
487 );
488}