Code

Enable center-dragging of boxes ('in perspective') within the XY-plane
[inkscape.git] / src / perspective-line.h
1 /*
2  * Perspective line 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_PERSPECTIVE_LINE_H
13 #define SEEN_PERSPECTIVE_LINE_H
15 #include "vanishing-point.h"
16 #include "line-geometry.h"
17 #include "box3d-context.h" 
18 #include <glib.h>
20 class SPDesktop;
22 namespace Box3D {
24 class PerspectiveLine : public Box3D::Line {
25 public:
26     /** 
27      * Create a perspective line starting at 'pt' and pointing in the direction of the
28      * vanishing point corresponding to 'axis'. If the VP has style VP_FINITE then the
29      * PL runs through it; otherwise it has the direction specified by the v_dir vector
30      * of the VP.
31      */
32     PerspectiveLine (NR::Point const &pt, Box3D::Axis const axis, Perspective3D *perspective);
33     NR::Maybe<NR::Point> intersect (Line const &line); // FIXME: Can we make this return only a NR::Point to remove the extra method meet()?
34     NR::Point meet (Line const &line);
35     NR::Point pt_with_given_cross_ratio (NR::Point const &C, NR::Point const &D, double gamma);
36     NR::Maybe<NR::Point> intersection_with_viewbox (SPDesktop *desktop);
38 private:
39     Box3D::Axis vp_dir; // direction of the associated VP
40     Perspective3D *persp;
41 };
44 } // namespace Box3D
47 /** A function to print out the VanishingPoint (prints the coordinates) **/
48 /***
49 inline std::ostream &operator<< (std::ostream &out_file, const VanishingPoint &vp) {
50     out_file << vp;
51     return out_file;
52 }
53 ***/
56 #endif /* !SEEN_PERSPECTIVE_LINE_H */
58 /*
59   Local Variables:
60   mode:c++
61   c-file-style:"stroustrup"
62   c-file-offsets:((innamespace . 0)(inline-open . 0))
63   indent-tabs-mode:nil
64   fill-column:99
65   End:
66 */
67 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :