Code

Preparatory stuff to combine VPs in draggers
[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 "axis-manip.h"
18 #include "line-geometry.h" // TODO: Remove this include as soon as we don't need create_canvas_(point|line) any more.
20 namespace Box3D {
22 enum VPState {
23     VP_FINITE = 0, // perspective lines meet in the VP
24     VP_INFINITE    // perspective lines are parallel
25 };
27 // FIXME: Store the Axis of the VP inside the class
28 class VanishingPoint : public NR::Point {
29 public:
30     inline VanishingPoint() : NR::Point() {};
31     /***
32     inline VanishingPoint(NR::Point const &pt, NR::Point const &ref = NR::Point(0,0))
33                          : NR::Point (pt),
34                            ref_pt (ref),
35                            v_dir (pt[NR::X] - ref[NR::X], pt[NR::Y] - ref[NR::Y]) {}
36     inline VanishingPoint(NR::Coord x, NR::Coord y, NR::Point const &ref = NR::Point(0,0))
37                          : NR::Point (x, y),
38                            ref_pt (ref),
39                            v_dir (x - ref[NR::X], y - ref[NR::Y]) {}
40     ***/
41     VanishingPoint(NR::Point const &pt, NR::Point const &inf_dir, VPState st);
42     VanishingPoint(NR::Point const &pt);
43     VanishingPoint(NR::Point const &dir, VPState const state);
44     VanishingPoint(NR::Point const &pt, NR::Point const &direction);
45     VanishingPoint(NR::Coord x, NR::Coord y);
46     VanishingPoint(NR::Coord x, NR::Coord y, VPState const state);
47     VanishingPoint(NR::Coord x, NR::Coord y, NR::Coord dir_x, NR::Coord dir_y);
48     VanishingPoint(VanishingPoint const &rhs);
50     bool is_finite() const;
51     VPState toggle_parallel();
52     void draw(Box3D::Axis const axis); // Draws a point on the canvas if state == VP_FINITE
53     //inline VPState state() { return state; }
54         
55     VPState state;
56     //NR::Point ref_pt; // point of reference to compute the direction of parallel lines
57     NR::Point v_dir; // direction of perslective lines if the VP has state == VP_INFINITE
59 private:
60 };
63 } // namespace Box3D
66 /** A function to print out the VanishingPoint (prints the coordinates) **/
67 /***
68 inline std::ostream &operator<< (std::ostream &out_file, const VanishingPoint &vp) {
69     out_file << vp;
70     return out_file;
71 }
72 ***/
75 #endif /* !SEEN_VANISHING_POINT_H */
77 /*
78   Local Variables:
79   mode:c++
80   c-file-style:"stroustrup"
81   c-file-offsets:((innamespace . 0)(inline-open . 0))
82   indent-tabs-mode:nil
83   fill-column:99
84   End:
85 */
86 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :