; Copyright (C) 2006 Will M. Farr ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License along ; with this program; if not, write to the Free Software Foundation, Inc., ; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. (module lie-group-SO3-test "generics.ss" (require "lie-group-SO3.ss" (all-except "lie-groups.ss" phi psi) "manifolds.ss" "tuples.ss" "test.ss" (lib "math.ss")) (provide lie-group-SO3-test-suite) (define-named-coordinates (phi theta psi) SO3-euler-angles-chart) (define lie-group-SO3-test-suite (test-suite "lie-group-SO3.ss" (test-case "Euler-angle structure constants." (check-equals? (structure-constants SO3 SO3-euler-angles-chart) (down (down (up 0 0 0) (up 0 0 1) (up 0 -1 0)) (down (up 0 0 -1) (up 0 0 0) (up 1 0 0)) (down (up 0 1 0) (up -1 0 0) (up 0 0 0))))) (test-case "Coordinate vectors commute." (check-equals? ((vector-field->component-field (lie-bracket d/dphi d/dtheta) SO3-euler-angles-chart) (slot-ref SO3 'identity)) (up 0 0 0))) (test-case "Lie algebra bracket of coordinate vectors does not commute." (check-equals? ((vector-field->component-field ((lie-algebra-bracket SO3) d/dphi d/dtheta) SO3-euler-angles-chart) (slot-ref SO3 'identity)) (up 0 0 1))) (test-case "Extended tangent vectors are really left-invariant" (check-tuple-close? 1e-6 ((vector-field->component-field (- ((lie-algebra-bracket SO3) d/dphi d/dtheta) ((natural-extension SO3) d/dpsi)) SO3-euler-angles-chart) ((slot-ref SO3-euler-angles-chart 'chiinv) (up 0.02345453 0.0349587 0.0435897))) (up 0 0 0))) (test-case "Rectangular angles correct" (let ((x-y-z (up (random) (random) (random)))) (check-tuple-close? 1e-6 ((slot-ref SO3-rectangular-angles-chart 'chi) ((slot-ref SO3-rectangular-angles-chart 'chiinv) x-y-z)) x-y-z) (check-tuple-close? 1e-3 ((slot-ref SO3-rectangular-angles-chart 'chi) (* ((slot-ref SO3-rectangular-angles-chart 'chiinv) (up (/ pi 4) 0 0)) ((slot-ref SO3-rectangular-angles-chart 'chiinv) (up 0 (/ pi 4) 0)) ((slot-ref SO3-rectangular-angles-chart 'chiinv) (up 0 0 (/ pi 4))))) (up 1.04089 -0.146975 1.04089)))))))