Code

afecb2e48b88489d479b5ed35fc5c6fe8f3bc543
[inkscape.git] / src / perspective3d.h
1 /*
2  * Class modelling a 3D perspective
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_PERSPECTIVE3D_H
13 #define SEEN_PERSPECTIVE3D_H
15 #include "vanishing-point.h"
17 class SP3DBox;
19 namespace Box3D {
21 class PerspectiveLine;
23 class Perspective3D {
24 public:
25     Perspective3D(VanishingPoint const &pt_x, VanishingPoint const &pt_y, VanishingPoint const &pt_z);
26     Perspective3D(Perspective3D &other);
27     ~Perspective3D();
29     VanishingPoint *get_vanishing_point (Box3D::Axis const dir);
30     void set_vanishing_point (Box3D::Axis const dir, VanishingPoint const &pt);
31     void add_box (SP3DBox *box);
32     void remove_box (const SP3DBox *box);
33     bool has_box (const SP3DBox *box);
35     static Perspective3D * current_perspective; // should current_perspective be moved to desktop.h?
37     SPDesktop * desktop; // we need to store the perspective's desktop to be able to access it in the destructor
39 private:
40     VanishingPoint *vp_x;
41     VanishingPoint *vp_y;
42     VanishingPoint *vp_z;
43     GSList * boxes; // holds a list of boxes sharing this specific perspective
44 };
46 Perspective3D * get_persp_of_box (const SP3DBox *box);
48 NR::Point perspective_intersection (NR::Point pt1, Box3D::Axis dir1, NR::Point pt2, Box3D::Axis dir2, Perspective3D *persp);
49 NR::Point perspective_line_snap (NR::Point pt, Box3D::Axis dir, NR::Point ext_pt, Perspective3D *persp);
51 } // namespace Box3D
54 /** A function to print out the VanishingPoint (prints the coordinates) **/
55 /***
56 inline std::ostream &operator<< (std::ostream &out_file, const VanishingPoint &vp) {
57     out_file << vp;
58     return out_file;
59 }
60 ***/
63 #endif /* !SEEN_PERSPECTIVE3D_H */
65 /*
66   Local Variables:
67   mode:c++
68   c-file-style:"stroustrup"
69   c-file-offsets:((innamespace . 0)(inline-open . 0))
70   indent-tabs-mode:nil
71   fill-column:99
72   End:
73 */
74 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :