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


1.5
date	95.01.04.07.06.56;	author rjj;	state Exp;
branches;
next	1.4;

1.4
date	94.12.04.21.21.04;	author rjj;	state Exp;
branches;
next	1.3;

1.3
date	94.12.01.22.13.49;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	94.09.23.18.31.39;	author rjj;	state Exp;
branches;
next	1.1;

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


desc
@Generates a semi-spherical non-negative ball of a given dimension
  and radius.  This is really a support type function and may
  eventually be moved to the support directory tree.
@


1.5
log
@Added standard section header.
@
text
@// semi-sphere-image.c Section: 5.7, The Rolling Ball Algorithm
//     Copyright 1994, Center for Computer Vision and Visualization,
//     University of Florida.  All rights reserved.

#include "semi-sphere-image.h"
#include "shaped-pointset.h"
#include "PSIter.h"


// This function produces the non-negative semi-spherical surface
//   of a sphere of dimension domain_dimension, and with the
//   indicated radius.
// Since the point type P is often IA_Point<int>, the domain
//   of the image will be a digital_disc() of the indicated radius.
// NOTE: parameters pzero and tzero are not used, but are necessary
//   because Cfront insists that the template parameters occur in
//   the signiture of the function, which does NOT include the
//   return type.  Use (P*)0 and (T*)0
//
template <class P, class T>
IA_Image<P,T>
semi_sphere_image( double radius, unsigned int domain_dimension,
		   P * pzero, T * tzero )
{
    IA_Set<P>
	bps( digital_disc( extend_to_point( 0, domain_dimension ),
			   radius ) );

    T * val( new T[ bps.card() ] );
    if ( val == 0 ) {
	ia_throw( IA::PSET_REQUIRE_EXTENSIVE, __FILE__, __LINE__ );
	return IA_Image<P,T>();
    }

    // We must fill the the values in in point set iteration order
    //   so we\'ll create an iterator and let it do the work.

    IA_PSIter<P> ips( bps );

    double r2 = radius * radius;
    P pt;
    int i=0;
    while( ips( pt ) ) {
	double  pt_norm( enorm( pt ) );
	val[ i++ ] = T( sqrt( r2 - pt_norm*pt_norm ) );
    }

    // We\'ll give the iac++ library storage management control.
    return
	IA_Image<P,T>( bps, val, bps.card(), 1 );
}
@


1.4
log
@Corrected previous check in that I though worked...arghhh.
@
text
@d1 1
a1 1
// semi-sphere-image.c Section: 5.7  The Rolling Ball Algorithm
d50 1
a50 1
	IA_Image<P,T>( bps, val, bps.card(), (1==1) );
@


1.3
log
@Added header information.
Included function description as it exists in the .h file.
Modified function interface to use default values for dummy arguments.
@
text
@d23 1
a23 1
		   P * pzero = (P*)0, T * tzero = (T*)0 )
@


1.2
log
@Forgot to change function name from 'function_ball_image'
  to 'semi_sphere_image'.
@
text
@d1 1
a1 1
// semi-sphere-image.c Section: 5.7
d10 10
d23 1
a23 1
		   P * pzero, T * tzero )
@


1.1
log
@Initial revision
@
text
@d5 1
a5 1
#include "function-ball-image.h"
@
