head	1.14;
access;
symbols
	r2_1:1.14
	r2_0:1.14
	r1_1_beta:1.14
	r1_1_alpha:1.13
	r1_0:1.13
	r0_11:1.13
	r0_10:1.13
	r0_9:1.13
	Eglin_alpha_1:1.12;
locks; strict;
comment	@// @;


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

1.13
date	93.11.17.18.06.09;	author thoth;	state Exp;
branches;
next	1.12;

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

1.11
date	93.05.26.16.51.32;	author thoth;	state Exp;
branches;
next	1.10;

1.10
date	93.04.19.23.27.44;	author thoth;	state Exp;
branches;
next	1.9;

1.9
date	93.04.17.15.19.34;	author thoth;	state Exp;
branches;
next	1.8;

1.8
date	93.02.12.16.25.30;	author thoth;	state Exp;
branches;
next	1.7;

1.7
date	93.01.20.11.43.11;	author thoth;	state Exp;
branches;
next	1.6;

1.6
date	92.12.16.14.48.14;	author thoth;	state Exp;
branches;
next	1.5;

1.5
date	92.09.30.10.37.56;	author thoth;	state Exp;
branches;
next	1.4;

1.4
date	92.09.20.17.41.19;	author thoth;	state Exp;
branches;
next	1.3;

1.3
date	92.09.20.14.07.07;	author thoth;	state Exp;
branches;
next	1.2;

1.2
date	92.09.14.21.54.31;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	92.09.03.13.37.11;	author thoth;	state Exp;
branches;
next	;


desc
@interface to Lazy PointSets
@


1.14
log
@\Name sanitization
@
text
@// Emacs: -*- C++ -*-

//
//	Copyright 1993, Center for Computer Vision and Visualization,
//	University of Florida.  All rights reserved.
//


// 
// $Log: LazyPS.h,v $
// Revision 1.13  1993/11/17  18:06:09  thoth
// extensivep() is now extensive()
//
// Revision 1.12  1993/05/28  16:13:39  thoth
// fix strange characters.
//
// Revision 1.11  1993/05/26  16:51:32  thoth
// Copyright Notices
//
// Revision 1.10  93/04/19  23:27:44  thoth
// Convert BaseIPS to IA_BasePS<IA_IntPoint>
// 
// Revision 1.9  93/04/17  15:19:34  thoth
// IA_IntPoint upgrades (dim, inf, sup)
// 
// Revision 1.8  93/02/12  16:25:30  thoth
// more IA_ prefixes.
// more comments.
// 
// Revision 1.7  93/01/20  11:43:11  thoth
// we don't need that header.
// 
// Revision 1.6  92/12/16  14:48:14  thoth
// conversion to IA_ mostly complete
// 
// Revision 1.5  92/09/30  10:37:56  thoth
// Lazies are now templatized.
// contains now accepts const Point<>&.
// type() system now based on address of static data member.
// 
// Revision 1.4  92/09/20  17:41:19  thoth
// many members are now const.
// 
// Revision 1.3  92/09/20  14:07:07  thoth
// LazyIPS::contains now returns 0 or 1 guaranteed
// 
// Revision 1.2  92/09/14  21:54:31  thoth
// fixed dyslexia.
// added commutativity of all binary operations except /
// 
// Revision 1.1  92/09/03  13:37:11  thoth
// Initial revision
// 
//

#ifndef LazyPS_h_
#define LazyPS_h_

// This file contains the implementation of most comprehensive pointsets.
// A comprehensive pointset is a pointset that we can not iterate over
// (because we can not guarantee that the set is finite).  The only simple
// operation you can perform on a comprehensive pointset is to ask whether
// a point is a member or not.

#ifdef IA_PRII
#pragma interface
#endif

#include "BasePS.h"

// This implementation is used by the IntPointSet container when
// the programmer provides us with a predicate function that tells us
// if a point is contained in the pointset or not.
template <class P>
class IA_PredicatePS_V: public IA_BasePS<P> {
private:
    static char type_;
protected:
    int (*pred)(P);
public:
    IA_PredicatePS_V(unsigned dim, int(*f)(P)) :IA_BasePS<P>(dim) {pred=f;}

    int equal(IA_BasePS<P>*other) const {
	return other->type()==this->type() &&
	    pred == ((IA_PredicatePS_V<P>*)other)->pred;
    }
    unsigned hash_self(unsigned mod) const {
	return ((unsigned long)pred)%mod;
    }
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains (const P &ip) const { return 0!=(*pred)(ip); }
    int extensive() const { return 0; }
    void output(ostream&, unsigned=0) const;
};

// Same as above, but the function takes a slightly different argument
// (the calling syntax is identical though).
template <class P>
class IA_PredicatePS_CR: public IA_BasePS<P> {
private:
    static char type_;
protected:
    int (*pred)(const P &);
public:
    IA_PredicatePS_CR(unsigned dim, int(*f)(const P &)) :IA_BasePS<P>(dim) {pred=f;}

    int equal(IA_BasePS<P>*other) const {
	return other->type()==this->type() &&
	    pred == ((IA_PredicatePS_CR<P>*)other)->pred;
    }
    unsigned hash_self(unsigned mod) const {
	return ((unsigned long)pred)%mod;
    }
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains (const P &ip) const { return 0!=(*pred)(ip); }
    int extensive() const { return 0; }
    void output(ostream&, unsigned=0) const;
};

//
//
//

//  The following comprehensive pointsets are formed by non-simple
// operations on comprehensive pointsets.  They are termed Lazy because
// we can not compute an extensive result and we don\'t compute
// containedness unless the user asks us.

template <class PS_t, class P_t>
class IA_LazyBinaryPS: public IA_BasePS<P_t> {
    // this class is still abstract.  It just seemed like a good place to
    // express the commonality of all the binary PSs.
protected:
    const PS_t	lhs,rhs;
public:
    IA_LazyBinaryPS(PS_t lhs_, PS_t rhs_)
	:lhs(lhs_), rhs(rhs_), IA_BasePS<P_t>(rhs_.dim()) {
	    if (rhs.dim() != lhs.dim()) {
		ia_throw(IA::PSET_DIMENSION_MISMATCH, __FILE__, __LINE__);
	    }
	}

    // These are appropriate for most binary LazyPSs.
    // Any PS it isn't appropriate for can override them
    int equal(IA_BasePS<P_t>* other) const {
	IA_LazyBinaryPS *ot = (IA_LazyBinaryPS*)other;
	return this->type() == other->type() &&
	    (rhs==ot->rhs && lhs==ot->lhs || // commutativity
	     rhs==ot->lhs && lhs==ot->rhs);
    }
    unsigned hash_self(unsigned mod) const {
	return (rhs.hash_self(mod) + lhs.hash_self(mod) +
		(int)this->type() ) % mod;
    }

    int extensive() const { return 0; }

    // the following virtual functions are still abstract:
    // type, contains, output
};

// The union of a comprehensive pointset with any sort of pointset
template <class PS_t, class P_t>
class IA_LazyUnionPS: public IA_LazyBinaryPS<PS_t,P_t> {
private:
    static char type_;
public:
    IA_LazyUnionPS(PS_t l, PS_t r) :IA_LazyBinaryPS<PS_t,P_t>(l,r) {}
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains(const P_t& ip) const {
	return rhs.contains(ip) || lhs.contains(ip);
    }
    void output(ostream&, unsigned=0) const;
};

// The intersection of two comprehensive pointsets (if one were extensive
// we could compute an extensive result industriously).
template <class PS_t, class P_t>
class IA_LazyIntersectionPS: public IA_LazyBinaryPS<PS_t,P_t> {
private:
    static char type_;
public:
    IA_LazyIntersectionPS(PS_t l, PS_t r) :IA_LazyBinaryPS<PS_t,P_t>(l,r) {}
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains(const P_t &ip) const {
	return rhs.contains(ip) && lhs.contains(ip);
    }
    void output(ostream&, unsigned=0) const;
};

// The symmetric difference of a comprehensive pointset with any sort
// of pointset
template <class PS_t, class P_t>
class IA_LazyXORPS: public IA_LazyBinaryPS<PS_t,P_t> {
private:
    static char type_;
public:
    IA_LazyXORPS(PS_t l, PS_t r) :IA_LazyBinaryPS<PS_t,P_t>(l,r) {}
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains(const P_t &ip) const {
	return (0==rhs.contains(ip)) == (0!=lhs.contains(ip));
    }
    void output(ostream&, unsigned=0) const;
};

