ConeSimplex and ARConeSimplex3D adjusted to work correctly with operator<(), operator==(), and boundary() ar
authorDmitriy Morozov <morozov@cs.duke.edu>
Fri, 29 Feb 2008 14:39:48 -0500
branchar
changeset 79 e48a7036cd88
parent 78 20e1dff50d03
child 80 f236c7d659d0
ConeSimplex and ARConeSimplex3D adjusted to work correctly with operator<(), operator==(), and boundary()
examples/ar-vineyard/ar-vineyard.h
include/topology/conesimplex.h
--- a/examples/ar-vineyard/ar-vineyard.h	Wed Feb 27 17:44:46 2008 -0500
+++ b/examples/ar-vineyard/ar-vineyard.h	Fri Feb 29 14:39:48 2008 -0500
@@ -50,6 +50,7 @@
     
     public:
 									ARConeSimplex3D(const ARSimplex3D& s, bool coned = false);
+									ARConeSimplex3D(const Parent& p): Parent(p)                 {}      // crucial for boundary() to work correctly
 									ARConeSimplex3D(const ARConeSimplex3D& other):              // need explicit copy-constructor because of the signal
                                         Parent(other, other.coned()), 
                                         thresholds_(other.thresholds_)                          {}
@@ -62,7 +63,6 @@
 
         // need explicit operator= because of the signal
         ARConeSimplex3D&            operator=(const ARConeSimplex3D& other)                     { Parent::operator=(other); thresholds_ = other.thresholds_; return *this; }
-        bool                        operator<(const ARConeSimplex3D& other) const               { if (coned() ^ other.coned()) return !coned(); else return Parent::operator<(other); }
 
 								
 	private:
--- a/include/topology/conesimplex.h	Wed Feb 27 17:44:46 2008 -0500
+++ b/include/topology/conesimplex.h	Fri Feb 29 14:39:48 2008 -0500
@@ -21,6 +21,8 @@
 		typedef		std::list<Self>										Cycle;
 
     public:
+								ConeSimplex(const Self& s): 
+                                    Parent(s), coned_(s.coned_)         {}
 								ConeSimplex(const Parent& parent, 
 											bool coned = false):
 									Parent(parent), coned_(coned)		{}
@@ -28,6 +30,9 @@
 		Cycle					boundary() const;
 		bool					coned() const							{ return coned_; }
         Dimension               dimension() const                       { return coned_ ? (Parent::dimension() + 1) : Parent::dimension(); }
+        
+        bool                    operator<(const Self& other) const      { if (coned_ ^ other.coned_) return !coned_; else return Parent::operator<(other); }
+        bool                    operator==(const Self& other) const     { return !(coned_ ^ other.coned_) && Parent::operator==(other); }
 
 		std::ostream& 			operator<<(std::ostream& out) const;