| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Math::Interpolator::Knot - x/y point for use in interpolation | ||
| 4 | |||
| 5 | =head1 SYNOPSIS | ||
| 6 | |||
| 7 | use Math::Interpolator::Knot; | ||
| 8 | |||
| 9 | $pt = Math::Interpolator::Knot->new($x, $y); | ||
| 10 | |||
| 11 | $x = $pt->x; | ||
| 12 | $y = $pt->y; | ||
| 13 | |||
| 14 | $role = $pt->role; | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | An object of this type represents a single known point on a | ||
| 19 | one-dimensional curve. It is intended for use with C<Math::Interpolator>, | ||
| 20 | which will interpolate a curve between known points. These points are | ||
| 21 | known as "knots". | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | package Math::Interpolator::Knot; | ||
| 26 | |||
| 27 | 10 | ▶ | { use 5.006; } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | 10 | our $VERSION = "0.005"; | |
| 32 | |||
| 33 | =head1 CONSTRUCTOR | ||
| 34 | |||
| 35 | =over | ||
| 36 | |||
| 37 | =item Math::Interpolator::Knot->new(X, Y) | ||
| 38 | |||
| 39 | Creates and returns a new knot object with the specified x and y | ||
| 40 | coordinates. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 83 | ▶ | sub new { bless({ x => $_[1], y => $_[2] }, $_[0]) } |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 45 | |||
| 46 | =back | ||
| 47 | |||
| 48 | =head1 METHODS | ||
| 49 | |||
| 50 | =over | ||
| 51 | |||
| 52 | =item $pt->x | ||
| 53 | |||
| 54 | Returns the x coordinate of the knot. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | 713 | ▶ | sub x { $_[0]->{x} } |
|
Subroutine
x: called CC=1 SCAR=0.0
Pod
documented
| |||
| 59 | |||
| 60 | =item $pt->y | ||
| 61 | |||
| 62 | Returns the y coordinate of the knot. | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | 406 | ▶ | sub y { $_[0]->{y} } |
|
Subroutine
y: called CC=1 SCAR=0.0
Pod
documented
| |||
| 67 | |||
| 68 | =item $pt->role | ||
| 69 | |||
| 70 | Returns the string "KNOT". This is used to distinguish knots from other | ||
| 71 | types of entity that could appear in an interpolator's point list. | ||
| 72 | |||
| 73 | =cut | ||
| 74 | |||
| 75 | 816 | ▶ | sub role { "KNOT" } |
|
Subroutine
role: called CC=1 SCAR=0.0
Pod
documented
| |||
| 76 | |||
| 77 | =back | ||
| 78 | |||
| 79 | =head1 SUBCLASSING | ||
| 80 | |||
| 81 | The interpolator uses only this public interface, so it is acceptable to | ||
| 82 | substitute any other class that implements this interface. This may be | ||
| 83 | done by subclassing this class, or by reimplementing all three methods | ||
| 84 | independently. This is useful, for example, if the exact coordinates | ||
| 85 | are expensive to calculate and it is desired to perform lazy evaluation | ||
| 86 | with memoisation. | ||
| 87 | |||
| 88 | =head1 SEE ALSO | ||
| 89 | |||
| 90 | L<Math::Interpolator>, | ||
| 91 | L<Math::Interpolator::Source> | ||
| 92 | |||
| 93 | =head1 AUTHOR | ||
| 94 | |||
| 95 | Andrew Main (Zefram) <zefram@fysh.org> | ||
| 96 | |||
| 97 | =head1 COPYRIGHT | ||
| 98 | |||
| 99 | Copyright (C) 2006, 2007, 2009, 2010, 2012 | ||
| 100 | Andrew Main (Zefram) <zefram@fysh.org> | ||
| 101 | |||
| 102 | =head1 LICENSE | ||
| 103 | |||
| 104 | This module is free software; you can redistribute it and/or modify it | ||
| 105 | under the same terms as Perl itself. | ||
| 106 | |||
| 107 | =cut | ||
| 108 | |||
| 109 | 10 | 1; | |