head     1.24;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @// @;


1.24
date     92.07.01.18.10.49;  author fischer;  state Exp;
branches ;
next     1.23;

1.23
date     92.07.01.13.45.57;  author thoth;  state Exp;
branches ;
next     1.22;

1.22
date     92.07.01.13.18.11;  author thoth;  state Exp;
branches ;
next     1.21;

1.21
date     92.06.30.07.55.38;  author fischer;  state Exp;
branches ;
next     1.20;

1.20
date     92.06.29.07.34.58;  author fischer;  state Exp;
branches ;
next     1.19;

1.19
date     92.06.28.05.24.53;  author fischer;  state Exp;
branches ;
next     1.18;

1.18
date     92.06.27.04.55.45;  author fischer;  state Exp;
branches ;
next     1.17;

1.17
date     92.06.26.20.25.52;  author fischer;  state Exp;
branches ;
next     1.16;

1.16
date     92.06.24.12.19.55;  author fischer;  state Exp;
branches ;
next     1.15;

1.15
date     92.06.24.09.57.44;  author fischer;  state Exp;
branches ;
next     1.14;

1.14
date     92.06.22.13.59.45;  author thoth;  state Exp;
branches ;
next     1.13;

1.13
date     92.06.22.07.44.03;  author fischer;  state Exp;
branches ;
next     1.12;

1.12
date     92.06.21.17.02.34;  author thoth;  state Exp;
branches ;
next     1.11;

1.11
date     92.06.21.05.59.10;  author fischer;  state Exp;
branches ;
next     1.10;

1.10
date     92.06.15.14.10.44;  author fischer;  state Exp;
branches ;
next     1.9;

1.9
date     92.06.12.06.13.21;  author fischer;  state Exp;
branches ;
next     1.8;

1.8
date     92.06.10.18.06.09;  author fischer;  state Exp;
branches ;
next     1.7;

1.7
date     92.06.10.05.16.52;  author fischer;  state Exp;
branches ;
next     1.6;

1.6
date     92.06.08.02.58.01;  author fischer;  state Exp;
branches ;
next     1.5;

1.5
date     92.06.05.03.19.03;  author fischer;  state Exp;
branches ;
next     1.4;

1.4
date     92.06.03.10.49.42;  author fischer;  state Exp;
branches ;
next     1.3;

1.3
date     92.06.02.01.53.29;  author fischer;  state Exp;
branches ;
next     1.2;

1.2
date     92.05.27.16.53.01;  author fischer;  state Exp;
branches ;
next     1.1;

1.1
date     92.05.26.07.49.20;  author fischer;  state Exp;
branches ;
next     ;


desc
@Fairly complete version of Point, based on simple vector
model,  where the vector components are always Coord.
@


1.24
log
@Fixed irint problem, moved code for ``,'' operator to concat friend.
@
text
@// Emacs: -*- C++ -*-

// 
// $Log:	Point.h,v $
// Revision 1.23  92/07/01  13:45:57  thoth
// added op= to the SubPoint
// 
// Revision 1.22  92/07/01  13:18:11  thoth
// made friend versions of ceil family of functions work.
// 
// Revision 1.21  92/06/30  07:55:38  fischer
// Frobnicating rounding functions as friends and user functions,
// nothing really changed.
// 
// Revision 1.20  92/06/29  07:34:58  fischer
// Formatting changes and added the rint (3m) functions as methods.
// Adding as user functions caused hostility from SubPoints.
// 
// Revision 1.19  92/06/28  05:24:53  fischer
// Added const static unsigned int Point::max_coordinates = 5;
// Sprinkled in const declarations. Added Point concatenation
// operator ``,'', gave it fairly thorough testing.
// 
// Revision 1.18  92/06/27  04:55:45  fischer
// added methods for Point(int) and Point(float) to work around gcc bug,
// but they appeared to add problems of their own.  Needs more checking.
// Removed include <assert.h> since I don't use it any more.
// 
// Revision 1.17  92/06/26  20:25:52  fischer
// Added bitwise operators using the corresponding bitwise compound
// assignment operators.
// 
// Revision 1.16  92/06/24  12:19:55  fischer
// Modified output friend << to use pass by reference.
// 
// Revision 1.15  92/06/24  09:57:44  fischer
// Reorded file to reflect Point.cc.
// 
// Revision 1.14  92/06/22  13:59:45  thoth
// commented out type conversions for SubPoint.  This could get hairy.
// 
// Revision 1.13  92/06/22  07:44:03  fischer
// Added logical compound assignments.
// 
// Revision 1.12  92/06/21  17:02:34  thoth
// added proper subscripting for point using the SubPoint private class
// 
// Revision 1.11  92/06/21  05:59:10  fischer
// Changed enum literals for throw function and NumberTypes
// to uppercase.
// 
// Revision 1.10  92/06/15  14:10:44  fischer
// Renamed NumericType enum to capitilized literals.
// 
// Revision 1.9  92/06/12  06:13:21  fischer
// Check for Coord[0] special cases in binary operators.
// Nested promote() calls.
// 
// Revision 1.8  92/06/10  18:06:09  fischer
// Fixed compound assignments so they return Point& instead of
// onst Point&.
// 
// Revision 1.7  92/06/10  05:16:52  fischer
// Made all Point/Point and Point/Coord relational operators
// use lexicographical (partial) ordering.  Added index derangement
// as operator() on points.  
// 
// Revision 1.6  92/06/08  02:58:01  fischer
// euclidean_distance renamed to enorm.  Checked ++, gcc 2.0
// seems to make it preincrement always. tweaked relational
// ops to use enorm in comparison if size of two points differ.
// 
// Revision 1.5  92/06/05  03:19:03  fischer
// Modified relational ops to compare points via lexicographical
// functions.   Point <> Const or vice versa still uses euclidean
// distance (or rather, broken euclidean distance - no sqrt).
// 
// Revision 1.4  92/06/03  10:49:42  fischer
// Renamed to Point,  we'll use this for a while.
// 
// Revision 1.3  92/06/02  01:53:29  fischer
// Removed deprecated Point--Point binary ops such as *, /, %.
// Made assignment operations return const references.
// Got rid of the local emacs variables at EOF in favor of mode line.
// Do checks to get rid of possibly two representations of Points,
// one where coordinates was a NULL pointer, the other where size
// was zero, but zero length array was allocated (I thought this was
// illegal, anyway, and ``couldn't happen'').
// 
// Revision 1.2  92/05/27  16:53:01  fischer
// Built vector-based version on top of Coord.
// 

#ifndef Point_h_
#define Point_h_

#include "Coord.h"

class Point {
private:

    class SubPoint {
    private:
        Coord   *victim;
    public:
        SubPoint(Coord *cp) { victim = cp; }
        SubPoint &operator =(Coord c) {
            *victim = c.promote(victim->type());
            return *this;
        }
        operator Coord () { return *victim; }
// 	operator int () { return *victim; }
// 	operator float () { return *victim; }
#define IA_OPEQ(op)	\
	SubPoint& operator ## op ## =(Coord c) { \
          *victim = (*victim op c).promote(victim->type()); \
	  return *this; \
	  }
	IA_OPEQ(+)
	IA_OPEQ(-)
	IA_OPEQ(*)
	IA_OPEQ(/)
#undef IA_OPEQ
#define IA_OPEQ(op)	\
	SubPoint& operator ## op ## =(Coord c) { \
          *victim = Coord(int(*victim) op int(c)).promote(victim->type()); \
	  return *this; \
	  }
	IA_OPEQ(%)
	IA_OPEQ(|)
	IA_OPEQ(&)
	IA_OPEQ(^)
#undef IA_OPEQ
#define IA_OPEQ(op)	\
	SubPoint& operator ## op ## =(unsigned int i) { \
          *victim = Coord(int(*victim) op i).promote(victim->type()); \
	  return *this; \
	  }
	IA_OPEQ(<<)
	IA_OPEQ(>>)
#undef IA_OPEQ
    };
    
    unsigned int size;
    Coord  *coordinates;
    
public:
    static const unsigned int max_dimensions = 5;

    Point() {coordinates = NULL; size =0;}
    Point(const Point&);
    Point& operator = (const Point&);
    
    ~Point() { if (coordinates != NULL ) delete[] coordinates; }
        
    Point(Coord);
    Point(Coord, Coord);
    Point(Coord, Coord, Coord);
    Point(Coord, Coord, Coord, Coord);
    Point(Coord, Coord, Coord, Coord, Coord);

    SubPoint operator [] (unsigned int index) {
        if (index >= this->size)
            throw(IA::POINT_INDEX_MISMATCH, __FILE__, __LINE__);
        return coordinates+index;
    }
    const Coord operator [] (unsigned int index) const {
        if (index >= this->size)
            throw(IA::POINT_INDEX_MISMATCH, __FILE__, __LINE__);
        return coordinates[index];
    }

//  Old version of Point[]
//
//     Coord& operator [] (unsigned int index) const {
//      if (index >= this->size) {
//          throw(IA::POINT_INDEX_MISMATCH, __FILE__, __LINE__);
//          return Coord();
//      }
//      return coordinates[index];
//     }
    
    NumericType type() const {
        if (this->size == 0)
            return NONE;
        else
            return this->coordinates[0].type();
    }
    
    unsigned int dimensions() const  { return size; }

           Point    operator +   (const Point&) const;
    friend Point    operator +   (const Point&, const Coord&);
    friend Point    operator +   (const Coord&, const Point&);

           Point    operator -   () const;
           Point    operator -   (const Point&) const;
    friend Point    operator -   (const Point&, const Coord&);
    friend Point    operator -   (const Coord&, const Point&);

           Point    operator *   (const Point&) const;
    friend Point    operator *   (const Point&, const Coord&);
    friend Point    operator *   (const Coord&, const Point&);

           Point    operator /   (const Point&) const;
    friend Point    operator /   (const Point&, const Coord&);
    friend Point    operator /   (const Coord&, const Point&);

           Point    operator %   (const Point&) const;
    friend Point    operator %   (const Point&, const Coord&);
    friend Point    operator %   (const Coord&, const Point&);

    const  Point&   operator +=  (const Point&);
    const  Point&   operator +=  (const Coord&);
    const  Point&   operator -=  (const Point&);
    const  Point&   operator -=  (const Coord&);
    const  Point&   operator *=  (const Point&);
    const  Point&   operator *=  (const Coord&);
    const  Point&   operator /=  (const Coord&);
    const  Point&   operator /=  (const Point&);
    const  Point&   operator %=  (const Coord&);
    const  Point&   operator %=  (const Point&);

    const  Point&   operator ++  ();
    const  Point&   operator --  ();

    const  Point&   operator <<= (unsigned int);
    const  Point&   operator <<= (const Point&);
    const  Point&   operator >>= (unsigned int);
    const  Point&   operator >>= (const Point&);
    const  Point&   operator &=  (unsigned int);
    const  Point&   operator &=  (const Point&);
    const  Point&   operator ^=  (unsigned int);
    const  Point&   operator ^=  (const Point&);
    const  Point&   operator |=  (unsigned int);
    const  Point&   operator |=  (const Point&);

    friend Point    operator <<  (const Point&, unsigned int);
    friend Point    operator >>  (const Point&, unsigned int);

           Point    operator &   (const Point&) const;
    friend Point    operator &   (const Point&, const Coord&);
    friend Point    operator &   (const Coord&, const Point&);

           Point    operator ^   (const Point&) const;
    friend Point    operator ^   (const Point&, const Coord&);
    friend Point    operator ^   (const Coord&, const Point&);

           Point    operator |   (const Point&) const;
    friend Point    operator |   (const Point&, const Coord&);
    friend Point    operator |   (const Coord&, const Point&);

           Point    operator ~   () const;

           char     operator <   (const Point&) const;
    friend char     operator <   (const Coord&, const Point&);
    friend char     operator <   (const Point&, const Coord&);

           char     operator <=  (const Point&) const;
    friend char     operator <=  (const Coord&, const Point&);
    friend char     operator <=  (const Point&, const Coord&);

           char     operator >   (const Point&) const;
    friend char     operator >   (const Coord&, const Point&);
    friend char     operator >   (const Point&, const Coord&);

           char     operator >=  (const Point&) const;
    friend char     operator >=  (const Coord&, const Point&);
    friend char     operator >=  (const Point&, const Coord&);

           char     operator ==  (const Point&) const;
    friend char     operator ==  (const Coord&, const Point&);
    friend char     operator ==  (const Point&, const Coord&);

           char     operator !=  (const Point&) const;
    friend char     operator !=  (const Coord&, const Point&);
    friend char     operator !=  (const Point&, const Coord&);

    // Distance measures

    double enorm() const;
    
    // Index-derangement functions.
    
    Point           operator ()  (unsigned) const;
    Point           operator ()  (unsigned, unsigned) const;
    Point           operator ()  (unsigned, unsigned, unsigned) const;
    Point           operator ()  (unsigned, unsigned, unsigned, unsigned) const;
    Point           operator ()  (unsigned, unsigned, unsigned, unsigned, unsigned) const;

    friend Point    concat(const Point&, const Point&);
    friend Point    concat(const Point&, const Coord&);
    friend Point    concat(const Coord&, const Point&);

    friend ostream& operator << (ostream&, Point&);

           Point toREAL    () const;
           Point toINTEGER () const;

    friend Point aint (Point);
    friend Point anint (Point);
    friend Point ceil (Point);
    friend Point floor (Point);
    friend Point rint (Point);
    friend Point irint (Point);
    friend Point nint (Point);
    friend Point trunc (Point);


};

char Pointcmp (const Point&, const Point&);

#endif
@


1.23
log
@added op= to the SubPoint
@
text
@d5 3
d112 2
a141 2
//	operator int () { return *victim; }
//	operator float () { return *victim; }
a282 1
    //
a283 1
    //
d291 3
a293 4
           Point    operator ,   (const Point&) const;
    friend Point    operator ,   (const Point&, const Coord&);
    friend Point    operator ,   (const Coord&, const Point&);
    friend Point    operator ,   (const Coord&, const Coord&);
