r5595 - in /packages/libmath-vec-perl/branches/upstream/current: Build.PL Changes MANIFEST MANIFEST.SKIP META.yml Makefile.PL lib/Math/Vec.pm t/00-load.t t/01-load.t t/01-pod-coverage.t t/02-basic.t t/02-pod.t t/03-test.t t/inner_angle.t
gwolf at users.alioth.debian.org
gwolf at users.alioth.debian.org
Fri Jun 15 18:35:43 UTC 2007
Author: gwolf
Date: Fri Jun 15 18:35:43 2007
New Revision: 5595
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=5595
Log:
[svn-upgrade] Integrating new upstream version, libmath-vec-perl (1.01)
Added:
packages/libmath-vec-perl/branches/upstream/current/MANIFEST.SKIP
packages/libmath-vec-perl/branches/upstream/current/t/01-load.t
packages/libmath-vec-perl/branches/upstream/current/t/02-basic.t
packages/libmath-vec-perl/branches/upstream/current/t/inner_angle.t (with props)
Removed:
packages/libmath-vec-perl/branches/upstream/current/t/00-load.t
packages/libmath-vec-perl/branches/upstream/current/t/01-pod-coverage.t
packages/libmath-vec-perl/branches/upstream/current/t/02-pod.t
packages/libmath-vec-perl/branches/upstream/current/t/03-test.t
Modified:
packages/libmath-vec-perl/branches/upstream/current/Build.PL
packages/libmath-vec-perl/branches/upstream/current/Changes
packages/libmath-vec-perl/branches/upstream/current/MANIFEST
packages/libmath-vec-perl/branches/upstream/current/META.yml
packages/libmath-vec-perl/branches/upstream/current/Makefile.PL
packages/libmath-vec-perl/branches/upstream/current/lib/Math/Vec.pm
Modified: packages/libmath-vec-perl/branches/upstream/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/Build.PL?rev=5595&op=diff
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/Build.PL (original)
+++ packages/libmath-vec-perl/branches/upstream/current/Build.PL Fri Jun 15 18:35:43 2007
@@ -3,12 +3,6 @@
use warnings;
use Module::Build;
my $build_class = 'Module::Build';
-my $custom_build = 'Module::Build::Live';
-eval("require $custom_build;");
-unless($@) {
- warn "using custom build class: '$custom_build'\n";
- $build_class = $custom_build;
-}
my $builder = $build_class->new(
module_name => 'Math::Vec',
@@ -17,6 +11,7 @@
requires => {
'Test::More' => 0,
},
+ create_makefile_pl => 'passthrough',
add_to_cleanup => [ qw(Math-Vec-* META.yml)],
);
Modified: packages/libmath-vec-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/Changes?rev=5595&op=diff
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/Changes (original)
+++ packages/libmath-vec-perl/branches/upstream/current/Changes Fri Jun 15 18:35:43 2007
@@ -1,17 +1,35 @@
-0.04
- test 03 workaround for Exporter.pm transient bug
- Exporter rework
- fixed nit in compatibility Makefile.PL
+Revision history for Math-Vec
-0.03
- Setup to run clean under 'use warnings'.
- Added overloading and :terse functions.
- More tests.
+1.01 2007-05-30
-0.02
- Fixed incorrect DotProduct() (thanks to Nao-Yuki Tanabe.)
- Added length != 0 check to Comp()
+ * bugfix #25373 "Imaginary numbers from InnerAngle()"
+ * bugfix #26925 "compatibility Makefile.PL writes no Makefile"
+
+0.04 2006-06-04
+
+ * test 03 workaround for Exporter.pm transient bug
+
+ * Exporter rework
+
+ * fixed nit in compatibility Makefile.PL
+
+0.03 2006-01-07
+
+ * Setup to run clean under 'use warnings'.
+
+ * Added overloading and :terse functions.
+
+ * More tests.
+
+0.02 2006-01-04
+
+ * Fixed incorrect DotProduct() (thanks to Nao-Yuki Tanabe.)
+
+ * Added length != 0 check to Comp()
0.01
- First Public Release
+
+ * First Public Release
+
+# vim:ts=2:sw=2:et:sta
Modified: packages/libmath-vec-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/MANIFEST?rev=5595&op=diff
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libmath-vec-perl/branches/upstream/current/MANIFEST Fri Jun 15 18:35:43 2007
@@ -1,11 +1,11 @@
Build.PL
Changes
-MANIFEST
-META.yml # Will be created by "make dist"
+lib/Math/Vec.pm
Makefile.PL
+MANIFEST This list of files
+MANIFEST.SKIP
+META.yml
README
-lib/Math/Vec.pm
-t/00-load.t
-t/01-pod-coverage.t
-t/02-pod.t
-t/03-test.t
+t/01-load.t
+t/02-basic.t
+t/inner_angle.t
Added: packages/libmath-vec-perl/branches/upstream/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/MANIFEST.SKIP?rev=5595&op=file
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/MANIFEST.SKIP (added)
+++ packages/libmath-vec-perl/branches/upstream/current/MANIFEST.SKIP Fri Jun 15 18:35:43 2007
@@ -1,0 +1,35 @@
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\b_darcs\b
+\b.cvsignore\b
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$ # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+\.swp$
+
+# Avoid archives of this distribution
+\b-v?[\d\.\_]+
+
+# Avoid Devel::Cover files.
+\bcover_db\b
Modified: packages/libmath-vec-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/META.yml?rev=5595&op=diff
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/META.yml (original)
+++ packages/libmath-vec-perl/branches/upstream/current/META.yml Fri Jun 15 18:35:43 2007
@@ -1,6 +1,6 @@
---
name: Math-Vec
-version: 0.04
+version: 1.01
author: []
abstract: Object-Oriented Vector Math Methods in Perl
license: perl
@@ -11,8 +11,10 @@
provides:
Math::Vec:
file: lib/Math/Vec.pm
- version: 0.04
-generated_by: Module::Build version 0.28
+ version: 1.01
+ Math::Vec::Support:
+ file: lib/Math/Vec.pm
+generated_by: Module::Build version 0.2807
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
Modified: packages/libmath-vec-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/Makefile.PL?rev=5595&op=diff
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libmath-vec-perl/branches/upstream/current/Makefile.PL Fri Jun 15 18:35:43 2007
@@ -27,3 +27,5 @@
eval "use Module::Build::Compat 0.02; 1" or die $@;
Module::Build::Compat->run_build_pl(args => \@ARGV);
+ require Module::Build;
+ Module::Build::Compat->write_makefile(build_class => 'Module::Build');
Modified: packages/libmath-vec-perl/branches/upstream/current/lib/Math/Vec.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/lib/Math/Vec.pm?rev=5595&op=diff
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/lib/Math/Vec.pm (original)
+++ packages/libmath-vec-perl/branches/upstream/current/lib/Math/Vec.pm Fri Jun 15 18:35:43 2007
@@ -1,5 +1,5 @@
package Math::Vec;
-our $VERSION = '0.04';
+our $VERSION = '1.01';
=pod
@@ -87,7 +87,25 @@
use strict;
use warnings;
use Carp;
-use Math::Complex;
+
+{
+package Math::Vec::Support;
+# Dropping the usage of Math::Complex acos() because we don't want any
+# complex numbers to happen due to errors in the whee bits.
+sub acos {
+ my ($z) = @_;
+
+ my $abs = abs($z);
+ if($abs > 1) {
+ # just a little sanity checking
+ (($abs - 1) > 2**-16) and die "bad input to acos($z)";
+ # make it safe
+ $z = ($z > 0) ? 1 : -1;
+ }
+
+ return CORE::atan2(CORE::sqrt(1-$z*$z), $z);
+}
+}
BEGIN {
use Exporter;
@@ -668,7 +686,11 @@
my $dot_prod = $A->Dot($B);
my $m_A = $A->Length();
my $m_B = $B->Length();
- return(acos($dot_prod / ($m_A * $m_B)) );
+ # NOTE occasionally returned an answer with a very small imaginary
+ # part (for d/(A*B) values very slightly under -1 or very slightly
+ # over 1.) Large imaginary results are not possible with vector
+ # inputs, so we can just drop the imaginary bit.
+ return(Math::Vec::Support::acos($dot_prod / ($m_A * $m_B)) );
} # end subroutine InnerAngle definition
########################################################################
@@ -933,3 +955,4 @@
########################################################################
1;
+# vim:ts=4:sw=4:noet
Added: packages/libmath-vec-perl/branches/upstream/current/t/01-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/t/01-load.t?rev=5595&op=file
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/t/01-load.t (added)
+++ packages/libmath-vec-perl/branches/upstream/current/t/01-load.t Fri Jun 15 18:35:43 2007
@@ -1,0 +1,7 @@
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok('Math::Vec');
+}
+
+diag( "Testing Math::Vec $Math::Vec::VERSION" );
Added: packages/libmath-vec-perl/branches/upstream/current/t/02-basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/t/02-basic.t?rev=5595&op=file
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/t/02-basic.t (added)
+++ packages/libmath-vec-perl/branches/upstream/current/t/02-basic.t Fri Jun 15 18:35:43 2007
@@ -1,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More;
+BEGIN { plan tests => 22 };
+use Math::Vec qw(:terse NewVec);
+ok(1, "use");
+
+my $pt;
+ok( $pt = Math::Vec->new(0,5), 'constructor');
+ok( V($pt->ScalarMult(3)) == [0,15] ,'multiplication');
+# how to test for warnings on 2D vectors?
+ok(scalar(@{V(0,1)}) == 3, 'auto-init');
+my $v = V(1,1);
+ok($v->isa('Math::Vec'), 'constructor');
+ok(V(1,1) == V(1,1), 'comparison');
+ok(V(1,1) != V(1,0), 'comparison');
+ok(abs(V(3,4)) == 5, 'length');
+my $qpi = atan2(1,1);
+my $angs = V(V(1,1,1)->PlanarAngles());
+ok($angs == [($qpi) x 3], 'angles');
+ok(($v - [0,1]) == [1,0], 'subtraction');
+ok($v + [4,5,1] == [5,6,1], 'addition');
+
+ok(X == [1,0,0], 'X-axis');
+ok(Y == [0,1,0], 'Y-axis');
+ok(Z == [0,0,1], 'Z-axis');
+ok(-$v == [-1,-1], 'negation');
+
+# now to check the functional interface
+$v = NewVec(0,1,2);
+my @res = $v->Cross([1,2.5]);
+ok(V(@res) == ($v x [1,2.5]), 'cross product');
+my $p = NewVec(@res);
+my $q = $p->Dot([0,1]);
+ok($q == $p * [0,1], 'dot product');
+my @proj = V(1,0)->Proj([1,1,1]);
+ok(V(@proj) == V(1,0), 'vector projection');
+ok(V(@proj) == V(1,1,1) >> [1,0], 'vector projection');
+
+my $comp = V(1,0)->Comp([1,1,1]);
+ok($comp == 1, 'scalar projection (component)');
+ok($comp == abs(V(1,1,1) >> [1,0]), 'comp == abs(proj)');
+ok(V(1,1,1) x Z() == [1,-1], 'perpendicular');
Added: packages/libmath-vec-perl/branches/upstream/current/t/inner_angle.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmath-vec-perl/branches/upstream/current/t/inner_angle.t?rev=5595&op=file
==============================================================================
--- packages/libmath-vec-perl/branches/upstream/current/t/inner_angle.t (added)
+++ packages/libmath-vec-perl/branches/upstream/current/t/inner_angle.t Fri Jun 15 18:35:43 2007
@@ -1,0 +1,30 @@
+#!/usr/bin/perl
+
+# http://rt.cpan.org/Public/Bug/Display.html?id=25373
+
+use strict;
+use warnings;
+
+use Test::More qw(no_plan);
+
+use Math::Vec qw();
+
+my $pi = 4*atan2(1,1);
+
+is(Math::Vec::Support::acos(1.00000000000001), 0, 'acos(1)');
+is(Math::Vec::Support::acos(-1.00000000000001), $pi, 'acos(-1)');
+
+my ($x1, $y1, $x2, $y2, $x3, $y3) = (
+ 184.818732905007, 1.88127517013888,
+ 183.75578943, 1.9146946049724,
+ 182.742125596, 1.94656466818785,
+);
+
+my $v1 = Math::Vec->new($x2-$x1, $y2-$y1);
+my $v2 = Math::Vec->new($x2-$x3, $y2-$y3);
+
+my $angle = $v1->InnerAngle($v2);
+ok(abs($angle - $pi) < 0.1, 'roughly pi');
+ok(! ref($angle));
+
+# vim:ts=2:sw=2:et:sta
Propchange: packages/libmath-vec-perl/branches/upstream/current/t/inner_angle.t
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-perl-cvs-commits
mailing list