NAME
Math::PlanePath::MathImageFile -- points from a file
SYNOPSIS
use Math::PlanePath::MathImageFile;
my $path = Math::PlanePath::MathImageFile->new (filename => 'foo.txt');
my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION
Experimental.
This path reads X,Y points from a file to present in PlanePath style. The intention is to be flexible about the file format and to auto-detect the format as far as possible. Currently the only format is plain text, with an X,Y pair, or N,X,Y triplet on each line
5, 6 # X,Y
123 5 6 # N,X,Y
Separators can be any combination of spaces, tabs, commas. Blank lines or lines not starting with a number are ignored as comments. N values must be integers, but the X,Y can be floating point style 1500.5e-1 etc too.
FUNCTIONS
$path = Math::PlanePath::MathImageFile->new (filename => "/my/file/name.txt")
-
Create and return a new path object.
($x,$y) = $path->n_to_xy ($n)
-
Return the X,Y coordinates of point number
$n
on the path. $n = $path->xy_to_n ($x,$y)
-
Return the point number for coordinates
$x,$y
.In the current code an
$x,$y
within a unit diameter circle of a point from the file gives that point. $bool = $path->x_negative()
$bool = $path->y_negative()
-
Return true if there are any negative X or negative Y coordinates in the file, respectively.
$n = $path->n_start()
-
Return the first N in the path. For X,Y data lines the start is N=1, for N,X,Y data it's the smallest N.