| 1 | /* Configuration_and_Procrustes.c |
| 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 20020424 GPL |
| 21 | djmw 20020704 Changed header NUMclasses.h to SVD.h |
| 22 | djmw 20041022 Added orthogonal argument to Configurations_to_Procrustes. |
| 23 | */ |
| 24 | |
| 25 | #include "Configuration_and_Procrustes.h" |
| 26 | #include "NUM2.h" |
| 27 | |
| 28 | autoProcrustes Configurations_to_Procrustes (Configuration me, Configuration thee, bool orthogonal) { |
| 29 | try { |
| 30 | Melder_require (my numberOfRows == thy numberOfRows && my numberOfColumns == thy numberOfColumns, |
| 31 | U"Configurations must have the same number of points and the same dimension."); |
| 32 | |
| 33 | autoProcrustes p = Procrustes_create (my numberOfColumns); |
| 34 | NUMprocrustes (my data.get(), thy data.get(), & p -> r, ( orthogonal ? nullptr : & p -> t ), ( orthogonal ? nullptr : & p -> s) ); |
| 35 | return p; |
| 36 | } catch (MelderError) { |
| 37 | Melder_throw (U"Procrustes from two Configurations not created."); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /* End of file Configuration_and_Procrustes.c */ |