summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ebe7661)
raw | patch | inline | side by side (parent: ebe7661)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 28 Aug 2007 10:40:42 +0000 (10:40 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 28 Aug 2007 10:40:42 +0000 (10:40 +0000) |
src/box3d-context.cpp | patch | blob | history | |
src/box3d-face.cpp | patch | blob | history | |
src/box3d.cpp | patch | blob | history | |
src/line-geometry.cpp | patch | blob | history |
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index f5a76655c929129b6c307bc6ad8491bd388de1e4..8b8b1ca9932b010d7900383459baaafba97cbe46 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -360,12 +360,11 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
bc->ctrl_dragged = event->motion.state & GDK_CONTROL_MASK;
- if (event->motion.state & GDK_SHIFT_MASK && !bc->extruded) {
+ if (event->motion.state & GDK_SHIFT_MASK && !bc->extruded && bc->item) {
/* once shift is pressed, set bc->extruded (no need to create further faces;
all of them are already created in sp_3dbox_init); since we made the rear face
invisible in the beginning to avoid "flashing", we must set its correct style now */
bc->extruded = true;
- g_assert (bc->item);
SP_3DBOX (bc->item)->faces[5]->set_style (NULL, true);
}
diff --git a/src/box3d-face.cpp b/src/box3d-face.cpp
index de52031dadd237a7b528d3cdc1712d21c148eecc..a1b7ae863c45f6629005f01defada8948d11d493 100644 (file)
--- a/src/box3d-face.cpp
+++ b/src/box3d-face.cpp
void Box3DFace::set_curve()
{
if (this->path == NULL) {
- g_warning("this->path is NULL! \n");
return;
}
NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM (this->parent_box3d)));
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 8df5c3b52bd9b975a3cdb048185434aa9a8a4301..0cf0743dbc6568f4218e1cb9aae1400be3635c29 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
((SPObjectClass *) (parent_class))->update(object, ctx, flags);
}
-
-
static Inkscape::XML::Node *sp_3dbox_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
{
SP3DBox *box = SP_3DBOX(object);
@@ -666,24 +664,24 @@ static bool sp_3dbox_recompute_z_orders_by_corner_configuration (SP3DBox *box)
guint visible_front_corner = (((c_cmp & front_rear_axis) == (c1 & front_rear_axis)) ? c1 : c2);
visible_faces = sp_3dbox_faces_meeting_in_corner (visible_front_corner);
} else {
- g_print ("Warning: Unhandled case. Current z-orders remain unchanged.\n");
+ /* Under what conditions do we end up here? Can we safely ignore this case? */
return false;
}
break;
}
default:
- g_print ("Warning: Unhandled case. Current z-orders are not changed.\n");
+ /* Under what conditions do we end up here? Can we safely ignore this case? */
return false;
}
- // check for weird corner configurations that cannot be handled by the above code
+ /* catch weird corner configurations; these should be theoretically impossible, but maybe
+ occur in (almost) degenerate cases due to rounding errors, for example */
if (std::find (visible_faces.begin(), visible_faces.end(), -1) != visible_faces.end()) {
- g_warning ("Theoretically impossible corner configuration\n");
return false;
}
- // sort the list of visible faces for later use (although it may be already sorted anyway)
+ /* sort the list of visible faces for later use (although it may be already sorted anyway) */
std::sort (visible_faces.begin(), visible_faces.end());
std::vector<gint> invisible_faces;
std::swap (visible_faces, invisible_faces);
if (!sp_3dbox_is_subset_or_superset (visible_faces, box->currently_visible_faces) &&
!sp_3dbox_differ_by_opposite_faces (visible_faces, box->currently_visible_faces)) {
- // FIXME: Hopefully this case is only caused by rounding errors or something similar;
- // does it need further investigation?
- g_warning ("Can't find out which faces are visible and which aren't ...\n");
+ /* Hopefully this case is only caused by rounding errors or something similar;
+ does it need further investigation? */
return false;
}
}
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp
index 549defb2ed71f335c1832dfb85aa713e970d86e8..5d8eca8a12197f2138f4dbdca8b215dd15b6296d 100644 (file)
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
NR::Maybe<NR::Point> Line::intersect(Line const &line) {
NR::Coord denom = NR::dot(v_dir, line.normal);
NR::Maybe<NR::Point> no_point = NR::Nothing();
- g_return_val_if_fail(fabs(denom) > 1e-6, no_point );
+ if (fabs(denom) < 1e-6)
+ return no_point;
NR::Coord lambda = (line.d0 - NR::dot(pt, line.normal)) / denom;
return pt + lambda * v_dir;