a294 7
//  gcc 2.2.2  won't let us do Point p = (2, 1): "bad argument 0 for function `Point::operator
//  = (const class Point&)' (type was int )": it effectively ignores it, using the default
//  rules (i.e., 2 evaluted as 2, then 1 evaluated as 1 and returned for the assignment)
//  giving us the same (incorrect) error as Point p = 1;
//
//  friend Point    operator ,   (const int, const int);

a298 1
#if 1
a308 12
#else
// This stuff works OK: 
//
           Point aint () const;
           Point anint () const;
           Point ceil () const;
           Point floor () const;
           Point rint () const;
           Point irint () const;
           Point nint () const;
           Point trunc () const;
#endif
a312 9

//     Point aint (Point);
//     Point anint (Point);
//     Point ceil (Point);
//     Point floor (Point);
//     Point rint (Point);
//     Point irint (Point);
//     Point nint (Point);
//     Point trunc (Point);
@


1.22
log
@made friend versions of ceil family of functions work.
@
text
@d5 3
d109 30
a138 2
	operator int () { return *victim; }
	operator float () { return *victim; }
@


1.21
log
@Frobnicating rounding functions as friends and user functions,
nothing really changed.
@
text
@d5 4
d275 1
a275 9
// 
//     friend Point aint (Point);
//     friend Point anint (Point);
//     friend Point ceil (Point);
//     friend Point floor (Point);
//     friend Point rint (Point);
//     friend Point irint (Point);
//     friend Point nint (Point);
//     friend Point trunc (Point);
d277 10
d297 1
a297 1

@


1.20
log
@Formatting changes and added the rint (3m) functions as methods.
Adding as user functions caused hostility from SubPoints.
@
text
@d5 4
d260 7
d271 9
d281 2
d291 2
d297 9
a305 9
// Point aint (Point);
// Point anint (Point);
// Point ceil (Point);
// Point floor (Point);
// Point rint (Point);
// Point irint (Point);
// Point nint (Point);
// Point trunc (Point);
	   
@


1.19
log
@Added const static unsigned int Point::max_coordinates = 5;
Sprinkled in const declarations. Added Point concatenation
operator ``,'', gave it fairly thorough testing.
@
text
@d4 6
a9 1
// $Log:        Point.h,v $
d98 2
a99 2
//      operator int () { return *victim; }
//      operator float () { return *victim; }
d106 1
a106 1
    static const unsigned int max_coordinates = 5;
d111 1
a119 8
    // These shouldn't be necessary, but gcc 2.2.2 is busted about promoting from
    // int->Coord in the Point(Coord) case above.
    // Unfortunately, these seem to introduce runtime errors of their own
    // in the Coord::Coord(const Coord&) constructor.
    
    //     Point(int   foo) { Point(Coord(foo)); }
    //     Point(float bar) { Point(Coord(bar)); }

d136 1
a136 1
//          return NULL;
d255 1
a255 1
    
d258 11
d273 9
@


1.18
log
@added methods for Point(int) and Point(float) to work around gcc bug,
but they appeared to add problems of their own.  Needs more checking.
Removed include <assert.h> since I don't use it any more.
@
text
@d4 6
a9 1
// $Log:	Point.h,v $
d49 2
a50 2
// Revision 1.6	 92/06/08  02:58:01  fischer
// euclidean_distance renamed to enorm.	 Checked ++, gcc 2.0
d54 1
a54 1
// Revision 1.5	 92/06/05  03:19:03  fischer
d56 1
a56 1
// functions.	Point <> Const or vice versa still uses euclidean
d59 1
a59 1
// Revision 1.4	 92/06/03  10:49:42  fischer
d62 1
a62 1
// Revision 1.3	 92/06/02  01:53:29  fischer
d71 1
a71 1
// Revision 1.2	 92/05/27  16:53:01  fischer
d85 1
a85 1
	Coord	*victim;
d87 8
a94 8
	SubPoint(Coord *cp) { victim = cp; }
	SubPoint &operator=(Coord c) {
	    *victim = c.promote(victim->type());
	    return *this;
	}
	operator Coord() { return *victim; }
//  	operator int() { return *victim; }
//  	operator float() { return *victim; }
d96 1
a96 1

d99 3
a102 1
public:
d105 1
a105 1
    Point& operator =(const Point&);
d107 1
a107 1
	
d116 2
a117 1
    // These seem to introduce errors of their own...
