diff -Nru libmath-quaternion-perl-0.06/Changes libmath-quaternion-perl-0.07/Changes --- libmath-quaternion-perl-0.06/Changes 2013-08-24 11:51:22.000000000 +0000 +++ libmath-quaternion-perl-0.07/Changes 2013-11-17 13:35:51.000000000 +0000 @@ -1,17 +1,16 @@ -Revision history for Perl extension Quaternion. +Revision history for Perl module Math::Quaternion -0.01 Sun Jan 5 00:17:12 2003 - - original version; created by h2xs 1.22 with options - -XAn Quaternion +0.07 2013-11-17 13:34:00 UTC + - Updated Changes to conform to CPAN::Changes::Spec (thanks to NEILB) + - Patch from DJERIUS: rotation() incorrectly generates a non-rotating quaternion when passed two vectors which are parallel but opposite. -0.02 Sat Jul 10 17:22:47 BST 2004 - - some small markup fixes in the POD +0.06 2013-08-24 12:40:20 BST + - Updated Changelog! -0.03 Mon 5 May 00:41:56 BST 2008 - - fixed a bug in the documentation pointed out by Andreas Lund - - fixed a warning during 001_basic.t +0.05 2013-08-24 12:27:43 BST + - Merged Bruce Gray's patch for exponentiation -0.04 Sun May 19 00:05:56 BST 2013 +0.04 2013-05-19 00:05:56 BST - Added code and tests to fix crashing when creating quaternion from two parallel vectors (i.e. cross product is zero). - Added guard code against zero-length rotation vectors. @@ -19,9 +18,14 @@ - Added thanks to Daniel Connelly and Luc Vereecken. - Fixed POD of method new() - axis and angle were swapped. -0.05 Sat Aug 24 12:27:43 BST 2013 - - Merged Bruce Gray's patch for exponentiation - -0.06 Sat Aug 24 12:40:20 BST 2013 - - Updated Changelog! +0.03 2008-05-05 00:41:56 BST + - fixed a bug in the documentation pointed out by Andreas Lund + - fixed a warning during 001_basic.t + +0.02 2004-07-10 17:22:47 BST + - some small markup fixes in the POD + +0.01 2003-01-05 00:17:12 + - original version; created by h2xs 1.22 with options + -XAn Quaternion diff -Nru libmath-quaternion-perl-0.06/MANIFEST libmath-quaternion-perl-0.07/MANIFEST --- libmath-quaternion-perl-0.06/MANIFEST 2013-08-24 11:35:51.000000000 +0000 +++ libmath-quaternion-perl-0.07/MANIFEST 2013-11-17 13:38:15.000000000 +0000 @@ -6,3 +6,4 @@ t/001_basic.t t/002_overloading.t META.yml Module meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -Nru libmath-quaternion-perl-0.06/META.json libmath-quaternion-perl-0.07/META.json --- libmath-quaternion-perl-0.06/META.json 1970-01-01 00:00:00.000000000 +0000 +++ libmath-quaternion-perl-0.07/META.json 2013-11-17 13:38:14.000000000 +0000 @@ -0,0 +1,41 @@ +{ + "abstract" : "Perl class to represent quaternions", + "author" : [ + "Jonathan Chin " + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921", + "license" : [ + "unknown" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Math-Quaternion", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "Test::More" : "0" + } + } + }, + "release_status" : "stable", + "version" : "0.07" +} diff -Nru libmath-quaternion-perl-0.06/META.yml libmath-quaternion-perl-0.07/META.yml --- libmath-quaternion-perl-0.06/META.yml 2013-08-24 11:53:23.000000000 +0000 +++ libmath-quaternion-perl-0.07/META.yml 2013-11-17 13:38:14.000000000 +0000 @@ -1,22 +1,22 @@ ---- #YAML:1.0 -name: Math-Quaternion -version: 0.06 -abstract: Perl class to represent quaternions +--- +abstract: 'Perl class to represent quaternions' author: - - Jonathan Chin -license: unknown -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 + - 'Jonathan Chin ' build_requires: - ExtUtils::MakeMaker: 0 -requires: - Test::More: 0 -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.56 + ExtUtils::MakeMaker: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921' +license: unknown meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Math-Quaternion +no_index: + directory: + - t + - inc +requires: + Test::More: 0 +version: 0.07 diff -Nru libmath-quaternion-perl-0.06/debian/changelog libmath-quaternion-perl-0.07/debian/changelog --- libmath-quaternion-perl-0.06/debian/changelog 2013-10-11 06:42:20.000000000 +0000 +++ libmath-quaternion-perl-0.07/debian/changelog 2013-12-21 21:03:03.000000000 +0000 @@ -1,3 +1,11 @@ +libmath-quaternion-perl (0.07-1) unstable; urgency=medium + + * Team upload. + * New upstream release. + * Declare compliance with Debian Policy 3.9.5. + + -- gregor herrmann Sat, 21 Dec 2013 22:02:53 +0100 + libmath-quaternion-perl (0.06-1) unstable; urgency=low * Imported Upstream version 0.06 diff -Nru libmath-quaternion-perl-0.06/debian/control libmath-quaternion-perl-0.07/debian/control --- libmath-quaternion-perl-0.06/debian/control 2013-04-01 09:27:40.000000000 +0000 +++ libmath-quaternion-perl-0.07/debian/control 2013-12-21 21:03:03.000000000 +0000 @@ -5,7 +5,7 @@ Uploaders: Dima Kogan Build-Depends: debhelper (>= 8) Build-Depends-Indep: perl -Standards-Version: 3.9.4 +Standards-Version: 3.9.5 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/libmath-quaternion-perl.git Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libmath-quaternion-perl.git Homepage: https://metacpan.org/release/Math-Quaternion/ diff -Nru libmath-quaternion-perl-0.06/lib/Math/Quaternion.pm libmath-quaternion-perl-0.07/lib/Math/Quaternion.pm --- libmath-quaternion-perl-0.06/lib/Math/Quaternion.pm 2013-08-24 11:52:47.000000000 +0000 +++ libmath-quaternion-perl-0.07/lib/Math/Quaternion.pm 2013-11-17 13:36:08.000000000 +0000 @@ -67,7 +67,7 @@ ); -our $VERSION = '0.06'; +our $VERSION = '0.07'; # Preloaded methods go here. @@ -678,21 +678,17 @@ if (($x == 0) and ($y == 0) and ($z == 0)) { - # Vectors a and b are parallel, such that rotation vector - # is the zero-length vector (0,0,0), with theta 0. To - # remove round-off errors in theta, set it to 0 + # Vectors a and b are parallel, such that rotation + # vector is the zero-length vector (0,0,0), with + # theta either 0 or pi (if vectors are opposite). + # To remove round-off errors in theta, explicitly + # set it. - $theta = 0; + $theta = $dotprod > 0 ? 0 : pi; # Such a zero-length rotation vector is annoying (e.g. # division by 0 on normalization, and problems combining - # rotations) Simple solution would be to set a random - # rotation vector (e.g. 1,0,0) to go with the zero rotation - # angle. This would satisfy as a quaternion that rotates - # the first vector on the second, by a zero degree - # rotation. - # - # A more elegant solution is to select a random rotation + # rotations). To solve this, select a random rotation # vector that is also perpendicular to both parallel # vectors a and b. This satisfies the rotation requirement, # and helps programs relying on the logic that the rotation @@ -724,8 +720,7 @@ $z = $ax*$by-$ay*$bx; # ($x,$y,$z) is now a random yet valid rotation vector - # perpendicular to the two original vectors. theta is still - # 0. + # perpendicular to the two original vectors. } } else { diff -Nru libmath-quaternion-perl-0.06/t/001_basic.t libmath-quaternion-perl-0.07/t/001_basic.t --- libmath-quaternion-perl-0.06/t/001_basic.t 2013-08-24 11:35:51.000000000 +0000 +++ libmath-quaternion-perl-0.07/t/001_basic.t 2013-11-17 13:26:37.000000000 +0000 @@ -1,4 +1,4 @@ -use Test::More tests => 82; +use Test::More tests => 83; use Math::Trig; use strict; use Carp; @@ -59,6 +59,23 @@ } } +# take two vectors as array refs; return true if they are equivalent +sub check_vector { + croak("Wrong number of args") unless (2==@_); + + my ($v1, $v2) = @_; + + if ( + equal_fuzz ($v1->[0] , $v2->[0]) + && equal_fuzz ($v1->[1] , $v2->[1]) + && equal_fuzz ($v1->[2] , $v2->[2]) + ) { + return 1; + } else { + return undef; + } +} + sub quatequal_fuzz { my ($q1,$q2) = @_; @@ -512,3 +529,19 @@ }); ok( checkquat($uq,1,0,0,0), "Creating Quaternion from two parallel vectors does not crash"); + + +# quaternion from parallel but opposite vectors +{ + my $v1 = [ 1, 0, 0 ]; + my $v2 = [ -1, 0, 0 ]; + + my $q = Math::Quaternion->new({ v1 => $v1, v2 => $v2 }); + + my $v1_v2 = [ $q->rotate_vector( @$v1 ) ]; + + ok( check_vector( $v2, $v1_v2 ), + "Rotate opposite but parallel vectors" ); + + +}