// The asymmetric difference between a comprehensive pointset and any
// sort of pointset (if the first argument were extensive, we could
// compute an extensive result industriously).
template <class PS_t, class P_t>
class IA_LazyMinusPS: public IA_LazyBinaryPS<PS_t,P_t> {
private:
    static char type_;
public:
    IA_LazyMinusPS(PS_t l, PS_t r) :IA_LazyBinaryPS<PS_t,P_t>(l,r) {}
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    // Minus is not commutative, override equal method
    int equal(IA_BasePS<P_t>* other) const {
	IA_LazyMinusPS *ot = (IA_LazyMinusPS*)other;
	return this->type() == other->type() &&
	    (rhs==ot->rhs && lhs==ot->lhs);
    }
    int contains(const P_t &ip) const {
	return lhs.contains(ip) && !rhs.contains(ip);
    }
    void output(ostream&, unsigned=0) const;
};

// The minkowsky addition of an extensive pointset with a comprehensive
// pointset (two extensives can be computed industriously, two
// comprehensives are uncomputable).
template <class PSI_t,class PS_t, class P_t>
class IA_LazyMinkowskiPS: public IA_LazyBinaryPS<PS_t,P_t> {
private:
    static char type_;
    // rhs is the comprehensive and lhs is the extensive
    PS_t comp() const { return rhs; }
    PS_t ext() const { return lhs; }
public:
    IA_LazyMinkowskiPS(PS_t l, PS_t r) :IA_LazyBinaryPS<PS_t,P_t>(l,r) {}
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains(const P_t &ip) const;
    void output(ostream&, unsigned=0) const;
};

//
//

template <class PS_t, class P_t>
class IA_LazyUnaryPS: public IA_BasePS<P_t> {
    // this class is still abstract.  It just seemed like a good place to
    // express the commonality of all the unary PSs.
protected:
    const PS_t	arg;
public:
    IA_LazyUnaryPS(PS_t PS)
	:arg(PS), IA_BasePS<P_t>(PS.dim()) {}

    // these are appropriate for most unary LazyPSs
    // any PS it isn't appropriate for can override them
    int equal(IA_BasePS<P_t>* other) const {
	IA_LazyUnaryPS *ot = (IA_LazyUnaryPS*)other;
	return this->type() == other->type() &&
	    arg==ot->arg;
    }
    unsigned hash_self(unsigned mod) const {
	return (arg.hash_self(mod) + (int)this->type() ) % mod;
    }

    int extensive() const { return 0; }

    // the following virtual functions are still abstract:
    // type, contains, output
};

// The inversion of the set membership predicate.  The argument can be
// any kind of pointset.
template <class PS_t, class P_t>
class IA_LazyNotPS: public IA_LazyUnaryPS<PS_t,P_t> {
private:
    static char type_;
public:
    IA_LazyNotPS(PS_t x) :IA_LazyUnaryPS<PS_t,P_t>(x) {}
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains(const P_t &ip) const { return ! arg.contains(ip); }
    void output(ostream&, unsigned=0) const;
};

// This is really a binary operation, but it only has one pointset operand.
// It is the offsetted version of a comprehensive pointset.
template <class PS_t, class P_t>
class IA_LazyOffsettedPS: public IA_LazyUnaryPS<PS_t,P_t> {
private:
    static char type_;
protected:
    const P_t	offset;
public:
    IA_LazyOffsettedPS(PS_t x, P_t off):IA_LazyUnaryPS<PS_t,P_t>(x),offset(off) {
	if (x.dim() != off.dim()) {
	    ia_throw(IA::PSET_DIMENSION_MISMATCH, __FILE__, __LINE__);
	}
    }
    int equal(IA_BasePS<P_t>*other)const {
	return IA_LazyUnaryPS<PS_t,P_t>::equal(other) &&
	    offset == ((IA_LazyOffsettedPS*)other)->offset;
    }
    static IA::Type s_type() { return &type_; }
    IA::Type type() const { return &type_; }
    int contains(const P_t &ip) const { return arg.contains(ip-offset); }
    void output(ostream&, unsigned=0) const;
};

#endif
@


1.13
log
@extensivep() is now extensive()
@
text
@d11 3
d90 2
a91 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d115 2
a116 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d171 2
a172 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d187 2
a188 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d203 2
a204 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d220 2
a221 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d246 2
a247 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d290 2
a291 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
d314 2
a315 2
    static IA_PointSetType s_type() { return &type_; }
    IA_PointSetType type() const { return &type_; }
