vtk-rs 0.3.0

Rust bindings for the Visualization Toolkit (VTK)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
/// nonlinear optimization with a simplex
///
///
/// vtkAmoebaMinimizer will modify a set of parameters in order to find
/// the minimum of a specified function.  The method used is commonly
/// known as the amoeba method, it constructs an n-dimensional simplex
/// in parameter space (i.e. a tetrahedron if the number or parameters
/// is 3) and moves the vertices around parameter space until a local
/// minimum is found.  The amoeba method is robust, reasonably efficient,
/// but is not guaranteed to find the global minimum if several local
/// minima exist.
#[allow(non_camel_case_types)]
pub struct vtkAmoebaMinimizer(*mut core::ffi::c_void);
impl vtkAmoebaMinimizer {
    /// Creates a new [vtkAmoebaMinimizer] wrapped inside `vtkNew`
    #[doc(alias = "vtkAmoebaMinimizer")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkAmoebaMinimizer_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkAmoebaMinimizer_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkAmoebaMinimizer_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkAmoebaMinimizer_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkAmoebaMinimizer {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkAmoebaMinimizer {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkAmoebaMinimizer_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkAmoebaMinimizer_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkAmoebaMinimizer_create_drop() {
    let obj = vtkAmoebaMinimizer::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkAmoebaMinimizer(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// perform Discrete Fourier Transforms
///
///
/// vtkFFT provides methods to perform Discrete Fourier Transforms (DFT).
/// These include providing forward and reverse Fourier transforms.
/// The current implementation uses the third-party library kissfft.
///
/// The terminology tries to follow the Numpy terminology, that is :
/// - Fft means the Fast Fourier Transform algorithm
/// - Prefix `R` stands for Real (meaning optimized function for real inputs)
/// - Prefix `I` stands for Inverse
///
/// Some functions provides pointer-based version of themself in order to
/// prevent copying memory when possible.
#[allow(non_camel_case_types)]
pub struct vtkFFT(*mut core::ffi::c_void);
impl vtkFFT {
    /// Creates a new [vtkFFT] wrapped inside `vtkNew`
    #[doc(alias = "vtkFFT")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkFFT_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkFFT_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkFFT_get_ptr(sself: *mut core::ffi::c_void) -> *mut core::ffi::c_void;
        }
        unsafe { vtkFFT_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkFFT {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkFFT {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkFFT_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkFFT_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkFFT_create_drop() {
    let obj = vtkFFT::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkFFT(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// represent and manipulate 3x3 transformation matrices
///
///
/// vtkMatrix3x3 is a class to represent and manipulate 3x3 matrices.
/// Specifically, it is designed to work on 3x3 transformation matrices
/// found in 2D rendering using homogeneous coordinates [x y w].
///
/// @sa
/// vtkTransform2D
#[allow(non_camel_case_types)]
pub struct vtkMatrix3x3(*mut core::ffi::c_void);
impl vtkMatrix3x3 {
    /// Creates a new [vtkMatrix3x3] wrapped inside `vtkNew`
    #[doc(alias = "vtkMatrix3x3")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkMatrix3x3_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkMatrix3x3_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkMatrix3x3_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkMatrix3x3_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkMatrix3x3 {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkMatrix3x3 {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkMatrix3x3_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkMatrix3x3_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkMatrix3x3_create_drop() {
    let obj = vtkMatrix3x3::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkMatrix3x3(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// represent and manipulate 4x4 transformation matrices
///
///
/// vtkMatrix4x4 is a class to represent and manipulate 4x4 matrices.
/// Specifically, it is designed to work on 4x4 transformation matrices
/// found in 3D rendering using homogeneous coordinates [x y z w].
/// Many of the methods take an array of 16 doubles in row-major format.
/// Note that OpenGL stores matrices in column-major format, so the matrix
/// contents must be transposed when they are moved between OpenGL and VTK.
/// @sa
/// vtkTransform
#[allow(non_camel_case_types)]
pub struct vtkMatrix4x4(*mut core::ffi::c_void);
impl vtkMatrix4x4 {
    /// Creates a new [vtkMatrix4x4] wrapped inside `vtkNew`
    #[doc(alias = "vtkMatrix4x4")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkMatrix4x4_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkMatrix4x4_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkMatrix4x4_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkMatrix4x4_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkMatrix4x4 {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkMatrix4x4 {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkMatrix4x4_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkMatrix4x4_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkMatrix4x4_create_drop() {
    let obj = vtkMatrix4x4::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkMatrix4x4(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// polynomial solvers
///
///
/// vtkPolynomialSolversUnivariate provides solvers for
/// univariate polynomial equations with real coefficients.
/// The Tartaglia-Cardan and Ferrari solvers work on polynomials of fixed
/// degree 3 and 4, respectively.
/// The Lin-Bairstow and Sturm solvers work on polynomials of arbitrary
/// degree. The Sturm solver is the most robust solver but only reports
/// roots within an interval and does not report multiplicities.
/// The Lin-Bairstow solver reports multiplicities.
///
/// For difficult polynomials, you may wish to use FilterRoots to
/// eliminate some of the roots reported by the Sturm solver.
/// FilterRoots evaluates the derivatives near each root to
/// eliminate cases where a local minimum or maximum is close
/// to zero.
///
/// @par Thanks:
/// Thanks to Philippe Pebay, Korben Rusek, David Thompson, and Maurice Rojas
/// for implementing these solvers.
#[allow(non_camel_case_types)]
pub struct vtkPolynomialSolversUnivariate(*mut core::ffi::c_void);
impl vtkPolynomialSolversUnivariate {
    /// Creates a new [vtkPolynomialSolversUnivariate] wrapped inside `vtkNew`
    #[doc(alias = "vtkPolynomialSolversUnivariate")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkPolynomialSolversUnivariate_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkPolynomialSolversUnivariate_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkPolynomialSolversUnivariate_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkPolynomialSolversUnivariate_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkPolynomialSolversUnivariate {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkPolynomialSolversUnivariate {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkPolynomialSolversUnivariate_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkPolynomialSolversUnivariate_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkPolynomialSolversUnivariate_create_drop() {
    let obj = vtkPolynomialSolversUnivariate::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkPolynomialSolversUnivariate(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// interpolate a quaternion
///
///
/// This class is used to interpolate a series of quaternions representing
/// the rotations of a 3D object.  The interpolation may be linear in form
/// (using spherical linear interpolation SLERP), or via spline interpolation
/// (using SQUAD). In either case the interpolation is specialized to
/// quaternions since the interpolation occurs on the surface of the unit
/// quaternion sphere.
///
/// To use this class, specify at least two pairs of (t,q[4]) with the
/// AddQuaternion() method.  Next interpolate the tuples with the
/// InterpolateQuaternion(t,q[4]) method, where "t" must be in the range of
/// (t_min,t_max) parameter values specified by the AddQuaternion() method (t
/// is clamped otherwise), and q[4] is filled in by the method.
///
/// There are several important background references. Ken Shoemake described
/// the practical application of quaternions for the interpolation of rotation
/// (K. Shoemake, "Animating rotation with quaternion curves", Computer
/// Graphics (Siggraph '85) 19(3):245--254, 1985). Another fine reference
/// (available on-line) is E. B. Dam, M. Koch, and M. Lillholm, Technical
/// Report DIKU-TR-98/5, Dept. of Computer Science, University of Copenhagen,
/// Denmark.
///
/// @warning
/// Note that for two or less quaternions, Slerp (linear) interpolation is
/// performed even if spline interpolation is requested. Also, the tangents to
/// the first and last segments of spline interpolation are (arbitrarily)
/// defined by repeating the first and last quaternions.
///
/// @warning
/// There are several methods particular to quaternions (norms, products,
/// etc.) implemented interior to this class. These may be moved to a separate
/// quaternion class at some point.
///
/// @sa
/// vtkQuaternion
#[allow(non_camel_case_types)]
pub struct vtkQuaternionInterpolator(*mut core::ffi::c_void);
impl vtkQuaternionInterpolator {
    /// Creates a new [vtkQuaternionInterpolator] wrapped inside `vtkNew`
    #[doc(alias = "vtkQuaternionInterpolator")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkQuaternionInterpolator_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkQuaternionInterpolator_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkQuaternionInterpolator_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkQuaternionInterpolator_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkQuaternionInterpolator {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkQuaternionInterpolator {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkQuaternionInterpolator_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkQuaternionInterpolator_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkQuaternionInterpolator_create_drop() {
    let obj = vtkQuaternionInterpolator::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkQuaternionInterpolator(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// Integrate an initial value problem using 2nd
///
/// order Runge-Kutta method.
///
///
/// This is a concrete sub-class of vtkInitialValueProblemSolver.
/// It uses a 2nd order Runge-Kutta method to obtain the values of
/// a set of functions at the next time step.
///
/// @sa
/// vtkInitialValueProblemSolver vtkRungeKutta4 vtkRungeKutta45 vtkFunctionSet
#[allow(non_camel_case_types)]
pub struct vtkRungeKutta2(*mut core::ffi::c_void);
impl vtkRungeKutta2 {
    /// Creates a new [vtkRungeKutta2] wrapped inside `vtkNew`
    #[doc(alias = "vtkRungeKutta2")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkRungeKutta2_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkRungeKutta2_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkRungeKutta2_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkRungeKutta2_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkRungeKutta2 {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkRungeKutta2 {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkRungeKutta2_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkRungeKutta2_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkRungeKutta2_create_drop() {
    let obj = vtkRungeKutta2::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkRungeKutta2(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// Integrate an initial value problem using 4th
///
/// order Runge-Kutta method.
///
///
/// This is a concrete sub-class of vtkInitialValueProblemSolver.
/// It uses a 4th order Runge-Kutta method to obtain the values of
/// a set of functions at the next time step.
///
/// @sa
/// vtkInitialValueProblemSolver vtkRungeKutta45 vtkRungeKutta2 vtkFunctionSet
#[allow(non_camel_case_types)]
pub struct vtkRungeKutta4(*mut core::ffi::c_void);
impl vtkRungeKutta4 {
    /// Creates a new [vtkRungeKutta4] wrapped inside `vtkNew`
    #[doc(alias = "vtkRungeKutta4")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkRungeKutta4_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkRungeKutta4_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkRungeKutta4_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkRungeKutta4_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkRungeKutta4 {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkRungeKutta4 {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkRungeKutta4_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkRungeKutta4_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkRungeKutta4_create_drop() {
    let obj = vtkRungeKutta4::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkRungeKutta4(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}
/// Integrate an initial value problem using 5th
///
/// order Runge-Kutta method with adaptive stepsize control.
///
///
/// This is a concrete sub-class of vtkInitialValueProblemSolver.
/// It uses a 5th order Runge-Kutta method with stepsize control to obtain
/// the values of a set of functions at the next time step. The stepsize
/// is adjusted by calculating an estimated error using an embedded 4th
/// order Runge-Kutta formula:
/// Press, W. H. et al., 1992, Numerical Recipes in Fortran, Second
/// Edition, Cambridge University Press
/// Cash, J.R. and Karp, A.H. 1990, ACM Transactions on Mathematical
/// Software, vol 16, pp 201-222
///
/// @sa
/// vtkInitialValueProblemSolver vtkRungeKutta4 vtkRungeKutta2 vtkFunctionSet
#[allow(non_camel_case_types)]
pub struct vtkRungeKutta45(*mut core::ffi::c_void);
impl vtkRungeKutta45 {
    /// Creates a new [vtkRungeKutta45] wrapped inside `vtkNew`
    #[doc(alias = "vtkRungeKutta45")]
    pub fn new() -> Self {
        unsafe extern "C" {
            fn vtkRungeKutta45_new() -> *mut core::ffi::c_void;
        }
        Self(unsafe { &mut *vtkRungeKutta45_new() })
    }
    #[cfg(test)]
    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
        unsafe extern "C" {
            fn vtkRungeKutta45_get_ptr(
                sself: *mut core::ffi::c_void,
            ) -> *mut core::ffi::c_void;
        }
        unsafe { vtkRungeKutta45_get_ptr(self.0) }
    }
}
impl std::default::Default for vtkRungeKutta45 {
    fn default() -> Self {
        Self::new()
    }
}
impl Drop for vtkRungeKutta45 {
    fn drop(&mut self) {
        unsafe extern "C" {
            fn vtkRungeKutta45_destructor(sself: *mut core::ffi::c_void);
        }
        unsafe { vtkRungeKutta45_destructor(self.0) }
        self.0 = core::ptr::null_mut();
    }
}
#[test]
fn test_vtkRungeKutta45_create_drop() {
    let obj = vtkRungeKutta45::new();
    let ptr = obj.0;
    assert!(!ptr.is_null());
    assert!(unsafe { !obj._get_ptr().is_null() });
    drop(obj);
    let new_obj = vtkRungeKutta45(ptr);
    assert!(unsafe { new_obj._get_ptr().is_null() });
}