diff --git a/src/box3d.cpp b/src/box3d.cpp
index 057329a28f4f60937a68881560e0e46ab248ce89..93efa5c35183589ea7e604066d7afb9d93e8b52d 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
#include "attributes.h"
#include "xml/document.h"
#include "xml/repr.h"
-#include "libnr/nr-matrix-fns.h"
#include "box3d.h"
#include "box3d-side.h"
#include "line-geometry.h"
#include "persp3d-reference.h"
#include "uri.h"
-#include "2geom/geom.h"
+#include <2geom/line.h>
#include "sp-guide.h"
#include "sp-namedview.h"
#include "preferences.h"
Persp3D *persp = box3d_get_perspective(box);
Persp3D *transf_persp;
- if (!persp3d_has_all_boxes_in_selection (persp)) {
+ if (sp_desktop_document(inkscape_active_desktop()) == SP_OBJECT_DOCUMENT(item) &&
+ !persp3d_has_all_boxes_in_selection (persp)) {
std::list<SPBox3D *> selboxes = sp_desktop_selection(inkscape_active_desktop())->box3DList();
/* create a new perspective as a copy of the current one and link the selected boxes to it */
static bool
box3d_half_line_crosses_joining_line (Geom::Point const &A, Geom::Point const &B,
Geom::Point const &C, Geom::Point const &D) {
- Geom::Point E; // the point of intersection
Geom::Point n0 = (B - A).ccw();
double d0 = dot(n0,A);
Geom::Point n1 = (D - C).ccw();
double d1 = dot(n1,C);
- Geom::IntersectorKind intersects = Geom::line_intersection(n0, d0, n1, d1, E);
- if (intersects == Geom::coincident || intersects == Geom::parallel) {
+
+ Geom::Line lineAB(A,B);
+ Geom::Line lineCD(C,D);
+
+ Geom::OptCrossing inters = Geom::OptCrossing(); // empty by default
+ try
+ {
+ inters = Geom::intersection(lineAB, lineCD);
+ }
+ catch (Geom::InfiniteSolutions e)
+ {
+ // We're probably dealing with parallel lines, so they don't really cross
+ return false;
+ }
+
+ if (!inters) {
return false;
}
+ Geom::Point E = lineAB.pointAt((*inters).ta); // the point of intersection
+
if ((dot(C,n0) < d0) == (dot(D,n0) < d0)) {
// C and D lie on the same side of the line AB
return false;