Code

Swap axis directions Y and Z (for consistency)
authorcilix42 <cilix42@users.sourceforge.net>
Tue, 3 Jul 2007 18:11:42 +0000 (18:11 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Tue, 3 Jul 2007 18:11:42 +0000 (18:11 +0000)
src/box3d-context.cpp
src/box3d-face.cpp
src/box3d.cpp

index a46783f4cec67789a60e9e636e85d6674444aee8..35bdb6af27eb16e2b9b2526c48928e2e358f830d 100644 (file)
@@ -123,11 +123,11 @@ static void sp_3dbox_context_init(SP3DBoxContext *box3d_context)
                                               Box3D::VanishingPoint( NR::Point( 50.0, 600.0),
                                                                      NR::Point( -1.0,   0.0), Box3D::VP_INFINITE),
                                               // VP in y-direction
-                                              Box3D::VanishingPoint( NR::Point(700.0, 500.0),
-                                                                     NR::Point(sqrt(3.0),1.0), Box3D::VP_INFINITE),
-                                              // VP in z-direction
                                               Box3D::VanishingPoint( NR::Point(500.0,1000.0),
-                                                                     NR::Point(  0.0,   1.0), Box3D::VP_INFINITE));
+                                                                     NR::Point(  0.0,   1.0), Box3D::VP_INFINITE),
+                                              // VP in z-direction
+                                              Box3D::VanishingPoint( NR::Point(700.0, 500.0),
+                                                                     NR::Point(sqrt(3.0),1.0), Box3D::VP_INFINITE));
     }
     
     new (&box3d_context->sel_changed_connection) sigc::connection();
@@ -366,18 +366,18 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
                 // Without Ctrl, motion of the extruded corner is constrained to the
                 // perspective line from drag_ptB to vanishing point Y.
                 if (!rc->ctrl_dragged) {
-                       rc->drag_ptC = Box3D::perspective_line_snap (rc->drag_ptB, Box3D::Y, motion_dt);
+                       rc->drag_ptC = Box3D::perspective_line_snap (rc->drag_ptB, Box3D::Z, motion_dt);
                 } else {
                     rc->drag_ptC = motion_dt;
                 }
                 rc->drag_ptC = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, rc->drag_ptC, rc->item).getPoint();
                 if (rc->ctrl_dragged) {
-                       Box3D::PerspectiveLine pl1 (NR::Point (event_context->xp, event_context->yp), Box3D::Z);
+                       Box3D::PerspectiveLine pl1 (NR::Point (event_context->xp, event_context->yp), Box3D::Y);
                        Box3D::PerspectiveLine pl2 (rc->drag_ptB, Box3D::X);
                        NR::Point corner1 = pl1.meet(pl2);
                        
                        Box3D::PerspectiveLine pl3 (corner1, Box3D::X);
-                       Box3D::PerspectiveLine pl4 (rc->drag_ptC, Box3D::Y);
+                       Box3D::PerspectiveLine pl4 (rc->drag_ptC, Box3D::Z);
                        rc->drag_ptB = pl3.meet(pl4);
                 }
             }
index b3a26b9caec04aa091acea92e40aca57efdf002f..13e19d769a81bcd90edad7543e800aa5ef83a14a 100644 (file)
@@ -31,12 +31,12 @@ void Box3DFace::set_shape(NR::Point const ul, NR::Point const lr,
     } else {
         if (align_along_PL) {
                Box3D::PerspDir dir3;
-            if (dir1 == Box3D::X && dir2 == Box3D::Y) dir3 = Box3D::Z;
             if (dir1 == Box3D::X && dir2 == Box3D::Z) dir3 = Box3D::Y;
-            if (dir1 == Box3D::Y && dir2 == Box3D::X) dir3 = Box3D::Z;
-            if (dir1 == Box3D::Y && dir2 == Box3D::Z) dir3 = Box3D::X;
+            if (dir1 == Box3D::X && dir2 == Box3D::Y) dir3 = Box3D::Z;
             if (dir1 == Box3D::Z && dir2 == Box3D::X) dir3 = Box3D::Y;
             if (dir1 == Box3D::Z && dir2 == Box3D::Y) dir3 = Box3D::X;
+            if (dir1 == Box3D::Y && dir2 == Box3D::X) dir3 = Box3D::Z;
+            if (dir1 == Box3D::Y && dir2 == Box3D::Z) dir3 = Box3D::X;
             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);
index af31ff1a1fb00f4c414af55f297e723303083eb8..94dfaf99693e09943993f49c704bfd2ad9a431ea 100644 (file)
@@ -199,19 +199,19 @@ sp_3dbox_set_shape(SP3DBox *box3d)
 
     if (bc->extruded) {
         sp_3dbox_compute_specific_corners (bc, corner1, corner2, corner3, corner4);
-        box3d->faces[2].set_shape(bc->drag_origin, corner4, Box3D::Y, Box3D::Z);
+        box3d->faces[2].set_shape(bc->drag_origin, corner4, Box3D::Z, Box3D::Y);
         box3d->faces[2].set_curve();
-        box3d->faces[3].set_shape(corner2, corner4, Box3D::X, Box3D::Z);
+        box3d->faces[3].set_shape(corner2, corner4, Box3D::X, Box3D::Y);
         box3d->faces[3].set_curve();
-        box3d->faces[4].set_shape(bc->drag_origin, corner2, Box3D::X, Box3D::Y);
+        box3d->faces[4].set_shape(bc->drag_origin, corner2, Box3D::X, Box3D::Z);
         box3d->faces[4].set_curve();
-        box3d->faces[5].set_shape(bc->drag_ptB, corner4, Box3D::X, Box3D::Y);
+        box3d->faces[5].set_shape(bc->drag_ptB, corner4, Box3D::X, Box3D::Z);
         box3d->faces[5].set_curve();
 
-        box3d->faces[1].set_shape(corner1, bc->drag_ptC, Box3D::Y, Box3D::Z);
+        box3d->faces[1].set_shape(corner1, bc->drag_ptC, Box3D::Z, Box3D::Y);
         box3d->faces[1].set_curve();
     }
-    box3d->faces[0].set_shape(bc->drag_origin, bc->drag_ptB, Box3D::X, Box3D::Z);
+    box3d->faces[0].set_shape(bc->drag_origin, bc->drag_ptB, Box3D::X, Box3D::Y);
     box3d->faces[0].set_curve();
 }
 
@@ -222,19 +222,19 @@ sp_3dbox_compute_specific_corners (SP3DBoxContext *box3d_context, NR::Point &cor
         // TODO: Check for numerical stability and handle "wrong" cases more gracefully.
         //       (This now mostly applies to the intersection code in the PerspectiveLine class)
         Box3D::PerspectiveLine pl1 (box3d_context->drag_origin, Box3D::X);
-        Box3D::PerspectiveLine pl2 (box3d_context->drag_ptB, Box3D::Z);
+        Box3D::PerspectiveLine pl2 (box3d_context->drag_ptB, Box3D::Y);
         corner1 = pl1.meet(pl2);
 
-        Box3D::PerspectiveLine pl3 (corner1, Box3D::Y);
-        Box3D::PerspectiveLine pl4 (box3d_context->drag_ptC, Box3D::Z);
+        Box3D::PerspectiveLine pl3 (corner1, Box3D::Z);
+        Box3D::PerspectiveLine pl4 (box3d_context->drag_ptC, Box3D::Y);
         corner2 = pl3.meet(pl4);
 
         Box3D::PerspectiveLine pl5 (corner2, Box3D::X);
-        Box3D::PerspectiveLine pl6 (box3d_context->drag_origin, Box3D::Y);
+        Box3D::PerspectiveLine pl6 (box3d_context->drag_origin, Box3D::Z);
         corner3 = pl5.meet(pl6);
 
         Box3D::PerspectiveLine pl7 (box3d_context->drag_ptC, Box3D::X);
-        Box3D::PerspectiveLine pl8 (corner3, Box3D::Z);
+        Box3D::PerspectiveLine pl8 (corner3, Box3D::Y);
         corner4 = pl7.meet(pl8);
 }