summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0c24fa5)
raw | patch | inline | side by side (parent: 0c24fa5)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 3 Jul 2007 18:38:27 +0000 (18:38 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 3 Jul 2007 18:38:27 +0000 (18:38 +0000) |
diff --git a/src/box3d-face.cpp b/src/box3d-face.cpp
index 8b3b5d96886a578428976c568b42aee636e81fea..d038de84f1f6442a49a37b6489e18932c8407a4e 100644 (file)
--- a/src/box3d-face.cpp
+++ b/src/box3d-face.cpp
}
void Box3DFace::set_shape(NR::Point const ul, NR::Point const lr,
- Box3D::PerspDir const dir1, Box3D::PerspDir const dir2,
+ Box3D::Axis const dir1, Box3D::Axis const dir2,
unsigned int shift_count, NR::Maybe<NR::Point> pt_align, bool align_along_PL)
{
corners[0] = ul;
corners[2] = lr;
} else {
if (align_along_PL) {
- Box3D::PerspDir dir3 = Box3D::third_axis_direction (dir1, dir2);
+ Box3D::Axis dir3 = Box3D::third_axis_direction (dir1, dir2);
Box3D::Line line1(*SP3DBoxContext::current_perspective->get_vanishing_point(dir1), lr);
Box3D::Line line2(*pt_align, *SP3DBoxContext::current_perspective->get_vanishing_point(dir3));
corners[2] = *line1.intersect(line2);
diff --git a/src/box3d-face.h b/src/box3d-face.h
index 124d51776ae756e32db780fd0c686f913ae6a62d..1b1eb451e61ffe7886d130b9d8d2b316ed4891b9 100644 (file)
--- a/src/box3d-face.h
+++ b/src/box3d-face.h
public:
Box3DFace(SP3DBox *box3d);
//Box3DFace(SP3DBox *box3d, NR::Point const ul, NR::Point const lr,
- // Box3D::PerspDir const dir1, Box3D::PerspDir const dir2,
+ // Box3D::Axis const dir1, Box3D::Axis const dir2,
// unsigned int shift_count = 0, NR::Maybe<NR::Point> pt_align = NR::Nothing(), bool align_along_PL = false);
Box3DFace(Box3DFace const &box3dface);
NR::Point operator[](unsigned int i);
void draw(SP3DBox *box3d, SPCurve *c);
void set_shape(NR::Point const ul, NR::Point const lr,
- Box3D::PerspDir const dir1, Box3D::PerspDir const dir2,
+ Box3D::Axis const dir1, Box3D::Axis const dir2,
unsigned int shift_count = 0, NR::Maybe<NR::Point> pt_align = NR::Nothing(),
bool align_along_PL = false);
private:
NR::Point corners[4];
- Box3D::PerspDir dir1;
- Box3D::PerspDir dir2;
+ Box3D::Axis dir1;
+ Box3D::Axis dir2;
SPPath *path;
SP3DBox *parent_box3d; // the parent box
index b2e4d23402666a52c3ed27909a56024183f8a130..158ddd47bd2a2b7be83a0c77a51704622d3cc600 100644 (file)
--- a/src/perspective-line.cpp
+++ b/src/perspective-line.cpp
namespace Box3D {
-PerspectiveLine::PerspectiveLine (NR::Point const &pt, PerspDir const axis, Perspective3D *perspective) :
+PerspectiveLine::PerspectiveLine (NR::Point const &pt, Box3D::Axis const axis, Perspective3D *perspective) :
Line (pt, *(perspective->get_vanishing_point(axis)), true)
{
g_assert (perspective != NULL);
diff --git a/src/perspective-line.h b/src/perspective-line.h
index a1c61c52272ef283d30954b8b9504b483ec0783c..45a9b0be642eacaa7d92b0e6eb2bb2bbd4f0b297 100644 (file)
--- a/src/perspective-line.h
+++ b/src/perspective-line.h
* PL runs through it; otherwise it has the direction specified by the v_dir vector
* of the VP.
*/
- PerspectiveLine (NR::Point const &pt, PerspDir const axis,
+ PerspectiveLine (NR::Point const &pt, Box3D::Axis const axis,
Perspective3D *perspective = SP3DBoxContext::current_perspective);
NR::Maybe<NR::Point> intersect (Line const &line); // FIXME: Can we make this return only a NR::Point to remove the extra method meet()?
NR::Point meet (Line const &line);
private:
- PerspDir vp_dir; // direction of the associated VP
+ Box3D::Axis vp_dir; // direction of the associated VP
Perspective3D *persp;
};
diff --git a/src/perspective3d.cpp b/src/perspective3d.cpp
index 678b695d0b31ffe8ea4dbd82f624c54e87442f2b..35558e832280a378ca809f55436f2a7636bcccb5 100644 (file)
--- a/src/perspective3d.cpp
+++ b/src/perspective3d.cpp
* vanishing points in the given directions.
*/
// FIXME: This has been moved to a virtual method inside PerspectiveLine; can probably be purged
-NR::Point perspective_intersection (NR::Point pt1, Box3D::PerspDir dir1, NR::Point pt2, Box3D::PerspDir dir2)
+NR::Point perspective_intersection (NR::Point pt1, Box3D::Axis dir1, NR::Point pt2, Box3D::Axis dir2)
{
VanishingPoint const *vp1 = SP3DBoxContext::current_perspective->get_vanishing_point(dir1);
VanishingPoint const *vp2 = SP3DBoxContext::current_perspective->get_vanishing_point(dir2);
* Find the point on the perspective line from line_pt to the
* vanishing point in direction dir that is closest to ext_pt.
*/
-NR::Point perspective_line_snap (NR::Point line_pt, PerspDir dir, NR::Point ext_pt)
+NR::Point perspective_line_snap (NR::Point line_pt, Box3D::Axis dir, NR::Point ext_pt)
{
return PerspectiveLine(line_pt, dir).closest_to(ext_pt);
}
vp_z.draw(Z);
}
-VanishingPoint *Perspective3D::get_vanishing_point (PerspDir const dir)
+VanishingPoint *Perspective3D::get_vanishing_point (Box3D::Axis const dir)
{
// FIXME: Also handle value 'NONE' in switch
switch (dir) {
}
}
-void Perspective3D::set_vanishing_point (PerspDir const dir, VanishingPoint const &pt)
+void Perspective3D::set_vanishing_point (Box3D::Axis const dir, VanishingPoint const &pt)
{
- // FIXME: Also handle value 'NONE' in switch
switch (dir) {
case X:
vp_x = pt;
case Z:
vp_z = pt;
break;
+ case NONE:
+ // no vanishing point to set
+ break;
}
}
diff --git a/src/perspective3d.h b/src/perspective3d.h
index 9f033f80da32c85efdff0bd6530b0e031d26ff94..007b02df19c4af82663b1d3a5c0eebc791d10448 100644 (file)
--- a/src/perspective3d.h
+++ b/src/perspective3d.h
namespace Box3D {
-NR::Point perspective_intersection (NR::Point pt1, Box3D::PerspDir dir1, NR::Point pt2, Box3D::PerspDir dir2);
-NR::Point perspective_line_snap (NR::Point pt, PerspDir dir, NR::Point ext_pt);
+NR::Point perspective_intersection (NR::Point pt1, Box3D::Axis dir1, NR::Point pt2, Box3D::Axis dir2);
+NR::Point perspective_line_snap (NR::Point pt, Box3D::Axis dir, NR::Point ext_pt);
class PerspectiveLine;
public:
Perspective3D(VanishingPoint const &pt_x, VanishingPoint const &pt_y, VanishingPoint const &pt_z);
- VanishingPoint *get_vanishing_point (PerspDir const dir);
- void set_vanishing_point (PerspDir const dir, VanishingPoint const &pt);
+ VanishingPoint *get_vanishing_point (Box3D::Axis const dir);
+ void set_vanishing_point (Box3D::Axis const dir, VanishingPoint const &pt);
private:
VanishingPoint vp_x;
index 7933fbebadede27a1322425a7f79191025265072..21bb7fa769e352f76eb52f1e7b2a15bc81859a74 100644 (file)
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
return this->state;
}
-void VanishingPoint::draw(PerspDir const axis)
+void VanishingPoint::draw(Box3D::Axis const axis)
{
switch (axis) {
case X:
diff --git a/src/vanishing-point.h b/src/vanishing-point.h
index de06002e4ddc47e188dc280d985e2468c04bdb63..3be5d085ee35ce3733bf3d74e7272b2ea06eef2c 100644 (file)
--- a/src/vanishing-point.h
+++ b/src/vanishing-point.h
// The X-/Y-/Z-axis corresponds to the first/second/third digit
// in binary representation, respectively.
-enum PerspDir {
+enum Axis {
X = 1,
Y = 2,
Z = 4,
/** Given two axis directions out of {X, Y, Z}, returns the remaining one */
-inline Box3D::PerspDir third_axis_direction (Box3D::PerspDir dir1, Box3D::PerspDir dir2) {
- return (Box3D::PerspDir) ((dir1 + dir2) ^ 0x7);
+inline Box3D::Axis third_axis_direction (Box3D::Axis dir1, Box3D::Axis dir2) {
+ return (Box3D::Axis) ((dir1 + dir2) ^ 0x7);
}
-// FIXME: Store the PerspDir of the VP inside the class
+// FIXME: Store the Axis of the VP inside the class
class VanishingPoint : public NR::Point {
public:
inline VanishingPoint() : NR::Point() {};
bool is_finite();
VPState toggle_parallel();
- void draw(PerspDir const axis); // Draws a point on the canvas if state == VP_FINITE
+ void draw(Box3D::Axis const axis); // Draws a point on the canvas if state == VP_FINITE
//inline VPState state() { return state; }
VPState state;
index aa5165d15ef6bdabad3b57ef130a923cc3c310d7..741f4aacaaa8c04b09d54a2d81374af6682f3a5b 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -2107,7 +2107,7 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
static void sp_3dbox_toggle_vp_changed( GtkToggleAction *act, gpointer data )
{
guint dir = GPOINTER_TO_UINT(data);
- Box3D::PerspDir axis;// = (Box3D::PerspDir) data;
+ Box3D::Axis axis;// = (Box3D::Axis) data;
GString *pstring;
switch (dir) {