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
25extern_conformance!(
26 unsafe impl NSCoding for VNPoint {}
27);
28
29extern_conformance!(
30 unsafe impl NSCopying for VNPoint {}
31);
32
33unsafe impl CopyingHelper for VNPoint {
34 type Result = Self;
35}
36
37extern_conformance!(
38 unsafe impl NSObjectProtocol for VNPoint {}
39);
40
41extern_conformance!(
42 unsafe impl NSSecureCoding for VNPoint {}
43);
44
45impl VNPoint {
46 extern_methods!(
47 #[unsafe(method(zeroPoint))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn zeroPoint() -> Retained<VNPoint>;
51
52 #[unsafe(method(pointByApplyingVector:toPoint:))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn pointByApplyingVector_toPoint(
62 vector: &VNVector,
63 point: &VNPoint,
64 ) -> Retained<VNPoint>;
65
66 #[deprecated]
68 #[unsafe(method(distanceBetweenPoint:point:))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn distanceBetweenPoint_point(point1: &VNPoint, point2: &VNPoint) -> c_double;
71
72 #[unsafe(method(distanceToPoint:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn distanceToPoint(&self, point: &VNPoint) -> c_double;
80
81 #[unsafe(method(initWithX:y:))]
83 #[unsafe(method_family = init)]
84 pub unsafe fn initWithX_y(
85 this: Allocated<Self>,
86 x: c_double,
87 y: c_double,
88 ) -> Retained<Self>;
89
90 #[cfg(feature = "objc2-core-foundation")]
91 #[unsafe(method(initWithLocation:))]
93 #[unsafe(method_family = init)]
94 pub unsafe fn initWithLocation(this: Allocated<Self>, location: CGPoint) -> Retained<Self>;
95
96 #[cfg(feature = "objc2-core-foundation")]
97 #[unsafe(method(location))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn location(&self) -> CGPoint;
101
102 #[unsafe(method(x))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn x(&self) -> c_double;
106
107 #[unsafe(method(y))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn y(&self) -> c_double;
111 );
112}
113
114impl VNPoint {
116 extern_methods!(
117 #[unsafe(method(init))]
118 #[unsafe(method_family = init)]
119 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
120
121 #[unsafe(method(new))]
122 #[unsafe(method_family = new)]
123 pub unsafe fn new() -> Retained<Self>;
124 );
125}
126
127extern_class!(
128 #[unsafe(super(NSObject))]
134 #[derive(Debug, PartialEq, Eq, Hash)]
135 pub struct VNPoint3D;
136);
137
138extern_conformance!(
139 unsafe impl NSCoding for VNPoint3D {}
140);
141
142extern_conformance!(
143 unsafe impl NSCopying for VNPoint3D {}
144);
145
146unsafe impl CopyingHelper for VNPoint3D {
147 type Result = Self;
148}
149
150extern_conformance!(
151 unsafe impl NSObjectProtocol for VNPoint3D {}
152);
153
154extern_conformance!(
155 unsafe impl NSSecureCoding for VNPoint3D {}
156);
157
158impl VNPoint3D {
159 extern_methods!(
160 #[unsafe(method(init))]
161 #[unsafe(method_family = init)]
162 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
163 );
164}
165
166impl VNPoint3D {
168 extern_methods!(
169 #[unsafe(method(new))]
170 #[unsafe(method_family = new)]
171 pub unsafe fn new() -> Retained<Self>;
172 );
173}
174
175extern_class!(
176 #[unsafe(super(NSObject))]
180 #[derive(Debug, PartialEq, Eq, Hash)]
181 pub struct VNVector;
182);
183
184extern_conformance!(
185 unsafe impl NSCoding for VNVector {}
186);
187
188extern_conformance!(
189 unsafe impl NSCopying for VNVector {}
190);
191
192unsafe impl CopyingHelper for VNVector {
193 type Result = Self;
194}
195
196extern_conformance!(
197 unsafe impl NSObjectProtocol for VNVector {}
198);
199
200extern_conformance!(
201 unsafe impl NSSecureCoding for VNVector {}
202);
203
204impl VNVector {
205 extern_methods!(
206 #[unsafe(method(zeroVector))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn zeroVector() -> Retained<VNVector>;
210
211 #[unsafe(method(unitVectorForVector:))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn unitVectorForVector(vector: &VNVector) -> Retained<VNVector>;
215
216 #[unsafe(method(vectorByMultiplyingVector:byScalar:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn vectorByMultiplyingVector_byScalar(
220 vector: &VNVector,
221 scalar: c_double,
222 ) -> Retained<VNVector>;
223
224 #[unsafe(method(vectorByAddingVector:toVector:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn vectorByAddingVector_toVector(
228 v1: &VNVector,
229 v2: &VNVector,
230 ) -> Retained<VNVector>;
231
232 #[unsafe(method(vectorBySubtractingVector:fromVector:))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn vectorBySubtractingVector_fromVector(
236 v1: &VNVector,
237 v2: &VNVector,
238 ) -> Retained<VNVector>;
239
240 #[unsafe(method(dotProductOfVector:vector:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn dotProductOfVector_vector(v1: &VNVector, v2: &VNVector) -> c_double;
244
245 #[unsafe(method(initWithXComponent:yComponent:))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn initWithXComponent_yComponent(
249 this: Allocated<Self>,
250 x: c_double,
251 y: c_double,
252 ) -> Retained<Self>;
253
254 #[unsafe(method(initWithR:theta:))]
257 #[unsafe(method_family = init)]
258 pub unsafe fn initWithR_theta(
259 this: Allocated<Self>,
260 r: c_double,
261 theta: c_double,
262 ) -> Retained<Self>;
263
264 #[unsafe(method(initWithVectorHead:tail:))]
266 #[unsafe(method_family = init)]
267 pub unsafe fn initWithVectorHead_tail(
268 this: Allocated<Self>,
269 head: &VNPoint,
270 tail: &VNPoint,
271 ) -> Retained<Self>;
272
273 #[unsafe(method(x))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn x(&self) -> c_double;
277
278 #[unsafe(method(y))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn y(&self) -> c_double;
282
283 #[unsafe(method(r))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn r(&self) -> c_double;
287
288 #[unsafe(method(theta))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn theta(&self) -> c_double;
292
293 #[unsafe(method(length))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn length(&self) -> c_double;
297
298 #[unsafe(method(squaredLength))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn squaredLength(&self) -> c_double;
302 );
303}
304
305impl VNVector {
307 extern_methods!(
308 #[unsafe(method(init))]
309 #[unsafe(method_family = init)]
310 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
311
312 #[unsafe(method(new))]
313 #[unsafe(method_family = new)]
314 pub unsafe fn new() -> Retained<Self>;
315 );
316}
317
318extern_class!(
319 #[unsafe(super(NSObject))]
323 #[derive(Debug, PartialEq, Eq, Hash)]
324 pub struct VNCircle;
325);
326
327extern_conformance!(
328 unsafe impl NSCoding for VNCircle {}
329);
330
331extern_conformance!(
332 unsafe impl NSCopying for VNCircle {}
333);
334
335unsafe impl CopyingHelper for VNCircle {
336 type Result = Self;
337}
338
339extern_conformance!(
340 unsafe impl NSObjectProtocol for VNCircle {}
341);
342
343extern_conformance!(
344 unsafe impl NSSecureCoding for VNCircle {}
345);
346
347impl VNCircle {
348 extern_methods!(
349 #[unsafe(method(zeroCircle))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn zeroCircle() -> Retained<VNCircle>;
353
354 #[unsafe(method(initWithCenter:radius:))]
356 #[unsafe(method_family = init)]
357 pub unsafe fn initWithCenter_radius(
358 this: Allocated<Self>,
359 center: &VNPoint,
360 radius: c_double,
361 ) -> Retained<Self>;
362
363 #[unsafe(method(initWithCenter:diameter:))]
365 #[unsafe(method_family = init)]
366 pub unsafe fn initWithCenter_diameter(
367 this: Allocated<Self>,
368 center: &VNPoint,
369 diameter: c_double,
370 ) -> Retained<Self>;
371
372 #[unsafe(method(containsPoint:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn containsPoint(&self, point: &VNPoint) -> bool;
376
377 #[unsafe(method(containsPoint:inCircumferentialRingOfWidth:))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn containsPoint_inCircumferentialRingOfWidth(
381 &self,
382 point: &VNPoint,
383 ring_width: c_double,
384 ) -> bool;
385
386 #[unsafe(method(center))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn center(&self) -> Retained<VNPoint>;
390
391 #[unsafe(method(radius))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn radius(&self) -> c_double;
395
396 #[unsafe(method(diameter))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn diameter(&self) -> c_double;
400 );
401}
402
403impl VNCircle {
405 extern_methods!(
406 #[unsafe(method(init))]
407 #[unsafe(method_family = init)]
408 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
409
410 #[unsafe(method(new))]
411 #[unsafe(method_family = new)]
412 pub unsafe fn new() -> Retained<Self>;
413 );
414}
415
416extern_class!(
417 #[unsafe(super(NSObject))]
426 #[derive(Debug, PartialEq, Eq, Hash)]
427 pub struct VNContour;
428);
429
430extern_conformance!(
431 unsafe impl NSCopying for VNContour {}
432);
433
434unsafe impl CopyingHelper for VNContour {
435 type Result = Self;
436}
437
438extern_conformance!(
439 unsafe impl NSObjectProtocol for VNContour {}
440);
441
442#[cfg(feature = "VNRequestRevisionProviding")]
443extern_conformance!(
444 unsafe impl VNRequestRevisionProviding for VNContour {}
445);
446
447impl VNContour {
448 extern_methods!(
449 #[unsafe(method(new))]
450 #[unsafe(method_family = new)]
451 pub unsafe fn new() -> Retained<Self>;
452
453 #[unsafe(method(init))]
454 #[unsafe(method_family = init)]
455 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
456
457 #[unsafe(method(indexPath))]
459 #[unsafe(method_family = none)]
460 pub unsafe fn indexPath(&self) -> Retained<NSIndexPath>;
461
462 #[unsafe(method(childContourCount))]
466 #[unsafe(method_family = none)]
467 pub unsafe fn childContourCount(&self) -> NSInteger;
468
469 #[unsafe(method(childContours))]
473 #[unsafe(method_family = none)]
474 pub unsafe fn childContours(&self) -> Retained<NSArray<VNContour>>;
475
476 #[unsafe(method(childContourAtIndex:error:_))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn childContourAtIndex_error(
486 &self,
487 child_contour_index: NSUInteger,
488 ) -> Result<Retained<VNContour>, Retained<NSError>>;
489
490 #[unsafe(method(pointCount))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn pointCount(&self) -> NSInteger;
494
495 #[cfg(feature = "objc2-core-graphics")]
496 #[unsafe(method(normalizedPath))]
500 #[unsafe(method_family = none)]
501 pub unsafe fn normalizedPath(&self) -> Retained<CGPath>;
502
503 #[unsafe(method(aspectRatio))]
505 #[unsafe(method_family = none)]
506 pub unsafe fn aspectRatio(&self) -> c_float;
507
508 #[unsafe(method(polygonApproximationWithEpsilon:error:_))]
520 #[unsafe(method_family = none)]
521 pub unsafe fn polygonApproximationWithEpsilon_error(
522 &self,
523 epsilon: c_float,
524 ) -> Result<Retained<VNContour>, Retained<NSError>>;
525 );
526}