@


1.12
log
@fix strange characters.
@
text
@d11 3
d90 1
a90 1
    int extensivep() const { return 0; }
d115 1
a115 1
    int extensivep() const { return 0; }
d155 1
a155 1
    int extensivep() const { return 0; }
d273 1
a273 1
    int extensivep() const { return 0; }
@


1.11
log
@Copyright Notices
@
text
@d10 4
a13 1
// $Log:	LazyPS.h,v $
d75 1
a75 1
    IA_PredicatePS_V(unsigned dim, int(*f)(P)) :IA_BasePS<P>(dim) {pred=f;}\
d100 1
a100 1
    IA_PredicatePS_CR(unsigned dim, int(*f)(const P &)) :IA_BasePS<P>(dim) {pred=f;}\
@


1.10
log
@Convert BaseIPS to IA_BasePS<IA_IntPoint>
@
text
@d3 6
d11 3
@


1.9
log
@IA_IntPoint upgrades (dim, inf, sup)
@
text
@d5 3
d51 1
a51 1
#include "BaseIPS.h"
@


1.8
log
@more IA_ prefixes.
more comments.
@
text
@d5 4
d285 1
a285 1
	if (x.dim() != off.dimensions()) {
@


1.7
log
@we don't need that header.
@
text
@d5 3
d34 6
d46 3
d65 2
a66 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d72 2
d90 2
a91 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d101 5
d139 1
d146 2
a147 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d154 2
d162 2
a163 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d170 2
d178 2
a179 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d186 3
d195 2
a196 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d209 3
d221 2
a222 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d257 2
d265 2
a266 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
d271 2
d289 2
a290 2
    static PointSetType s_type() { return &type_; }
    PointSetType type() const { return &type_; }
@


1.6
log
@conversion to IA_ mostly complete
@
text
@d5 3
a35 1
#include "IntPointSet.h"
@


1.5
log
@Lazies are now templatized.
contains now accepts const Point<>&.
type() system now based on address of static data member.
@
text
@d5 5
d36 1
a36 1
class PredicatePS_V: public BasePS<P> {
d42 1
a42 1
    PredicatePS_V(unsigned dim, int(*f)(P)) :BasePS<P>(dim) {pred=f;}\
d44 1
a44 1
    int equal(BasePS<P>*other) const {
d46 1
a46 1
	    pred == ((PredicatePS_V<P>*)other)->pred;
d59 1
a59 1
class PredicatePS_CR: public BasePS<P> {
d65 1
a65 1
    PredicatePS_CR(unsigned dim, int(*f)(const P &)) :BasePS<P>(dim) {pred=f;}\
d67 1
a67 1
    int equal(BasePS<P>*other) const {
d69 1
a69 1
	    pred == ((PredicatePS_CR<P>*)other)->pred;
d86 1
a86 1
class LazyBinaryPS: public BasePS<P_t> {
d92 2
a93 2
    LazyBinaryPS(PS_t lhs_, PS_t rhs_)
	:lhs(lhs_), rhs(rhs_), BasePS<P_t>(rhs_.dim()) {
d101 2
a102 2
    int equal(BasePS<P_t>* other) const {
	LazyBinaryPS *ot = (LazyBinaryPS*)other;
d119 1
a119 1
class LazyUnionPS: public LazyBinaryPS<PS_t,P_t> {
d123 1
a123 1
    LazyUnionPS(PS_t l, PS_t r) :LazyBinaryPS<PS_t,P_t>(l,r) {}
d133 1
a133 1
class LazyIntersectionPS: public LazyBinaryPS<PS_t,P_t> {
d137 1
a137 1
    LazyIntersectionPS(PS_t l, PS_t r) :LazyBinaryPS<PS_t,P_t>(l,r) {}
d147 1
a147 1
class LazyXORPS: public LazyBinaryPS<PS_t,P_t> {
d151 1
a151 1
    LazyXORPS(PS_t l, PS_t r) :LazyBinaryPS<PS_t,P_t>(l,r) {}
d161 1
a161 1
class LazyMinusPS: public LazyBinaryPS<PS_t,P_t> {
d165 1
a165 1
    LazyMinusPS(PS_t l, PS_t r) :LazyBinaryPS<PS_t,P_t>(l,r) {}
d169 2
a170 2
    int equal(BasePS<P_t>* other) const {
	LazyMinusPS *ot = (LazyMinusPS*)other;
d181 1
a181 1
class LazyMinkowskiPS: public LazyBinaryPS<PS_t,P_t> {
d188 1
a188 1
    LazyMinkowskiPS(PS_t l, PS_t r) :LazyBinaryPS<PS_t,P_t>(l,r) {}
d199 1
a199 1
class LazyUnaryPS: public BasePS<P_t> {
d205 2
a206 2
    LazyUnaryPS(PS_t PS)
	:arg(PS), BasePS<P_t>(PS.dim()) {}
d210 2
a211 2
    int equal(BasePS<P_t>* other) const {
	LazyUnaryPS *ot = (LazyUnaryPS*)other;
d226 1
a226 1
class LazyNotPS: public LazyUnaryPS<PS_t,P_t> {
d230 1
a230 1
    LazyNotPS(PS_t x) :LazyUnaryPS<PS_t,P_t>(x) {}
d238 1
a238 1
class LazyOffsettedPS: public LazyUnaryPS<PS_t,P_t> {
d244 1
a244 1
    LazyOffsettedPS(PS_t x, P_t off):LazyUnaryPS<PS_t,P_t>(x),offset(off) {
d249 3
a251 3
    int equal(BasePS<P_t>*other)const {
	return LazyUnaryPS<PS_t,P_t>::equal(other) &&
	    offset == ((LazyOffsettedPS*)other)->offset;
@


1.4
log
@many members are now const.
@
text
@d4 4
a7 1
// $Log:	LazyIPS.h,v $
d20 2
a21 2
#ifndef LazyIPS_h_
#define LazyIPS_h_
d30 4
a33 1
class PredicateIPS: public BaseIPS {
d35 1
a35 1
    int (*pred)(IntPoint);
d37 1
a37 1
    PredicateIPS(unsigned dim, int(*f)(IntPoint)) :BaseIPS(dim) {pred=f;}\
d39 1
a39 1
    int equal(BaseIPS*other) const {
d41 1
a41 1
	    pred == ((PredicateIPS*)other)->pred;
d46 3
a48 2
    PointSetType type() const { return L_PRED; }
    int contains (IntPoint ip) const { return 0!=(*pred)(ip); }
d53 23
d80 2
a81 1
class LazyBinaryIPS: public BaseIPS {
d83 1
a83 1
    // express the commonality of all the binary IPSs.
d85 1
a85 1
    const IntPointSet	lhs,rhs;
d87 2
a88 2
    LazyBinaryIPS(IntPointSet lhs_, IntPointSet rhs_)
	:lhs(lhs_), rhs(rhs_), BaseIPS(rhs_.dim()) {
d94 4
a97 4
    // These are appropriate for most binary LazyIPSs.
    // Any IPS it isn't appropriate for can override them
    int equal(BaseIPS* other) const {
	LazyBinaryIPS *ot = (LazyBinaryIPS*)other;
d104 1
a104 1
		this->type() ) % mod;
d113 4
a116 1
class LazyUnionIPS: public LazyBinaryIPS {
d118 4
a121 3
    LazyUnionIPS(IntPointSet l, IntPointSet r) :LazyBinaryIPS(l,r) {}
    PointSetType type() const { return L_UNION; }
    int contains(IntPoint ip) const {
d127 4
a130 1
class LazyIntersectionIPS: public LazyBinaryIPS {
d132 4
a135 3
    LazyIntersectionIPS(IntPointSet l, IntPointSet r) :LazyBinaryIPS(l,r) {}
    PointSetType type() const { return L_INTERSECT; }
    int contains(IntPoint ip) const {
d141 4
a144 1
class LazyXORIPS: public LazyBinaryIPS {
d146 4
a149 3
    LazyXORIPS(IntPointSet l, IntPointSet r) :LazyBinaryIPS(l,r) {}
    PointSetType type() const { return L_XOR; }
    int contains(IntPoint ip) const {
d155 4
a158 1
class LazyMinusIPS: public LazyBinaryIPS {
d160 3
a162 2
    LazyMinusIPS(IntPointSet l, IntPointSet r) :LazyBinaryIPS(l,r) {}
    PointSetType type() const { return L_MINUS; }
d164 2
a165 2
    int equal(BaseIPS* other) const {
	LazyMinusIPS *ot = (LazyMinusIPS*)other;
d169 1
a169 1
    int contains(IntPoint ip) const {
d175 4
a178 1
class LazyMinkowskiIPS: public LazyBinaryIPS {
d180 2
a181 2
    IntPointSet comp() const { return rhs; }
    IntPointSet ext() const { return lhs; }
d183 4
a186 3
    LazyMinkowskiIPS(IntPointSet l, IntPointSet r) :LazyBinaryIPS(l,r) {}
    PointSetType type() const { return L_MINKOWSKI; }
    int contains(IntPoint ip) const;
d193 2
a194 1
class LazyUnaryIPS: public BaseIPS {
d196 1
a196 1
    // express the commonality of all the unary IPSs.
d198 1
a198 1
    const IntPointSet	arg;
d200 2
a201 2
    LazyUnaryIPS(IntPointSet ips)
	:arg(ips), BaseIPS(ips.dim()) {}
d203 4
a206 4
    // these are appropriate for most unary LazyIPSs
    // any IPS it isn't appropriate for can override them
    int equal(BaseIPS* other) const {
	LazyUnaryIPS *ot = (LazyUnaryIPS*)other;
d211 1
a211 1
	return (arg.hash_self(mod) + this->type() ) % mod;
d220 4
a223 1
class LazyNotIPS: public LazyUnaryIPS {
d225 4
a228 3
    LazyNotIPS(IntPointSet x) :LazyUnaryIPS(x) {}
    PointSetType type() const { return L_NOT; }
    int contains(IntPoint ip) const { return ! arg.contains(ip); }
d232 4
a235 1
class LazyOffsettedIPS: public LazyUnaryIPS {
d237 1
a237 1
    const IntPoint	offset;
d239 1
a239 1
    LazyOffsettedIPS(IntPointSet x, IntPoint off):LazyUnaryIPS(x),offset(off) {
d244 3
a246 3
    int equal(BaseIPS*other)const {
	return LazyUnaryIPS::equal(other) &&
	    offset == ((LazyOffsettedIPS*)other)->offset;
d248 3
a250 2
    PointSetType type() const { return L_OFFSET; }
    int contains(IntPoint ip) const { return arg.contains(ip-offset); }
@


1.3
log
@LazyIPS::contains now returns 0 or 1 guaranteed
@
text
@d5 3
d54 1
a54 1
    IntPointSet	lhs,rhs;
d130 2
d146 1
a146 1
    IntPointSet	arg;
d178 1
a178 1
    IntPoint	offset;
@


1.2
log
@fixed dyslexia.
added commutativity of all binary operations except /
@
text
@d5 4
d38 1
a38 1
    int contains (IntPoint ip) const { return (*pred)(ip); }
@


1.1
log
@Initial revision
@
text
@d4 4
a7 1
// $Log$
d26 4
a29 1
    int equal(BaseIPS*) const;
d47 1
a47 1
    IntPointSet	rhs,lhs;
d49 3
a51 3
    LazyBinaryIPS(IntPointSet r, IntPointSet l)
	:rhs(r), lhs(l), BaseIPS(r.dim()) {
	    if (r.dim() != l.dim()) {
d56 2
a57 2
    // these are appropriate for most binary LazyIPSs
    // any IPS it isn't appropriate for can override them
d61 2
a62 1
	    rhs==ot->rhs && lhs==ot->lhs;
d65 1
a65 1
	return (rhs.ps->hash_self(mod) + lhs.ps->hash_self(mod) +
d77 1
a77 1
    LazyUnionIPS(IntPointSet r, IntPointSet l) :LazyBinaryIPS(r,l) {}
d87 1
a87 1
    LazyIntersectionIPS(IntPointSet r, IntPointSet l) :LazyBinaryIPS(r,l) {}
d97 1
a97 1
    LazyXORIPS(IntPointSet r, IntPointSet l) :LazyBinaryIPS(r,l) {}
d107 1
a107 1
    LazyMinusIPS(IntPointSet r, IntPointSet l) :LazyBinaryIPS(r,l) {}
d109 6
d116 1
a116 1
	return lhs.contains(ip) ? 0 : rhs.contains(ip);
d124 1
a124 1
    LazyMinkowskiIPS(IntPointSet r, IntPointSet l) :LazyBinaryIPS(r,l) {}
d150 1
a150 1
	return (arg.ps->hash_self(mod) + this->type() ) % mod;
@
