summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e0c254c)
raw | patch | inline | side by side (parent: e0c254c)
author | cilix42 <cilix42@users.sourceforge.net> | |
Sun, 26 Aug 2007 17:56:46 +0000 (17:56 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Sun, 26 Aug 2007 17:56:46 +0000 (17:56 +0000) |
diff --git a/src/axis-manip.h b/src/axis-manip.h
index 32c1e61375a8f864c1616347106dda5ef22a529d..4ebdb5aab342139b96cac6a9bc43a55675d1ce96 100644 (file)
--- a/src/axis-manip.h
+++ b/src/axis-manip.h
}
}
-inline guint opposite_face (guint face_id) {
+inline gint opposite_face (guint face_id) {
return face_id + ((face_id % 2 == 0) ? 1 : -1);
}
// Warning: We don't check that axis really unambiguously specifies a plane.
// Make sure this is the case when calling this function.
-inline guint face_containing_corner (Box3D::Axis axis, guint corner) {
+inline gint face_containing_corner (Box3D::Axis axis, guint corner) {
if (!is_single_axis_direction (axis)) {
axis = (Box3D::Axis) (axis ^ Box3D::XYZ);
}
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 0f672aab25d7ba243cd0b54297dd4ecc69ac60b4..8df5c3b52bd9b975a3cdb048185434aa9a8a4301 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -439,7 +439,7 @@ sp_3dbox_corner_angle_to_VP (SP3DBox *box, Box3D::Axis axis, guint extreme_corne
bool sp_3dbox_recompute_z_orders (SP3DBox *box)
{
- guint new_z_orders[6];
+ gint new_z_orders[6];
// TODO: Determine the front corner depending on the distance from VPs and/or the user presets
guint front_corner = sp_3dbox_get_front_corner_id (box);
@@ -636,13 +636,9 @@ static void sp_3dbox_corner_configuration (SP3DBox *box, std::vector<gint> &on_h
/* returns true if there was a change in the z-orders (which triggers an update of the repr) */
static bool sp_3dbox_recompute_z_orders_by_corner_configuration (SP3DBox *box)
{
- guint new_z_orders[6];
+ gint new_z_orders[6];
Box3D::Axis front_rear_axis = Box3D::Z;
- Box3D::Axis axis1 = Box3D::get_remaining_axes (front_rear_axis).first;
- Box3D::Axis axis2 = Box3D::get_remaining_axes (front_rear_axis).second;
- Box3D::Axis front_plane = Box3D::orth_plane_or_axis (front_rear_axis);
-
std::vector<gint> on_hull;
std::vector<gint> inside_hull;
std::vector<gint> visible_faces;
diff --git a/src/box3d.h b/src/box3d.h
index 57c4f0e9bc61452161b328f7b73de08779533ff6..27e7341937d0969d88ccf16e3ee8f6b1eccf8555 100644 (file)
--- a/src/box3d.h
+++ b/src/box3d.h
struct SP3DBox : public SPGroup {
NR::Point corners[8];
Box3DFace *faces[6];
- guint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
+ gint z_orders[6]; // z_orders[i] holds the ID of the face at position #i in the group (from top to bottom)
std::vector<gint> currently_visible_faces;
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp
index 000da8a07043a6c8d19e286b3ca61ecd19f56cfb..549defb2ed71f335c1832dfb85aa713e970d86e8 100644 (file)
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
@@ -121,9 +121,14 @@ bool lies_in_sector (NR::Point const &v1, NR::Point const &v2, NR::Point const &
return (coords.first >= 0 and coords.second >= 0);
}
-static double pos_angle (NR::Point A, NR::Point B)
+bool lies_in_quadrangle (NR::Point const &A, NR::Point const &B, NR::Point const &C, NR::Point const &D, NR::Point const &pt)
{
- return fabs (NR::atan2 (A) - NR::atan2 (B));
+ return (lies_in_sector (D - A, B - A, pt - A) && lies_in_sector (D - C, B - C, pt - C));
+}
+
+static double pos_angle (NR::Point v, NR::Point w)
+{
+ return fabs (NR::atan2 (v) - NR::atan2 (w));
}
/*
diff --git a/src/line-geometry.h b/src/line-geometry.h
index 72e0ae794afcba9655ed633c761fcf6bae10cccc..fc8f157e99b42225c372711ed9ed8850c94aba66 100644 (file)
--- a/src/line-geometry.h
+++ b/src/line-geometry.h
virtual ~Line() {}
Line &operator=(Line const &line);
virtual NR::Maybe<NR::Point> intersect(Line const &line);
- void set_direction(NR::Point const &dir); // FIXME: Can we avoid this explicit assignment?
+ inline NR::Point direction () { return v_dir; }
NR::Point closest_to(NR::Point const &pt); // returns the point on the line closest to pt
return (pt + lambda * NR::unit_vector (v_dir)); }
protected:
+ void set_direction(NR::Point const &dir);
inline static bool pts_coincide (NR::Point const pt1, NR::Point const pt2)
{
return (NR::L2 (pt2 - pt1) < epsilon);
std::pair<double, double> coordinates (NR::Point const &v1, NR::Point const &v2, NR::Point const &w);
bool lies_in_sector (NR::Point const &v1, NR::Point const &v2, NR::Point const &w);
+bool lies_in_quadrangle (NR::Point const &A, NR::Point const &B, NR::Point const &C, NR::Point const &D, NR::Point const &pt);
std::pair<NR::Point, NR::Point> side_of_intersection (NR::Point const &A, NR::Point const &B,
NR::Point const &C, NR::Point const &D,
NR::Point const &pt, NR::Point const &dir);
diff --git a/src/perspective3d.cpp b/src/perspective3d.cpp
index 9f79d25bd9dd6b824c127f0805df56d0bbf22255..8b1b3863de97d9c8c6a0416fcd6548cc5e37e3c4 100644 (file)
--- a/src/perspective3d.cpp
+++ b/src/perspective3d.cpp
}
}
+/* the direction from a point pt towards the specified vanishing point of the perspective */
+NR::Point
+Perspective3D::direction (NR::Point pt, Box3D::Axis axis)
+{
+ Box3D::VanishingPoint *vp = this->get_vanishing_point (axis);
+ if (!vp->is_finite()) {
+ return vp->v_dir;
+ }
+ return (vp->get_pos() - pt);
+}
+
// swallow the list of boxes from the other perspective and delete it
void
Perspective3D::absorb (Perspective3D *other)
if (j != NULL) {
g_print ("%d", SP_3DBOX (j->data)->my_counter);
}
+ g_print ("\n");
}
+ g_print ("\n");
}
- g_print ("\n====================================================\n");
+ g_print ("====================================================\n");
}
} // namespace Box3D
diff --git a/src/perspective3d.h b/src/perspective3d.h
index a56003393e026f16833a6cd8685d87766c419d9e..8c63cf42e12d7c27eefd3a4c09dd4735d19942a1 100644 (file)
--- a/src/perspective3d.h
+++ b/src/perspective3d.h
void update_box_reprs ();
void update_z_orders ();
+ NR::Point direction (NR::Point pt, Box3D::Axis axis);
+
/* 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);