Debian Codegraph @

dwtools/Procrustes.cpp

raw symbols SCIP
1 /* Procrustes.cpp
2 *
3 * Copyright (C) 1993-2019 David Weenink
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /*
20 djmw 2001
21 djmw 20020813 GPL header
22 djmw 20040117 Corrected bug in classProcrustes_transform: scale (s) was not used.
23 djmw 20050406 Renamed Procrustus Procrustes
24 djmw 20071012 Added: o_CAN_WRITE_AS_ENCODING.h
25 djmw 20110304 Thing_new
26 */
27
28 #include "Procrustes.h"cxx . . $ `<file>/dwtools/Procrustes.h`/
29
30 #include "oo_DESTROY.h"cxx . . $ `<file>/sys/oo_DESTROY.h`/
31 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
32 #include "oo_COPY.h"cxx . . $ `<file>/sys/oo_COPY.h`/
33 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
34 #include "oo_EQUAL.h"cxx . . $ `<file>/sys/oo_EQUAL.h`/
35 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
36 #include "oo_CAN_WRITE_AS_ENCODING.h"cxx . . $ `<file>/sys/oo_CAN_WRITE_AS_ENCODING.h`/
37 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
38 #include "oo_WRITE_TEXT.h"cxx . . $ `<file>/sys/oo_WRITE_TEXT.h`/
39 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
40 #include "oo_WRITE_BINARY.h"cxx . . $ `<file>/sys/oo_WRITE_BINARY.h`/
41 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
42 #include "oo_READ_TEXT.h"cxx . . $ `<file>/sys/oo_READ_TEXT.h`/
43 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
44 #include "oo_READ_BINARY.h"cxx . . $ `<file>/sys/oo_READ_BINARY.h`/
45 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
46 #include "oo_DESCRIPTION.h"cxx . . $ `<file>/sys/oo_DESCRIPTION.h`/
47 #include "Procrustes_def.h"cxx . . $ `<file>/dwtools/Procrustes_def.h`/
48
49 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (Procrustes, AffineTransform, 0);
50
51 void structProcrustes :: v_transform (MATVUcxx . . $ MATVU# const& out, constMATVUcxx . . $ constMATVU# const& in) {
52 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (in.nrow == out.nrow && in.ncol == out.ncol);
53 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (in.ncol == dimension);
54 mul_MAT_outcxx . . $ mul_MAT_out(9e368e0da0f1874a). (out, in, ourcxx . . $ `melder/melder.h:42:9`! rcxx . . $ structAffineTransform#r..getcxx . . $ automatrix#get(b2b81450b5bdda66).());
55 out *=cxx . . $ `operator*=`(50b469ae42a42f64). ourcxx . . $ `melder/melder.h:42:9`! s;
56 out +=cxx . . $ `operator+=`(88779db6ac139909). ourcxx . . $ `melder/melder.h:42:9`! tcxx . . $ structAffineTransform#t..allcxx . . $ autovector#all(a26726dad87555bb).();
57 }
58
59 autoAffineTransformcxx . . $ autoAffineTransform# structProcrustes :: v_invert () {
60 autoProcrustes thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (this);
61 /*
62 R is symmetric rotation matrix -->
63 inverse is transpose!
64 */
65 thycxx . . $ `melder/melder.h:45:9`! s = ( ourcxx . . $ `melder/melder.h:42:9`! s == 0.0 ? 1.0 : 1.0 / ourcxx . . $ `melder/melder.h:42:9`! s );
66 thycxx . . $ `melder/melder.h:45:9`! rcxx . . $ structAffineTransform#r..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(a7d93ba40fe22fe0). ourcxx . . $ `melder/melder.h:42:9`! rcxx . . $ structAffineTransform#r..transposecxx . . $ automatrix#transpose(2114117ba8ed4224).();
67 mul_VEC_outcxx . . $ mul_VEC_out(82b3fcbc7daf2365). (thycxx . . $ `melder/melder.h:45:9`! tcxx . . $ structAffineTransform#t..getcxx . . $ autovector#get(e8d1da7fe68a6585).(), ourcxx . . $ `melder/melder.h:42:9`! rcxx . . $ structAffineTransform#r..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), ourcxx . . $ `melder/melder.h:42:9`! tcxx . . $ structAffineTransform#t..getcxx . . $ autovector#get(e8d1da7fe68a6585).());
68 thycxx . . $ `melder/melder.h:45:9`! tcxx . . $ structAffineTransform#t..getcxx . . $ autovector#get(e8d1da7fe68a6585).() *=cxx . . $ `operator*=`(c555d170d72ff256). - thycxx . . $ `melder/melder.h:45:9`! s;
69 return theecxx . . $ autoSomeThing#autoSomeThing(327dc2ad7b4df21)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(); // explicit move() seems to be needed because of the type difference
70 }
71
72 static void Procrustes_setDefaultscxx . . $ Procrustes_setDefaults(74ff91ebd0e97821). (Procrustes me) {
73 mycxx . . $ `melder/melder.h:44:9`! s = 1.0;
74 mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structAffineTransform#t..allcxx . . $ autovector#all(a26726dad87555bb).() <<=cxx . . $ `operator<<=`(c555d170d72ff256). 0.0;
75 mycxx . . $ `melder/melder.h:44:9`! rcxx . . $ structAffineTransform#r..allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(50b469ae42a42f64). 0.0;
76 mycxx . . $ `melder/melder.h:44:9`! rcxx . . $ structAffineTransform#r..diagonalcxx . . $ automatrix#diagonal(a26726dad87555bb).() <<=cxx . . $ `operator<<=`(c555d170d72ff256). 1.0;
77 }
78
79 autoProcrustes Procrustes_createcxx . . $ Procrustes_create(322551874602f209). (integercxx . . $ integer# dimension) {
80 try {
81 autoProcrustes me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Procrustes);
82 AffineTransform_initcxx . . $ AffineTransform_init(19cf67a114889c06). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), dimension);
83 Procrustes_setDefaultscxx . . $ Procrustes_setDefaults(74ff91ebd0e97821). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
84 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
85 } catch (MelderErrorcxx . . $ MelderError#) {
86 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Procrustes not created.");
87 }
88 }
89
90 /* End of file Procrustes.c */