summaryrefslogtreecommitdiffstats
path: root/src/line-geometry.h
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-06-21 13:01:57 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-06-21 13:01:57 +0000
commitcf233ff5bbc68bd598ef4b81c7b4063548f2eff9 (patch)
tree56d48726d21ad368509a945bf7df91966115cc9c /src/line-geometry.h
parentFix function plotter for the most common case where there are no transforms a... (diff)
downloadinkscape-cf233ff5bbc68bd598ef4b81c7b4063548f2eff9.tar.gz
inkscape-cf233ff5bbc68bd598ef4b81c7b4063548f2eff9.zip
First (very limited) version of the 3D box tool; allows for drawing of new boxes in a fixed perspective without any live interaction.
(bzr r3084)
Diffstat (limited to 'src/line-geometry.h')
-rw-r--r--src/line-geometry.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/line-geometry.h b/src/line-geometry.h
new file mode 100644
index 000000000..53f39db39
--- /dev/null
+++ b/src/line-geometry.h
@@ -0,0 +1,74 @@
+/*
+ * Routines for dealing with lines (intersections, etc.)
+ *
+ * Authors:
+ * Maximilian Albert <Anhalter42@gmx.de>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef SEEN_LINE_GEOMETRY_H
+#define SEEN_LINE_GEOMETRY_H
+
+#include "libnr/nr-point.h"
+#include "libnr/nr-point-fns.h"
+#include "libnr/nr-maybe.h"
+#include "glib.h"
+#include "display/sp-ctrlline.h"
+#include "vanishing-point.h"
+
+#include "document.h"
+#include "ui/view/view.h"
+
+namespace Box3D {
+
+class Line {
+public:
+ Line(NR::Point const &start, NR::Point const &vec, bool is_endpoint = true);
+ Line(Line const &line);
+ Line &operator=(Line const &line);
+ virtual NR::Maybe<NR::Point> intersect(Line const &line);
+ void set_direction(NR::Point const &dir); // FIXME: Can we avoid this explicit assignment?
+
+ NR::Point closest_to(NR::Point const &pt); // returns the point on the line closest to pt
+
+ friend inline std::ostream &operator<< (std::ostream &out_file, const Line &in_line);
+
+private:
+ NR::Point pt;
+ NR::Point v_dir;
+ NR::Point normal;
+ NR::Coord d0;
+};
+
+/*** For testing purposes: Draw a knot/node of specified size and color at the given position ***/
+void create_canvas_point(NR::Point const &pos, double size = 4.0, guint32 rgba = 0xff00007f);
+
+/*** For testing purposes: Draw a line between the specified points ***/
+void create_canvas_line(NR::Point const &p1, NR::Point const &p2, guint32 rgba = 0xff00007f);
+
+
+/** A function to print out the Line. It just prints out the coordinates of start end end point
+ on the given output stream */
+inline std::ostream &operator<< (std::ostream &out_file, const Line &in_line) {
+ out_file << "Start: " << in_line.pt << " Direction: " << in_line.v_dir;
+ return out_file;
+}
+
+} // namespace Box3D
+
+
+#endif /* !SEEN_LINE_GEOMETRY_H */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :