summaryrefslogtreecommitdiffstats
path: root/src/vanishing-point.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/vanishing-point.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/vanishing-point.h')
-rw-r--r--src/vanishing-point.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/vanishing-point.h b/src/vanishing-point.h
new file mode 100644
index 000000000..4770c74f1
--- /dev/null
+++ b/src/vanishing-point.h
@@ -0,0 +1,91 @@
+/*
+ * Vanishing point for 3D perspectives
+ *
+ * Authors:
+ * Maximilian Albert <Anhalter42@gmx.de>
+ *
+ * Copyright (C) 2007 authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef SEEN_VANISHING_POINT_H
+#define SEEN_VANISHING_POINT_H
+
+#include "libnr/nr-point.h"
+#include "line-geometry.h"
+
+namespace Box3D {
+
+enum VPState {
+ VP_FINITE = 0, // perspective lines meet in the VP
+ VP_INFINITE // perspective lines are parallel
+};
+
+enum PerspDir {
+ X,
+ Y,
+ Z,
+ NONE
+};
+
+// FIXME: Store the PerspDir of the VP inside the class
+class VanishingPoint : public NR::Point {
+public:
+ inline VanishingPoint() : NR::Point() {};
+ /***
+ inline VanishingPoint(NR::Point const &pt, NR::Point const &ref = NR::Point(0,0))
+ : NR::Point (pt),
+ ref_pt (ref),
+ v_dir (pt[NR::X] - ref[NR::X], pt[NR::Y] - ref[NR::Y]) {}
+ inline VanishingPoint(NR::Coord x, NR::Coord y, NR::Point const &ref = NR::Point(0,0))
+ : NR::Point (x, y),
+ ref_pt (ref),
+ v_dir (x - ref[NR::X], y - ref[NR::Y]) {}
+ ***/
+ VanishingPoint(NR::Point const &pt, NR::Point const &inf_dir, VPState st);
+ VanishingPoint(NR::Point const &pt);
+ VanishingPoint(NR::Point const &dir, VPState const state);
+ VanishingPoint(NR::Point const &pt, NR::Point const &direction);
+ VanishingPoint(NR::Coord x, NR::Coord y);
+ VanishingPoint(NR::Coord x, NR::Coord y, VPState const state);
+ VanishingPoint(NR::Coord x, NR::Coord y, NR::Coord dir_x, NR::Coord dir_y);
+ VanishingPoint(VanishingPoint const &rhs);
+
+ bool is_finite();
+ VPState toggle_parallel();
+ void draw(PerspDir const axis); // Draws a point on the canvas if state == VP_FINITE
+ //inline VPState state() { return state; }
+
+ VPState state;
+ //NR::Point ref_pt; // point of reference to compute the direction of parallel lines
+ NR::Point v_dir; // direction of perslective lines if the VP has state == VP_INFINITE
+
+private:
+};
+
+
+} // namespace Box3D
+
+
+/** A function to print out the VanishingPoint (prints the coordinates) **/
+/***
+inline std::ostream &operator<< (std::ostream &out_file, const VanishingPoint &vp) {
+ out_file << vp;
+ return out_file;
+}
+***/
+
+
+#endif /* !SEEN_VANISHING_POINT_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 :