Math::PlanePath::File3pm
Usage
use Math::PlanePath::File;my $path = Math::PlanePath::File->new (filename => 'foo.txt');my ($x, $y) = $path->n_to_xy (123);
Overview
This path reads X,Y points from a file to present in PlanePath style. It's slightly preliminary yet but is handy to get numbers from elsewhere into a PlanePath program.
The intention is to be flexible about the file format and to auto-detect 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,Y123 5 6 # N,X,Y
Numbers can be separated by a comma or just spaces and tabs. Lines not starting with a number are ignored as comments (or blanks). N values must be integers, but the X,Y values can be fractions like 1.5 too, including exponential floating point 1500.5e-1 etc.
Functions
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
- "$path = Math::PlanePath::File->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
$non 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 circle or square of a point from the file gives that point. But perhaps in the future some attention could be paid to apparent spacing of points closer than that.
- "$bool = $path->x_negative()"
- "$bool = $path->y_negative()"
-
Return true if there are any negative X or negative Y coordinates in the file.
- "$n = $path->n_start()"
-
Return the first N in the path. For files of just X,Y points the start is N=1, for N,X,Y data it's the first N.
- "$str = $path->figure()"
-
Return a string name of the figure (shape) intended to be drawn at each
$nposition. In the current code if all X,Y are integers then this is "square", otherwise it's "circle". But perhaps that will change.
Home page
<http://user42.tuxfamily.org/math-planepath/index.html>
Releases
6 releases since Debian 8 (Jessie); the text changed 3 times.