1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/*
* Class modelling a 3D perspective
*
* Authors:
* Maximilian Albert <Anhalter42@gmx.de>
*
* Copyright (C) 2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifndef SEEN_PERSPECTIVE3D_H
#define SEEN_PERSPECTIVE3D_H
#include "vanishing-point.h"
#include "svg/stringstream.h"
#include <glib.h>
class SP3DBox;
namespace Box3D {
class PerspectiveLine;
class Perspective3D {
public:
Perspective3D(VanishingPoint const &pt_x, VanishingPoint const &pt_y, VanishingPoint const &pt_z);
Perspective3D(Perspective3D &other);
~Perspective3D();
bool operator== (Perspective3D const &other) const;
bool has_vanishing_point (VanishingPoint *vp);
VanishingPoint *get_vanishing_point (Box3D::Axis const dir);
Axis get_axis_of_VP (VanishingPoint *vp);
void set_vanishing_point (Box3D::Axis const dir, VanishingPoint const &pt);
void set_vanishing_point (Box3D::Axis const dir, gdouble pt_x, gdouble pt_y, gdouble dir_x, gdouble dir_y, VPState st);
void add_box (SP3DBox *box);
void remove_box (const SP3DBox *box);
bool has_box (const SP3DBox *box) const;
inline guint number_of_boxes () { return g_slist_length (boxes); }
void reshape_boxes (Box3D::Axis axes);
void update_box_reprs ();
void update_z_orders ();
/* convenience functions for interaction with dragging machinery: */
bool all_boxes_occur_in_list (GSList *boxes_to_do);
GSList * boxes_occurring_in_list (GSList * list_of_boxes);
void absorb (Perspective3D *other); // swallow the other perspective if both coincide
static gint counter; // for testing only
gint my_counter; // for testing only
static GSList * perspectives; // All existing 3D perspectives
// FIXME: Perspectives should be linked to the list of existing ones automatically in the constructor
// and removed in the destructor!
static void add_perspective (Box3D::Perspective3D * const persp);
static void remove_perspective (Box3D::Perspective3D * const persp);
/* find an existing perspective whose VPs are equal to those of persp */
static Box3D::Perspective3D * find_perspective (Box3D::Perspective3D * const persp);
static void print_debugging_info();
static Perspective3D * current_perspective;
private:
VanishingPoint *vp_x;
VanishingPoint *vp_y;
VanishingPoint *vp_z;
GSList * boxes; // holds a list of boxes sharing this specific perspective
};
Perspective3D * get_persp_of_box (const SP3DBox *box);
Perspective3D * get_persp_of_VP (const VanishingPoint *vp);
NR::Point perspective_intersection (NR::Point pt1, Box3D::Axis dir1, NR::Point pt2, Box3D::Axis dir2, Perspective3D *persp);
NR::Point perspective_line_snap (NR::Point pt, Box3D::Axis dir, NR::Point ext_pt, Perspective3D *persp);
} // 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_PERSPECTIVE3D_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 :
|