[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h
From: |
Udo Giacomozzi |
Subject: |
[Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h |
Date: |
Wed, 24 Oct 2007 12:15:56 +0000 |
CVSROOT: /cvsroot/gnash
Module name: gnash
Changes by: Udo Giacomozzi <udog> 07/10/24 12:15:56
Modified files:
. : ChangeLog
libgeometry : snappingrange.h
Log message:
libgeometry/snappingrange.h: add routines for calculating intersections
between SnappingRanges
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4681&r2=1.4682
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/snappingrange.h?cvsroot=gnash&r1=1.24&r2=1.25
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.4681
retrieving revision 1.4682
diff -u -b -r1.4681 -r1.4682
--- ChangeLog 24 Oct 2007 07:58:13 -0000 1.4681
+++ ChangeLog 24 Oct 2007 12:15:55 -0000 1.4682
@@ -1,3 +1,8 @@
+2007-10-24 Udo Giacomozzi <address@hidden>
+
+ * libgeometry/snappingrange.h: add routines for calculating
+ intersections between SnappingRanges
+
2007-10-24 Sandro Santilli <address@hidden>
* server/as_object.{cpp,h}: add update_member to only
Index: libgeometry/snappingrange.h
===================================================================
RCS file: /cvsroot/gnash/gnash/libgeometry/snappingrange.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- libgeometry/snappingrange.h 1 Jul 2007 10:54:11 -0000 1.24
+++ libgeometry/snappingrange.h 24 Oct 2007 12:15:56 -0000 1.25
@@ -16,7 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: snappingrange.h,v 1.24 2007/07/01 10:54:11 bjacques Exp $
+// $Id: snappingrange.h,v 1.25 2007/10/24 12:15:56 udog Exp $
#ifndef GNASH_SNAPPINGRANGE_H
#define GNASH_SNAPPINGRANGE_H
@@ -117,6 +117,13 @@
}
}
+ /// Copy the snapping settings from another ranges list, without
+ /// copying the ranges itself
+ void inheritConfig(const SnappingRanges2d<T>& from) {
+ snap_distance = from.snap_distance;
+ single_mode = from.single_mode;
+ }
+
/// Add a Range to the set, merging when possible and appropriate
void add(const RangeType& range) {
if (range.isWorld()) {
@@ -419,6 +426,81 @@
}
+ /// Intersect this ranges list with the given ranges list,
+ /// updating the current ranges list.
+ /// Note this is currently a relatively expensive operation
+ /// for complex lists.
+ ///
+ void intersect(const SnappingRanges2d<T>& o)
+ {
+ if (o.isNull()) {
+ setNull();
+ return;
+ }
+
+ if (o.isWorld()) return;
+
+ // We create a new ranges set for each range in "o" and
+ // then update ourselves with the *union* of these ranges.
+ // Anybody knows a better method (in terms of efficieny) ?
+
+ std::vector< SnappingRanges2d<T> > list;
+
+ //TODO: use a visitor !
+ for (unsigned rno=0, rcount=o.size(); rno<rcount; rno++) {
+
+ // add a copy of ourselves to the list
+ list.push_back(*this);
+
+ // intersect that copy with the single range
+ list.back().intersect(o.getRange(rno));
+
+ }
+
+ // update ourselves with the union of the "list"
+ setNull();
+ for (unsigned lno=0, lcount=list.size(); lno<lcount; lno++)
+ add(list.at(lno));
+
+ }
+
+
+ /// Intersects this ranges list with the given single range,
+ /// updating the current ranges list.
+ void intersect(const RangeType& r)
+ {
+
+ finalize();
+
+ if (isWorld()) { // world intersection with X = X
+ setNull();
+ add(r);
+ return;
+ }
+
+ if (isNull()) return; // NULL will always remain NULL
+
+ if (r.isNull()) { // X intersection with NULL = NULL
+ setNull();
+ return;
+ }
+
+ if (r.isWorld()) return; // X intersection with WORLD = X
+
+
+ // TODO: use a vector (remember to walk in reverse dir.)
+ for (int rno=_ranges.size()-1; rno>=0; rno--) {
+
+ RangeType newrange = Intersection(_ranges[rno], r);
+
+ if (newrange.isNull())
+ _ranges.erase(_ranges.begin() + rno);
+ else
+ _ranges[rno] = newrange;
+ }
+ }
+
+
/// Visit the current Ranges set
//
/// Visitor functor will be invoked
- [Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h,
Udo Giacomozzi <=