Fixed up Line class and created man page.
authorMartin Read <mpread@chiark.greenend.org.uk>
Thu, 22 Mar 2012 19:22:44 +0000 (19:22 +0000)
committerMartin Read <mpread@chiark.greenend.org.uk>
Thu, 22 Mar 2012 19:22:44 +0000 (19:22 +0000)
include/libmormegil/Line.hh
man/libmormegil::Line.3 [new file with mode: 0644]

index ab9d714..c96bc9d 100644 (file)
@@ -23,6 +23,9 @@ namespace libmormegil
         typedef const basic_coord<T>& const_punktref;
         basic_coord<T> topleft;
         basic_coord<T> botright;
+        T length_taxi() const { return topleft.dist_taxi(botright); }
+        T length_inf() const { return topleft.dist_inf(botright); }
+        T lengthsq() const { return topleft.distsq(botright); }
     };
     typedef basic_line<int32_t> Line;
     typedef basic_line<int64_t> Line64;
diff --git a/man/libmormegil::Line.3 b/man/libmormegil::Line.3
new file mode 100644 (file)
index 0000000..85d9898
--- /dev/null
@@ -0,0 +1,28 @@
+.TH "LIBMORMEGIL::LINE" 3 "March 22, 2012" "libmormegil Version 1.1" "libmormegil User Manual"
+.SH NAME
+libmormegil::basic_line, libmormegil::Line, libmormegil::Line64 \- line segments on a plane
+.SH SYNOPSIS
+#include <libmormegil/Line.hh>
+
+.SH DESCRIPTION
+.I libmormegil::basic_line
+is a template type for representing line segments on a two-dimensional plane.
+
+The member functions \fIlength_taxi\fP and \fIlength_inf\fP return the
+length of the line segment under the L_1 (aka "Manhattan" or "taxicab") and
+L_inf (aka "Chebyshev" or "chessboard") metrics, respectively.  The member
+function \fIlengthsq\fP returns the square of the magnitude of the length
+under the Euclidean metric.
+
+A typedef \fIlibmormegil::Line\fR is provided; this uses type \fIint32_t\fR
+as the template parameter.
+
+A typedef \fIlibmormegil::Line64\fR is provided; this uses type \fIint64_t\fR
+as the template parameter.
+
+.SH AUTHOR
+Martin Read <mpread@chiark.greenend.org.uk>
+
+.SH SEE ALSO
+
+libmormegil(3)