Code

First (very limited) version of the 3D box tool; allows for drawing of new boxes...
[inkscape.git] / src / vanishing-point.h
1 /*
2  * Vanishing point for 3D perspectives
3  *
4  * Authors:
5  *   Maximilian Albert <Anhalter42@gmx.de>
6  *
7  * Copyright (C) 2007 authors
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifndef SEEN_VANISHING_POINT_H
13 #define SEEN_VANISHING_POINT_H
15 #include "libnr/nr-point.h"
16 #include "line-geometry.h"
18 namespace Box3D {
20 enum VPState {
21     VP_FINITE = 0, // perspective lines meet in the VP
22     VP_INFINITE    // perspective lines are parallel
23 };
25 enum PerspDir {
26     X,
27     Y,
28     Z,
29     NONE
30 };
32 // FIXME: Store the PerspDir of the VP inside the class
33 class VanishingPoint : public NR::Point {
34 public:
35     inline VanishingPoint() : NR::Point() {};
36     /***
37     inline VanishingPoint(NR::Point const &pt, NR::Point const &ref = NR::Point(0,0))
38                          : NR::Point (pt),
39                            ref_pt (ref),
40                            v_dir (pt[NR::X] - ref[NR::X], pt[NR::Y] - ref[NR::Y]) {}
41     inline VanishingPoint(NR::Coord x, NR::Coord y, NR::Point const &ref = NR::Point(0,0))
42                          : NR::Point (x, y),
43                            ref_pt (ref),
44                            v_dir (x - ref[NR::X], y - ref[NR::Y]) {}
45     ***/
46     VanishingPoint(NR::Point const &pt, NR::Point const &inf_dir, VPState st);
47     VanishingPoint(NR::Point const &pt);
48     VanishingPoint(NR::Point const &dir, VPState const state);
49     VanishingPoint(NR::Point const &pt, NR::Point const &direction);
50     VanishingPoint(NR::Coord x, NR::Coord y);
51     VanishingPoint(NR::Coord x, NR::Coord y, VPState const state);
52     VanishingPoint(NR::Coord x, NR::Coord y, NR::Coord dir_x, NR::Coord dir_y);
53     VanishingPoint(VanishingPoint const &rhs);
55     bool is_finite();
56     VPState toggle_parallel();
57     void draw(PerspDir const axis); // Draws a point on the canvas if state == VP_FINITE
58     //inline VPState state() { return state; }
59         
60     VPState state;
61     //NR::Point ref_pt; // point of reference to compute the direction of parallel lines
62     NR::Point v_dir; // direction of perslective lines if the VP has state == VP_INFINITE
64 private:
65 };
68 } // namespace Box3D
71 /** A function to print out the VanishingPoint (prints the coordinates) **/
72 /***
73 inline std::ostream &operator<< (std::ostream &out_file, const VanishingPoint &vp) {
74     out_file << vp;
75     return out_file;
76 }
77 ***/
80 #endif /* !SEEN_VANISHING_POINT_H */
82 /*
83   Local Variables:
84   mode:c++
85   c-file-style:"stroustrup"
86   c-file-offsets:((innamespace . 0)(inline-open . 0))
87   indent-tabs-mode:nil
88   fill-column:99
89   End:
90 */
91 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :