head	1.1;
access;
symbols;
locks; strict;
comment	@// @;


1.1
date	94.08.27.18.50.25;	author rjj;	state Exp;
branches;
next	;


desc
@Initial verion of code defining dual's for templates. Still needs work.
@


1.1
log
@Initial revision
@
text
@// dual.h              Section: 5.7
//     Copyright 1994, Center for Computer Vision and Visualization,
//     University of Florida.  All rights reserved.

#ifndef _rolling_ball_dual_h_
#define  _rolling_ball_dual_h_

#include "IntDI.h"
#include "FloatDI.h"
#include "ClosureI.h"
#include "DDTempl.h"
#include "ClosureDT.h"


template <class P, class T>
class DualImage: public IA_ClosureI<P,T> {
private:
    IA_DDTemplate<IA_Image<P,T> > t;
    IA_Point<int> x;


public:

DualImage( const IA_DDTemplate<IA_Image<P,T> > & t_,
	   const P & x_ )
    : IA_ClosureI<P,T>( t(x).domain() ), t( t_ ), x( x_ )
{}

T  operator() (const P & y) const {
    return
	- (t(y)(x));
}

IA_ClosureI<P,T> *
clone_self() const {
    return
	new DualImage( *this );
}
};



template <class P, class T>
class DualTemplate: public IA_ClosureDT<IA_Image<P,T> > {
private:
    IA_DDTemplate<IA_Image<P,T> > t;

public:
DualTemplate( const IA_DDTemplate<IA_Image<P,T> > & t_ )
    : IA_ClosureDT<IA_Image<P,T> >( t_.domain() )
{}

IA_Image<P,T>
operator() (const P & x) const {
    return
	IA_Image<P,T>( DualImage<P,T>( t, x ) );
}

IA_ClosureDT<IA_Image<P,T> > *
clone_self() const {
    return
	new DualTemplate( *this );
}
};

#endif
@