d119 2
a120 2
//     Point(int   foo) { Point(Coord(foo)); }
//     Point(float bar) { Point(Coord(bar)); }
d122 4
a125 4
    SubPoint operator [](unsigned int index) {
	if (index >= this->size)
	    throw(IA::POINT_INDEX_MISMATCH, __FILE__, __LINE__);
	return coordinates+index;
d127 4
a130 4
    const Coord operator [](unsigned int index) const {
	if (index >= this->size)
	    throw(IA::POINT_INDEX_MISMATCH, __FILE__, __LINE__);
	return coordinates[index];
d133 8
a140 8
// Old version of Point[]

//     Coord& operator [](unsigned int index) const {
// 	if (index >= this->size) {
// 	    throw(IA::POINT_INDEX_MISMATCH, __FILE__, __LINE__);
// //	    return NULL;
// 	}
// 	return coordinates[index];
a142 1

d144 4
a147 4
	if (this->size == 0)
	    return NONE;
	else
	    return this->coordinates[0].type();
d152 3
a154 3
           Point	operator +	(const Point&) const;
    friend Point	operator +	(const Point&, const Coord&);
    friend Point	operator +	(const Coord&, const Point&);
d156 4
a159 4
           Point	operator -	() const;
	   Point      	operator -	(const Point&) const;
    friend Point	operator -	(const Point&, const Coord&);
    friend Point	operator -	(const Coord&, const Point&);
d161 3
a163 3
           Point	operator *	(const Point&) const;
    friend Point	operator *	(const Point&, const Coord&);
    friend Point	operator *	(const Coord&, const Point&);
d165 3
a167 3
           Point	operator /	(const Point&) const;
    friend Point	operator /	(const Point&, const Coord&);
    friend Point	operator /	(const Coord&, const Point&);
d169 3
a171 3
           Point	operator %	(const Point&) const;
    friend Point	operator %	(const Point&, const Coord&);
    friend Point	operator %	(const Coord&, const Point&);
d173 10
a182 10
           Point&	operator +=	(const Point&);
           Point&	operator +=	(const Coord&);
           Point&	operator -=	(const Point&);
           Point&	operator -=	(const Coord&);
           Point&	operator *=	(const Point&);
           Point&	operator *=	(const Coord&);
           Point&	operator /=	(const Coord&);
           Point&	operator /=	(const Point&);
           Point&	operator %=	(const Coord&);
           Point&	operator %= 	(const Point&);
d184 2
a185 10
           Point&	operator <<=	(unsigned int);
           Point&	operator <<= 	(const Point&);
           Point&	operator >>=	(unsigned int);
           Point&	operator >>= 	(const Point&);
           Point&	operator &=	(unsigned int);
           Point&	operator &= 	(const Point&);
           Point&	operator ^=	(unsigned int);
           Point&	operator ^= 	(const Point&);
           Point&	operator |=	(unsigned int);
           Point&	operator |= 	(const Point&);
d187 10
a196 2
    friend Point operator<< (const Point&, unsigned int);
    friend Point operator>> (const Point&, unsigned int);
d198 2
a199 3
           Point operator&  (const Point&);
    friend Point operator&  (const Point&, const Coord&);
    friend Point operator&  (const Coord&, const Point&);
d201 3
a203 3
           Point operator^  (const Point&);
    friend Point operator^  (const Point&, const Coord&);
    friend Point operator^  (const Coord&, const Point&);
d205 3
a207 3
           Point operator|  (const Point&);
    friend Point operator|  (const Point&, const Coord&);
    friend Point operator|  (const Coord&, const Point&);
d209 3
a211 1
           Point operator~  ();
d213 1
a213 3
    	   char	operator  <	(const Point&);
    friend char	operator  <	(const Coord&, const Point&);
    friend char	operator  <	(const Point&, const Coord&);
d215 3
a217 3
           char	operator  <=	(const Point&);
    friend char	operator  <=	(const Coord&, const Point&);
    friend char	operator  <=	(const Point&, const Coord&);
d219 3
a221 3
           char	operator  >	(const Point&);
    friend char	operator  >	(const Coord&, const Point&);
    friend char	operator  >	(const Point&, const Coord&);
d223 3
a225 3
           char	operator  >=	(const Point&);
    friend char	operator  >=	(const Coord&, const Point&);
    friend char	operator  >=	(const Point&, const Coord&);
d227 3
a229 3
           char	operator  ==	(const Point&);
    friend char	operator  ==	(const Coord&, const Point&);
    friend char	operator  ==	(const Point&, const Coord&);
d231 3
a233 3
           char	operator  !=	(const Point&);
    friend char	operator  !=	(const Coord&, const Point&);
    friend char	operator  !=	(const Point&, const Coord&);
d235 3
a237 2
    const  Point&	operator ++	();
    const  Point&	operator --	();
d247 5
a251 5
    Point	operator ()	(unsigned);
    Point	operator ()	(unsigned, unsigned);
    Point	operator ()	(unsigned, unsigned, unsigned);
    Point	operator ()	(unsigned, unsigned, unsigned, unsigned);
    Point	operator ()	(unsigned, unsigned, unsigned, unsigned, unsigned);
d253 6
a258 1
    friend ostream&	operator <<(ostream&, Point&);
d262 1
a262 1
char Pointcmp(const Point&,const Point&);
@


1.17
log
@Added bitwise operators using the corresponding bitwise compound
assignment operators.
@
text
@d5 4
a72 1
#include <assert.h>
d106 7
@


1.16
log
@Modified output friend << to use pass by reference.
@
text
@d5 3
d178 2
a179 16
//     friend Point operator<< (const Point&, unsigned int);
//     friend Point operator>> (const Point&, unsigned int);
// 
//            Point operator&  (const Point&);
//     friend Point operator&  (const Point&, const Coord&);
//     friend Point operator&  (const Coord&, const Point&);
// 
//            Point operator^  (const Point&);
//     friend Point operator^  (const Point&, const Coord&);
//     friend Point operator^  (const Coord&, const Point&);
// 
//            Point operator|  (const Point&, const Point&);
//     friend Point operator|  (const Point&, const Coord&);
//     friend Point operator|  (const Coord&, const Point&);
//
//            Point operator~  (const Point&, const Point&);
d181 14
d230 1
@


1.15
log
@Reorded file to reflect Point.cc.
@
text
@d5 3
d232 1
a232 1
    friend ostream&	operator <<(ostream&, Point);
@


1.14
log
@commented out type conversions for SubPoint.  This could get hairy.
@
text
@d5 3
d79 2
a80 2
//	operator int() { return *victim; }
//	operator float() { return *victim; }
d109 11
d149 1
a149 1
    
d160 2
a161 1
           Point&	operator <<=	(const Coord&);
d163 1
a163 1
           Point&	operator >>=	(const Coord&);
d165 1
a165 1
           Point&	operator &=	(const Coord&);
d167 1
a167 1
           Point&	operator ^=	(const Coord&);
d169 1
a169 1
           Point&	operator |=	(const Coord&);
d171 18
a188 3
    const  Point&	operator ++	();
    const  Point&	operator --	();
   
d213 7
a223 1
    Point	operator ()	(unsigned);
a230 1
    double enorm() const;
@


1.13
log
@Added logical compound assignments.
@
text
@d5 3
d61 1
a61 1
#include <Coord.h>
d76 2
a77 2
	operator int() { return *victim; }
	operator float() { return *victim; }
@


1.12
log
@added proper subscripting for point using the SubPoint private class
@
text
@d5 3
a91 3
    // This has a problem:  user can assign the wrong type Coord into
    // a point slot -- this is a tough problem.
    
a111 4
    const  Point&	operator ++	();
    const  Point&	operator ++	(int);
    const  Point&	operator --	();

d143 12
@


1.11
log
@Changed enum literals for throw function and NumberTypes
to uppercase.
@
text
@d5 4
d59 15
d92 1
a92 1
    Coord& operator [](unsigned int index) const {
d95 5
d186 2
@


1.10
log
@Renamed NumericType enum to capitilized literals.
@
text
@d5 3
d75 1
a75 1
	    throw(IA::PointIndexMismatch, __FILE__, __LINE__);
@


1.9
log
@Check for Coord[0] special cases in binary operators.
Nested promote() calls.
@
text
@d5 4
d78 1
a78 1
	    return None;
@


1.8
log
@Fixed compound assignments so they return Point& instead of
onst Point&.
@
text
@d5 4
d72 5
a76 8
    // This takes care of the above problem, but is ungainly to use.

    void set(unsigned int index, Coord value) { 
	
	if (index >= this->size)
	    throw(IA::PointIndexMismatch, __FILE__, __LINE__);	

	coordinates[index] = value.promote(coordinates[index].type()); 
d78 1
a78 1

a80 2
    double enorm() const;

a150 7
    NumericType type() const {
	if (this->size == 0)
	    return None;
	else
	    return this->coordinates[0].type();
    }
    
d152 2
@


1.7
log
@Made all Point/Point and Point/Coord relational operators
use lexicographical (partial) ordering.  Added index derangement
as operator() on points.  
@
text
@d5 5
d82 3
a84 6
    const Point&	operator ++	();
    const Point&	operator ++	(int);
    const Point&	operator --	();
    const Point&	operator *=	(const Point&);
    const Point&	operator /=	(const Point&);
    const Point&	operator %= 	(const Point&);
d106 11
a116 8

    const Point&	operator +=	(const Point&);
    const Point&	operator -=	(const Point&);
    const Point&	operator +=	(const Coord&);
    const Point&	operator *=	(const Coord&);
    const Point&	operator -=	(const Coord&);
    const Point&	operator /=	(const Coord&);
    const Point&	operator %=	(const Coord&);
@


1.6
log
@euclidean_distance renamed to enorm.  Checked ++, gcc 2.0
seems to make it preincrement always. tweaked relational
ops to use enorm in comparison if size of two points differ.
@
text
@d5 6
a10 1
// Revision 1.5  92/06/05  03:19:03  fischer
d12 1
a12 1
// functions.   Point <> Const or vice versa still uses euclidean
d15 1
a15 1
// Revision 1.4  92/06/03  10:49:42  fischer
d18 1
a18 1
// Revision 1.3  92/06/02  01:53:29  fischer
d27 1
a27 1
// Revision 1.2  92/05/27  16:53:01  fischer
d45 1
a45 1
    Point& operator=(const Point&);
d55 1
a55 2
    // a point slot -- is there no way to get at the Coord.type()
    // to compare against this->type()?
d57 1
a57 1
    Coord& operator[](unsigned int index) const {
d77 6
a82 3
    Point operator+ (const Point&) const;
    friend Point operator+ (const Point&, const Coord&);
    friend Point operator+ (const Coord&, const Point&);
d84 3
a86 4
    Point operator- () const;
    Point operator- (const Point&) const;
    friend Point operator- (const Point&, const Coord&);
    friend Point operator- (const Coord&, const Point&);
d88 4
a91 2
    // Deprecated operations.
    //
d93 3
a95 3
    Point operator* (const Point&) const;
    Point operator/ (const Point&) const;
    Point operator% (const Point&) const;
d97 3
a99 6
    const Point& operator++ ();
    const Point& operator++ (int);
    const Point& operator-- ();
    const Point& operator*= (const Point&);
    const Point& operator/= (const Point&);
    const Point& operator%= (const Point&);
d101 3
a103 2
    friend Point operator* (const Point&, const Coord&);
    friend Point operator* (const Coord&, const Point&);
d105 11
a115 2
    friend Point operator/ (const Point&, const Coord&);
    friend Point operator/ (const Coord&, const Point&);
d117 3
a119 2
    friend Point operator% (const Point&, const Coord&);
    friend Point operator% (const Coord&, const Point&);
d121 3
a123 2
    const Point& operator+= (const Point&);
    const Point& operator-= (const Point&);
d125 3
a127 5
    const Point& operator+= (const Coord&);
    const Point& operator*= (const Coord&);
    const Point& operator-= (const Coord&);
    const Point& operator/= (const Coord&);
    const Point& operator%= (const Coord&);
d129 3
a131 4
    //
    // These use euclidean_distance() to compare, and do not complain 
    // for different sizes.  Perhaps we should thus add all possible 
    // combinations of Coord valued stuff?
d133 3
a135 4
    friend char operator <  (const Point&, const Point&);
    friend char operator <= (const Point&, const Point&);
    friend char operator >= (const Point&, const Point&);
    friend char operator >  (const Point&, const Point&);
d137 9
a145 4
    friend char operator <  (const Coord&, const Point&);
    friend char operator <= (const Coord&, const Point&);
    friend char operator >= (const Coord&, const Point&);
    friend char operator >  (const Coord&, const Point&);
a146 10
    friend char operator <  (const Point&, const Coord&);
    friend char operator <= (const Point&, const Coord&);
    friend char operator >= (const Point&, const Coord&);
    friend char operator >  (const Point&, const Coord&);

    // These do an element by element comparision.

    friend char operator == (const Point&, const Point&);
    friend char operator != (const Point&, const Point&);

d154 1
a154 1
    friend ostream& operator<<(ostream&, Point);
a156 1

a157 1

@


1.5
log
@Modified relational ops to compare points via lexicographical
functions.   Point <> Const or vice versa still uses euclidean
distance (or rather, broken euclidean distance - no sqrt).
@
text
@d1 2
d5 5
d40 1
a40 1
   Point& operator=(const Point&);
d71 1
a71 1
    double euclidean_distance() const;
d90 1
@


1.4
log
@Renamed to Point,  we'll use this for a while.
@
text
@a0 2
// This may look like C code, emacs, but it is really -*- C++ -*-

d3 3
d33 1
a33 1
    Point& operator=(const Point&);
d62 1
a62 1
    unsigned int dimensions ()  { return size; }
d77 10
a86 9
    // Point operator* (const Point&) const;
    // Point operator/ (const Point&) const;
    // Point operator% (const Point&) const;
    // Point& operator++ ();
    // Point& operator-- ();
    // const Point& operator*= (const Point&);
    // const Point& operator/= (const Point&);
    // const Point& operator%= (const Point&);
    // friend char operator ! (const Point&);
@


1.3
log
@Removed deprecated Point--Point binary ops such as *, /, %.
Made assignment operations return const references.
Got rid of the local emacs variables at EOF in favor of mode line.
Do checks to get rid of possibly two representations of Points,
one where coordinates was a NULL pointer, the other where size
was zero, but zero length array was allocated (I thought this was
illegal, anyway, and ``couldn't happen'').
@
text
@d4 10
a13 1
// $Log:	Poynt.h,v $
d18 2
a19 2
#ifndef Poynt_h_
#define Poynt_h_
d24 1
a24 1
class Poynt {
d30 4
a33 4
    Poynt() {coordinates = NULL; size =0;}
    Poynt(const Poynt&);
    Poynt& operator=(const Poynt&);
    ~Poynt() { if (coordinates != NULL ) delete[] coordinates; }
d35 5
a39 5
    Poynt(Coord);
    Poynt(Coord, Coord);
    Poynt(Coord, Coord, Coord);
    Poynt(Coord, Coord, Coord, Coord);
    Poynt(Coord, Coord, Coord, Coord, Coord);
d65 3
a67 3
    Poynt operator+ (const Poynt&) const;
    friend Poynt operator+ (const Poynt&, const Coord&);
    friend Poynt operator+ (const Coord&, const Poynt&);
d69 4
a72 4
    Poynt operator- () const;
    Poynt operator- (const Poynt&) const;
    friend Poynt operator- (const Poynt&, const Coord&);
    friend Poynt operator- (const Coord&, const Poynt&);
d76 9
a84 9
    // Poynt operator* (const Poynt&) const;
    // Poynt operator/ (const Poynt&) const;
    // Poynt operator% (const Poynt&) const;
    // Poynt& operator++ ();
    // Poynt& operator-- ();
    // const Poynt& operator*= (const Poynt&);
    // const Poynt& operator/= (const Poynt&);
    // const Poynt& operator%= (const Poynt&);
    // friend char operator ! (const Poynt&);
d86 2
a87 2
    friend Poynt operator* (const Poynt&, const Coord&);
    friend Poynt operator* (const Coord&, const Poynt&);
d89 2
a90 2
    friend Poynt operator/ (const Poynt&, const Coord&);
    friend Poynt operator/ (const Coord&, const Poynt&);
d92 2
a93 2
    friend Poynt operator% (const Poynt&, const Coord&);
    friend Poynt operator% (const Coord&, const Poynt&);
d95 2
a96 2
    const Poynt& operator+= (const Poynt&);
    const Poynt& operator-= (const Poynt&);
d98 5
a102 5
    const Poynt& operator+= (const Coord&);
    const Poynt& operator*= (const Coord&);
    const Poynt& operator-= (const Coord&);
    const Poynt& operator/= (const Coord&);
    const Poynt& operator%= (const Coord&);
d109 4
a112 4
    friend char operator <  (const Poynt&, const Poynt&);
    friend char operator <= (const Poynt&, const Poynt&);
    friend char operator >= (const Poynt&, const Poynt&);
    friend char operator >  (const Poynt&, const Poynt&);
d114 4
a117 4
    friend char operator <  (const Coord&, const Poynt&);
    friend char operator <= (const Coord&, const Poynt&);
    friend char operator >= (const Coord&, const Poynt&);
    friend char operator >  (const Coord&, const Poynt&);
d119 4
a122 4
    friend char operator <  (const Poynt&, const Coord&);
    friend char operator <= (const Poynt&, const Coord&);
    friend char operator >= (const Poynt&, const Coord&);
    friend char operator >  (const Poynt&, const Coord&);
d126 2
a127 2
    friend char operator == (const Poynt&, const Poynt&);
    friend char operator != (const Poynt&, const Poynt&);
d136 1
a136 1
    friend ostream& operator<<(ostream&, Poynt);
@


1.2
log
@Built vector-based version on top of Coord.
@
text
@d1 2
d4 5
a8 2
// $Log$
//
a18 1
    void set(unsigned int index, Coord value) { 
a19 5
	if (index >= this->size)
	    throw(IA::PointIndexMismatch, __FILE__, __LINE__);	
	coordinates[index] = value; 
    }

d24 1
a24 1
    ~Poynt() { delete[] coordinates; }
d42 10
d65 12
a76 1
    Poynt operator* (const Poynt&) const;
a79 1
    Poynt operator/ (const Poynt&) const;
a82 1
    Poynt operator% (const Poynt&) const;
d86 2
a87 10
    Poynt& operator+= (const Poynt&);
    Poynt& operator*= (const Poynt&);
    Poynt& operator-= (const Poynt&);
    Poynt& operator/= (const Poynt&);
    Poynt& operator%= (const Poynt&);
    Poynt& operator+= (const Coord&);
    Poynt& operator*= (const Coord&);
    Poynt& operator-= (const Coord&);
    Poynt& operator/= (const Coord&);
    Poynt& operator%= (const Coord&);
d89 5
a93 2
    Poynt& operator++ ();
    Poynt& operator-- ();
d95 1
a119 4
    // Still cannot get ``if(Poynt) ..'' to work!

    friend char operator ! (const Poynt&);

a132 3
// Local variables:
// eval: (c++-mode)
// End:
@


1.1
log
@Initial revision
@
text
@d1 3
@
