home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume38
/
lic
/
part09
< prev
next >
Wrap
Text File
|
1993-08-11
|
66KB
|
1,901 lines
Newsgroups: comp.sources.misc
From: casey@gauss.llnl.gov (Casey Leedom)
Subject: v38i112: lic - LLNL Line Integral Convolution, v1.2, Part09/10
Message-ID: <1993Aug12.013959.14455@sparky.sterling.com>
X-Md4-Signature: 4f965f8abf4ef2d862327e6a3b1d6046
Sender: kent@sparky.sterling.com (Kent Landfield)
Organization: Sterling Software
Date: Thu, 12 Aug 1993 01:39:59 GMT
Approved: kent@sparky.sterling.com
Submitted-by: casey@gauss.llnl.gov (Casey Leedom)
Posting-number: Volume 38, Issue 112
Archive-name: lic/part09
Environment: UNIX
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: lic.1.2/ABSTRACT lic.1.2/BREAKNAMES.sh lic.1.2/TODO
# lic.1.2/liblic/LIC_ComputeImage.3 lic.1.2/liblic/LIC_Convolve.3
# lic.1.2/liblic/LIC_Destroy.3 lic.1.2/liblic/LIC_Modify.3
# lic.1.2/liblic/LIC_Query.3 lic.1.2/liblic/Modify.c
# lic.1.2/test/BasketWeave.c lic.1.2/test/CircleField.c
# lic.1.2/test/Makefile.tmpl lic.1.2/test/SpiralField.c
# lic.1.2/test/WhiteNoise.c
# Wrapped by kent@sparky on Wed Aug 11 19:38:08 1993
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 9 (of 10)."'
if test -f 'lic.1.2/ABSTRACT' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/ABSTRACT'\"
else
echo shar: Extracting \"'lic.1.2/ABSTRACT'\" \(5127 characters\)
sed "s/^X//" >'lic.1.2/ABSTRACT' <<'END_OF_FILE'
XIdentification:
X
X Software Acronym: LIC
X Software Title: Line Integral Convolution Experimental Software
X
X
XAuthor Name(s) and Affiliations:
X
X Brian Cabral Casey Leedom
X LLNL/Engineering LLNL/Computation
X
X
XSoftware Completion Date:
X
X February 15, 1993
X
X
XBrief Description:
X
X This software is an experimental implementation of a new vector
X visualization algorithm. It allows researchers to experiment with
X this algorithm and duplicate results presented in a paper written
X by the authors in the 1993 SIGGRAPH conference: ``Imaging Vector
X Fields Using Line Integral Convolution.''
X
X The software consists of an object-oriented library that
X implements the algorithm, a command line interface and an AVS
X interface and documentation for all of the above.
X
X
XMethod of Solution:
X
X Vectors are visualized by convolving an input image along vector
X stream lines in an input vector field. The result is an image that
X looks like the input image, but blurred in the directions of the
X vectors in the vector field.
X
X The convolution is performed for each vector field element as
X follows: a parametric curve in the vector field is created by
X locally following the vector field forward and backward for some
X distance, L. The parametric curve is laid over the corresponding
X input image pixels. This yields a pixel value function, F(s), on
X the parametric curve. This function is convolved with a filter
X kernel, k(s), to produce the LIC output.
X
X
XComputer(s) for which software is written:
X
X DEC OSF1
X HP HP-UX 8.07
X IBM AIX 3.2
X SGI IRIX 4.0.5
X Sun SunOS 4.1.1
X
X
XOperating System:
X
X POSIX 1003.1-1990.
X
X
XProgramming Language(s) Used:
X
X ANSI C X3.159-1989.
X
X
XSoftware limitations:
X
X All data is dynamically allocated with the C malloc() library
X routine. The software does not handle varying image or vector
X field types dynamically at run time. There is support for
X compile-time specification of a limited number of image pixel
X formats. There is only support for single precision vector fields.
X The AVS interface only supports two-dimensional vector fields.
X
X
XUnique Features of the Software:
X
X The software allows one to visualize very large and dense vector
X fields. Most current vector visualization algorithms bog down
X for large vector fields.
X
X
XRelated and Auxiliary Software:
X
X This is the first release of this software. It does not supersede
X any other version. It does not depend on any other software
X systems. There are many other vector visualization algorithms
X described in the literature.
X
X
XOther Programming or Operating Information or Restrictions:
X
X Files in the top level directory whose names consist of all capital
X letters are general information files and should be read before all
X others.
X
X Files ending in ".c" and ".h" are ANSI C source files. Files
X ending in ".frame" are Frame Maker source files to be processed.
X Files ending in ".N," where N is a single digit, are troff on-line
X manual pages to be processed with the "man" troff macro package.
X Files whose names start with "Makefile" are part of the automatic
X software compilation and installation system for the software.
X
X
XHardware Requirements:
X
X No special hardware is required.
X
X
XTime requirements:
X
X For typical two-dimensional vector fields, about 2000 vector can be
X rendered per second on an IBM RS/6000 based machine.
X
X
XReferences:
X
X Reference documents that are provided with this package:
X
X . (general info) description
X ----------------- -----------
X ABSTRACT .............. this file
X CHANGES ............... catalogue of changes between releases
X MEMO .................. memo of understanding from software authors
X to LLNL software release office
X README ................ overview of software and installation
X instructions
X TODO .................. notes about remaining work to do on
X software
X
X ./liblic (manual pages) description
X ----------------------- -----------
X LIC.3 ................. general introduction to LIC library
X LIC_ComputeImage.3 .... perform LIC computation on LIC object
X LIC_Convolve.3 ........ perform LIC computation for one vector cell
X LIC_Create.3 .......... create and initialize a LIC object
X LIC_Destroy.3 ......... destroy a LIC object
X LIC_Filters.3 ......... description of LIC filters
X LIC_Modify.3 .......... modify a LIC object in various ways
X LIC_Query.3 ........... query a LIC object and the library
X
X ./lic (manual pages) description
X -------------------- -----------
X lic.1 ................. command line interface to the LIC library
X
X ./avs (documentation) description
X --------------------- -----------
X LIC.txt ............... on-line documentation to AVS LIC module
X
X ./doc (documentation) description
X --------------------- -----------
X cover.me .............. cover page, contents, etc. for printed
X documentation
X siggraph .............. SIGGRAPH 1993 LIC paper
X
X
XCategorization and Keywords:
X
X Subject Classification Code: P
X Keywords: computer graphics, image processing
END_OF_FILE
if test 5127 -ne `wc -c <'lic.1.2/ABSTRACT'`; then
echo shar: \"'lic.1.2/ABSTRACT'\" unpacked with wrong size!
fi
# end of 'lic.1.2/ABSTRACT'
fi
if test -f 'lic.1.2/BREAKNAMES.sh' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/BREAKNAMES.sh'\"
else
echo shar: Extracting \"'lic.1.2/BREAKNAMES.sh'\" \(2539 characters\)
sed "s/^X//" >'lic.1.2/BREAKNAMES.sh' <<'END_OF_FILE'
X#!/bin/sh
X#
X# $Header: /d/sisal/a/casey/tmp/lic/RCS/BREAKNAMES.sh,v 1.3 1993/05/28 04:17:43 casey Exp $
X#
X# This script will mangle all the names in the source distribution in order
X# to make them fit on the brain dead SIGGRAPH '93 CD-ROM file system. Use
X# the script FIXNAMES.sh to undo the damage caused by this script.
X
Xcat << EOF
XOnly execute $0 in your worst nightmares!
X
XAnd ***ONLY*** if you ***REALLY*** need to fit a distribution onto a stupid
Xfile system that can't hack names longer than 8 characters with 3 character
Xextensions and no upper/lower case distinction.
X
XAnd if you do have to do this, do it with a separate copy of the source!!!
XEOF
X
Xecho "-------------------------------------"
Xecho "*** REALLY SCREW UP THIS SOURCE TREE?"
Xread ans
Xcase $ans in
X yes|YES)
X ;;
X *)
X echo "Aborting ..."
X exit 1
X ;;
Xesac
X
Xecho ""
Xset -x
X
Xmv FIXNAMES.sh FIXNAMES.SH
Xmv Makefile MAKEFILE
Xmv Makefile.tmpl MAKEFILE.TPL
Xmv PATCHLEVEL PATCHLVL
X
Xmv avs/LIC.c avs/LIC.C
Xmv avs/LIC.txt avs/LIC.TXT
Xmv avs/Makefile avs/MAKEFILE
Xmv avs/Makefile.tmpl avs/MAKEFILE.TPL
Xmv avs AVS
X
Xmv config/Makefile.config config/MAKEFILE.CNF
Xmv config/Makefile.std config/MAKEFILE.STD
Xmv config CONFIG
X
Xmv doc/Makefile doc/MAKEFILE
Xmv doc/Makefile.tmpl doc/MAKEFILE.TPL
Xmv doc/cover.me doc/COVER.ME
Xmv doc DOC
X
Xmv include/Makefile include/MAKEFILE
Xmv include/Makefile.tmpl include/MAKEFILE.TPL
Xmv include/lic.h include/LIC.H
Xmv include INCLUDE
X
Xmv liblic/ComputeImage.c liblic/COMPUTE.C
Xmv liblic/Convolve2D.c liblic/CONVOLV2.C
Xmv liblic/Convolve3D.c liblic/CONVOLV3.C
Xmv liblic/Create.c liblic/CREATE.C
Xmv liblic/DebugPrologue.ps liblic/DEBUG.PS
Xmv liblic/Destroy.c liblic/DESTROY.C
Xmv liblic/Filters.c liblic/FILTERS.C
Xmv liblic/LIC_ComputeImage.3 liblic/COMPUTE.3
Xmv liblic/LIC_Convolve.3 liblic/CONVOLVE.3
Xmv liblic/LIC_Create.3 liblic/CREATE.3
Xmv liblic/LIC_Destroy.3 liblic/DESTROY.3
Xmv liblic/LIC_Filters.3 liblic/FILTERS.3
Xmv liblic/LIC_Modify.3 liblic/MODIFY.3
Xmv liblic/LIC_Query.3 liblic/QUERY.3
Xmv liblic/Makefile liblic/MAKEFILE
Xmv liblic/Makefile.tmpl liblic/MAKEFILE.TPL
Xmv liblic/Modify.c liblic/MODIFY.C
Xmv liblic/Query.c liblic/QUERY.C
Xmv liblic/liblic.h liblic/LIBLIC.H
Xmv liblic LIBLIC
X
Xmv lic/Makefile lic/MAKEFILE
Xmv lic/Makefile.tmpl lic/MAKEFILE.TPL
Xmv lic/lic.1 lic/LIC.1
Xmv lic/lic.c lic/LIC.C
Xmv lic LIC
X
Xmv test/BasketWeave.c test/BASKETWEAVE.C
Xmv test/Makefile test/MAKEFILE
Xmv test/Makefile.tmpl test/MAKEFILE.TPL
Xmv test/Noise.c test/NOISE.C
Xmv test TEST
END_OF_FILE
if test 2539 -ne `wc -c <'lic.1.2/BREAKNAMES.sh'`; then
echo shar: \"'lic.1.2/BREAKNAMES.sh'\" unpacked with wrong size!
fi
chmod +x 'lic.1.2/BREAKNAMES.sh'
# end of 'lic.1.2/BREAKNAMES.sh'
fi
if test -f 'lic.1.2/TODO' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/TODO'\"
else
echo shar: Extracting \"'lic.1.2/TODO'\" \(2938 characters\)
sed "s/^X//" >'lic.1.2/TODO' <<'END_OF_FILE'
X$Header: /d/sisal/a/casey/tmp/lic/RCS/TODO,v 1.17 1993/08/10 23:16:41 casey Exp $
X
X
X Unfinished work on the LLNL LIC distribution
X
X
X o Implement a three-dimensional AVS module. Preferably two- and
X three-dimensional support should be handled automatically by
X the same module.
X
X o Should probably implement a means to change the number of
X animation frames that the AVS module generates.
X
X o Implement Explorer module.
X
X o Should really report parameter errors to user instead of
X silently correcting them. See checks for negative lengths,
X frequencies, etc.
X
X o The convolve routines do almost no parameter checking. In
X particular, no check is made to make sure i, j and k are in
X the correct ranges. Should probably do this by moving some
X range checking code from the bottom of the main loop to the
X top rather than introducing yet more code the wade through,
X but don't have time to think about how best to do this and
X test the results.
X
X o Probably need to make the number of ``speeds'' be variable.
X Also want the number of integral tables allocated and built to
X be limited to 1 when variable speed is turned off. Finally,
X it might be nice to expose the VariableSpeed frequency scaling
X factor used in LIC_Ripple. LIC_Ripple scales the ripple filter
X frequency inversely with vector magnitude. It's currently
X hardwired to map maximum to 0 vectors to scale factors of 1.0
X and 6.0, respectively.
X
X o Should probably expose SIN_PARALLEL as a user specifiable
X parameter. (SIN_PARALLEL is the sin(w) of some small angle w.
X It is used in the convolution LIC path advection code to
X determine whether a vector is ``parallel'' to a vector cell
X edge or face.) Might also want to expose the maximum loop
X count factor of the inner convolution loop -- it's currently
X 3 * Length.
X
X o Implement image and vector field formatting handling
X dynamically at run time. Currently only compile time support
X for image pixel types is supported. There is only support for
X single precision vector fields.
X
X o There are too many parameters to LIC_Create. There are also
X simultaneously too few and too many LIC_ChangeFoo routines.
X There are too few because we really want to expose all the LIC
X knobs to the user, but there are too many because they're
X proliferating like rabbits. Probably something more along the
X lines of XtVaSetArgs is what we really want.
X
X o LIC_Image and LIC_VectorField should have a set of methods put
X together to create, modify, query and destroy them. That
X would help clean up the horrible parameter mess that
X LIC_Create has become.
X
X o The LIC_Filter type should be yet another object type that not
X only keeps a pointer to the filter kernel integral function,
X but also keeps track of any special filter specific
X parameters.
X
X o Should we implement a routine that makes it easy to reissue a
X convolution on the output of a previous convolution?
X
END_OF_FILE
if test 2938 -ne `wc -c <'lic.1.2/TODO'`; then
echo shar: \"'lic.1.2/TODO'\" unpacked with wrong size!
fi
# end of 'lic.1.2/TODO'
fi
if test -f 'lic.1.2/liblic/LIC_ComputeImage.3' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/liblic/LIC_ComputeImage.3'\"
else
echo shar: Extracting \"'lic.1.2/liblic/LIC_ComputeImage.3'\" \(3052 characters\)
sed "s/^X//" >'lic.1.2/liblic/LIC_ComputeImage.3' <<'END_OF_FILE'
X.\" Copyright (c) 1993 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\" notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\" notice, this list of conditions and the following disclaimer in the
X.\" documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\" must display the following acknowledgement:
X.\" This product includes software developed by the University of
X.\" California, Lawrence Livermore National Laboratory and its
X.\" contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\" may be used to endorse or promote products derived from this software
X.\" without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.de Hd
X.ds Dt \\$4
X..
X.Hd $Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/LIC_ComputeImage.3,v 1.4 1993/07/28 19:04:02 casey Exp $
X.TH LIC_COMPUTEIMAGE 3 \*(Dt
X.SH NAME
XLIC_ComputeImage \- compute image using Line Integral Convolution
X.SH SYNOPSIS
X.nf
X#include <lic.h>
X
Xvoid \fBLIC_ComputeImage\fP(LIC *\fIThis\fP)
X.fi
X.SH DESCRIPTION
X.B LIC_ComputeImage
Xcalls the appropriate Line Integral Convolution method for each input
Xvector field cell and deposits the normalized results into the output image.
X.PP
XFor each cell,
X.B LIC_ComputeImage
Xcalls the appropriate convolution method twice: once to compute the partial LIC
Xfor the positive vector field direction and once for the negative direction.
XThe two partial results are summed and normalized by the summed normalization
Xfactors.
X.PP
XCurrently two- and three-dimensional versions of Line Integral Convolution
Xare implemented.
X.B LIC_ComputeImage
Xcalls one of
X.BR LIC_Convolve2D (3)
Xor
X.BR LIC_Convolve3D (3)
Xdepending on the Z depth of the input vector field.
X.SH "SEE ALSO"
X.BR LIC (3),
X.BR LIC_Convolve (3)
X.SH STANDARDS
XThis is unsupported, non-standard software. It is not the subject of any
Xstandards effort.
END_OF_FILE
if test 3052 -ne `wc -c <'lic.1.2/liblic/LIC_ComputeImage.3'`; then
echo shar: \"'lic.1.2/liblic/LIC_ComputeImage.3'\" unpacked with wrong size!
fi
# end of 'lic.1.2/liblic/LIC_ComputeImage.3'
fi
if test -f 'lic.1.2/liblic/LIC_Convolve.3' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/liblic/LIC_Convolve.3'\"
else
echo shar: Extracting \"'lic.1.2/liblic/LIC_Convolve.3'\" \(4666 characters\)
sed "s/^X//" >'lic.1.2/liblic/LIC_Convolve.3' <<'END_OF_FILE'
X.\" Copyright (c) 1993 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\" notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\" notice, this list of conditions and the following disclaimer in the
X.\" documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\" must display the following acknowledgement:
X.\" This product includes software developed by the University of
X.\" California, Lawrence Livermore National Laboratory and its
X.\" contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\" may be used to endorse or promote products derived from this software
X.\" without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.de Hd
X.ds Dt \\$4
X..
X.Hd $Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/LIC_Convolve.3,v 1.2 1993/05/28 04:33:53 casey Exp $
X.TH LIC_CONVOLVE 3 \*(Dt
X.SH NAME
XLIC_Convolve2D, LIC_Convolve3D \- Line Integral Convolution engines
X.SH SYNOPSIS
X.nf
X#include <lic.h>
X
X.ta \w'LIC *\fBLIC_Convolve2D\fP('u +\w'doubleXXX'u
Xvoid \fBLIC_Convolve2D\fP(LIC *\fIThis\fP,
X.ta \w'LIC *\fBLIC_Convolve2D\fP('u +\w'doubleXXX*'u
X int \fIi\fP,
X int \fIj\fP,
X int \fIdirection\fP,
X.ta \w'LIC *\fBLIC_Convolve2D\fP('u +\w'doubleXXX'u
X double *\fIrIntegral\fP,
X double *\fIgIntegral\fP,
X double *\fIbIntegral\fP,
X double *\fIaIntegral\fP,
X double *\fIKernelArea\fP)
X.DT
X
X.ta \w'LIC *\fBLIC_Convolve3D\fP('u +\w'doubleXXX'u
Xvoid \fBLIC_Convolve3D\fP(LIC *\fIThis\fP,
X.ta \w'LIC *\fBLIC_Convolve3D\fP('u +\w'doubleXXX*'u
X int \fIi\fP,
X int \fIj\fP,
X int \fIk\fP,
X int \fIdirection\fP,
X.ta \w'LIC *\fBLIC_Convolve3D\fP('u +\w'doubleXXX'u
X double *\fIrIntegral\fP,
X double *\fIgIntegral\fP,
X double *\fIbIntegral\fP,
X double *\fIaIntegral\fP,
X double *\fIKernelArea\fP)
X.DT
X.fi
X.SH DESCRIPTION
X.B LIC_Convolve2D
Xand
X.B LIC_Convolve3D
Xperform the Line Integral Convolution algorithm for two and three dimensions,
Xrespectively.
X.IR i ,
X.I j
Xand
X.I k
Xrepresent the position within the vector field to image. These are all
Xzero based indexes.
X.PP
X.I direction
Xcontrols whether the LIC follows the vector field foreward along vector
Xfield lines,
X.BR LIC_FOREWARD ,
Xor backward along the negative of vector field lines,
X.BR LIC_BACKWARD .
X.PP
X.IR rIntegral ,
X.IR gIntegral ,
X.I bIntegral
Xand
X.I aIntegral
Xare value return parameters. On return from the convolution routine, they
Xwill hold the red, green, blue and alpha LIC sums, respectively. These
Xsums represent the convolution of the LIC filter,
X.IR k(s) ,
Xwith the pixel values,
X.IR F(s) ,
Xalong the LIC path.
X.PP
X.I KernelArea
Xis a value return parameter. On return from the convolution routine,
Xit will hold the area (integral) of the filter kernel for the
Xconvolution. For variable normalization (see
X.BR LIC_Create )
Xonly the area under the portion of the filter kernel actually used in
Xthe convolution will be returned. For fixed normalization the area
Xreturned will be for the entire filter kernel corresponding to
X.IR direction .
XThese will differ when the LIC path is prematurely terminated due to a vector
Xfield singularity or running off the edge of the vector field.
X.SH "SEE ALSO"
X.BR LIC (3),
X.BR LIC_ComputeImage (3)
X.SH BUGS
XIf
X.IR i ,
X.I j
Xor
X.I k
Xare out of range (less than 0 or greater than or equal to their corresponding
Xdimension size), the most likely outcome will be a segmentation fault. This
Xshould probably be fixed ...
X.SH STANDARDS
XThis is unsupported, non-standard software. It is not the subject of any
Xstandards effort.
END_OF_FILE
if test 4666 -ne `wc -c <'lic.1.2/liblic/LIC_Convolve.3'`; then
echo shar: \"'lic.1.2/liblic/LIC_Convolve.3'\" unpacked with wrong size!
fi
# end of 'lic.1.2/liblic/LIC_Convolve.3'
fi
if test -f 'lic.1.2/liblic/LIC_Destroy.3' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/liblic/LIC_Destroy.3'\"
else
echo shar: Extracting \"'lic.1.2/liblic/LIC_Destroy.3'\" \(2577 characters\)
sed "s/^X//" >'lic.1.2/liblic/LIC_Destroy.3' <<'END_OF_FILE'
X.\" Copyright (c) 1993 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\" notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\" notice, this list of conditions and the following disclaimer in the
X.\" documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\" must display the following acknowledgement:
X.\" This product includes software developed by the University of
X.\" California, Lawrence Livermore National Laboratory and its
X.\" contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\" may be used to endorse or promote products derived from this software
X.\" without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.de Hd
X.ds Dt \\$4
X..
X.Hd $Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/LIC_Destroy.3,v 1.1 1993/05/27 20:18:46 casey Exp $
X.TH LIC_DESTROY 3 \*(Dt
X.SH NAME
XLIC_Destroy \- destroy Line Integral Convolution object instance
X.SH SYNOPSIS
X.nf
X#include <lic.h>
X
Xvoid \fBLIC_Destroy\fP(LIC *\fIThis\fP)
X.fi
X.SH DESCRIPTION
X.B LIC_Destroy
Xdestroys a LIC instance pointed to by
X.IR This .
XThe LIC instance must previously have been instantiated via
X.BR LIC_Create .
XAny resources allocated to the LIC instance will be freed up by
X.BR LIC_Destroy .
X.SH "SEE ALSO"
X.BR LIC (3),
X.BR LIC_Create (3)
X.SH STANDARDS
XThis is unsupported, non-standard software. It is not the subject of any
Xstandards effort.
END_OF_FILE
if test 2577 -ne `wc -c <'lic.1.2/liblic/LIC_Destroy.3'`; then
echo shar: \"'lic.1.2/liblic/LIC_Destroy.3'\" unpacked with wrong size!
fi
# end of 'lic.1.2/liblic/LIC_Destroy.3'
fi
if test -f 'lic.1.2/liblic/LIC_Modify.3' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/liblic/LIC_Modify.3'\"
else
echo shar: Extracting \"'lic.1.2/liblic/LIC_Modify.3'\" \(5028 characters\)
sed "s/^X//" >'lic.1.2/liblic/LIC_Modify.3' <<'END_OF_FILE'
X.\" Copyright (c) 1993 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\" notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\" notice, this list of conditions and the following disclaimer in the
X.\" documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\" must display the following acknowledgement:
X.\" This product includes software developed by the University of
X.\" California, Lawrence Livermore National Laboratory and its
X.\" contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\" may be used to endorse or promote products derived from this software
X.\" without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.de Hd
X.ds Dt \\$4
X..
X.Hd $Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/LIC_Modify.3,v 1.3 1993/07/28 21:28:50 casey Exp $
X.TH LIC_MODIFY 3 \*(Dt
X.SH NAME
XLIC_Modify \- change features of LIC object instances
X.SH SYNOPSIS
X.nf
X#include <lic.h>
X
Xvoid \fBLIC_ChangeLength\fP(LIC *\fIThis\fP, double \fIlength\fP)
Xvoid \fBLIC_ChangeFrequency\fP(LIC *\fIThis\fP, double \fIfrequency\fP);
Xvoid \fBLIC_ChangePhase\fP(LIC *\fIThis\fP, double \fIphase\fP)
Xvoid \fBLIC_ChangeFilter\fP(LIC *\fIThis\fP, LIC_Filter \fIfilter\fP)
X.fi
X.SH DESCRIPTION
X.if t .ds pi \(*p
X.if n .ds pi Pi
X.B LIC_ChangeLength
Xwill change the length of the filter kernel support for
X.I This
Xto
X.IR length .
XThe length of the filter kernel will actually be
X.RI 2* length ,
Xextending from
X.RI - length
Xto
X.RI + length .
XIt is an error to specify a
X.I length
Xless than
X.BR 0 .
X.PP
X.B LIC_ChangeFrequency
Xwill change the filter frequency for
X.I This
Xto
X.IR frequency .
X.B LIC_ChangePhase
Xwill change the filter phase to
X.IR phase .
X.I frequency
Xis interpreted as the number of cycles of the filter kernel over the domain
X.RB - \*(pi
Xto
X.BR \*(pi .
X.I phase
Xis interpreted as the phase offset of the filter kernel in the same domain.
XBoth
X.I frequency
Xand
X.I phase
Xare scaled to the length of the filter kernel. Thus, a
X.I frequency
Xof 2 will cause two repetitions of the filter kernel across the domain
X.RI - length
Xto
X.RI + length .
X.I frequency
Xmust be non-zero and positive.
XCurrently, the only filter supplied with the LIC library that uses these
Xoptions is
X.BR LIC_Ripple .
X.PP
X.B LIC_ChangeFilter
Xwill change the filter kernel integral function for
X.I This
Xto
X.IR filter .
X.I filter
Xmust be a pointer to a LIC_Filter type function:
X.PP
X.RS
X.nf
Xdouble \fIfilter\fP(LIC *\fIThis\fP, double \fIa\fP, double \fIb\fP, double \fIfrequency\fP)
X.fi
X.RE
X.PP
X.I filter
Xshould return the integral of the filter kernel between
X.I a
Xand
X.IR b .
X.I frequency
Xspecifies the frequency that
X.I filter
Xshould use for its filter kernel.
X.I frequency
Xis used to implement the variable speed option specified to
X.B LIC_Create
X(though many filters ignore this parameter).
X.PP
XThe following filters are supplied with the LIC library:
X.PP
X.RS
X.nf
Xdouble \fBLIC_Box\fP(LIC *\fIThis\fP, double \fIa\fP, double \fIb\fP, int \fIspeed\fP)
Xdouble \fBLIC_Ripple\fP(LIC *\fIThis\fP, double \fIa\fP, double \fIb\fP, int \fIspeed\fP)
Xdouble \fBLIC_Ramp\fP(LIC *\fIThis\fP, double \fIa\fP, double \fIb\fP, int \fIspeed\fP)
Xdouble \fBLIC_Select\fP(LIC *\fIThis\fP, double \fIa\fP, double \fIb\fP, int \fIspeed\fP)
X.fi
X.RE
X.PP
XSee
X.BR LIC_Filters (3)
Xfor more information on LIC filters and the integration process.
X.SH "SEE ALSO"
X.BR LIC (3),
X.BR LIC_Create (3),
X.BR LIC_Destroy (3),
X.BR LIC_Filters (3),
X.BR LIC_Query (3)
X.SH BUGS
XIf a negative
X.I length
Xis specified to
X.BR LIC_ChangeLength ,
Xa length of 0 will be used instead.
XIf a negative or zero
X.I frequency
Xis specified to
X.BR LIC_ChangeFrequency ,
Xa frequency of 1e-6 will be used instead. In both cases error messages
Xshould probably be output.
X.SH STANDARDS
XThis is unsupported, non-standard software. It is not the subject of any
Xstandards effort.
END_OF_FILE
if test 5028 -ne `wc -c <'lic.1.2/liblic/LIC_Modify.3'`; then
echo shar: \"'lic.1.2/liblic/LIC_Modify.3'\" unpacked with wrong size!
fi
# end of 'lic.1.2/liblic/LIC_Modify.3'
fi
if test -f 'lic.1.2/liblic/LIC_Query.3' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/liblic/LIC_Query.3'\"
else
echo shar: Extracting \"'lic.1.2/liblic/LIC_Query.3'\" \(3652 characters\)
sed "s/^X//" >'lic.1.2/liblic/LIC_Query.3' <<'END_OF_FILE'
X.\" Copyright (c) 1993 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\" notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\" notice, this list of conditions and the following disclaimer in the
X.\" documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\" must display the following acknowledgement:
X.\" This product includes software developed by the University of
X.\" California, Lawrence Livermore National Laboratory and its
X.\" contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\" may be used to endorse or promote products derived from this software
X.\" without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.de Hd
X.ds Dt \\$4
X..
X.Hd $Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/LIC_Query.3,v 1.1 1993/05/27 20:18:46 casey Exp $
X.TH LIC_QUERY 3 \*(Dt
X.SH NAME
XLIC_Query \- request information on LIC object instances and the library
X.SH SYNOPSIS
X.nf
X#include <lic.h>
X
Xunsigned char *\fBLIC_InputImage\fP(LIC *\fIThis\fP)
Xfloat *\fBLIC_InputField\fP(LIC *\fIThis\fP)
Xunsigned char *\fBLIC_OutputImage\fP(LIC *\fIThis\fP)
X
Xdouble \fBLIC_Length\fP(LIC *\fIThis\fP)
Xdouble \fBLIC_Phase\fP(LIC *\fIThis\fP)
Xdouble \fBLIC_Frequency\fP(LIC *\fIThis\fP)
X
Xchar *\fBLIC_ConfiguredPixelType\fP(void)
Xint \fBLIC_ConfiguredPixelSize\fP(void)
X.fi
X.SH DESCRIPTION
X.BR LIC_InputImage ,
X.B LIC_InputField
Xand
X.B LIC_OutputImage
Xreturn pointers to the input image, input vector field and output image,
Xrespectively.
X.BR LIC_Length ,
X.B LIC_Phase
Xand
X.B LIC_Frequency
Xreturn the current filter kernel length, phase and frequency, respectively.
X.PP
X.B LIC_ConfiguredPixelType
Xreturns a pointer to a character string representation of the pixel type
Xconfigured into the LIC library.
X.B LIC_ConfiguredPixelSize
Xreturns the size in bytes of pixel values configured into the LIC library.
X.PP
XReturn values from
X.B LIC_ConfiguredPixelType and LIC_ConfiguredPixelSize are:
X.PP
X.RS
X.nf
X.ta \w'MONOCHROMEXXX'u
X.I Type Size
X\fBMONOCHROME\fP 1
X\fBRGB\fP 3
X\fBBGR\fP 3
X\fBRGBA\fP 4
X\fBBGRA\fP 4
X\fBARGB\fP 4
X\fBABGR\fP 4
X.DT
X.fi
X.RE
X.SH "SEE ALSO"
X.BR LIC (3),
X.BR LIC_Create (3),
X.BR LIC_Destroy (3),
X.BR LIC_Modify (3)
X.SH BUGS
XNeither
X.B LIC_ConfiguredPixelType
Xnor
X.BR LIC_ConfiguredPixelSize .
Xshould be necessary. Such issues should be handled dynamically at run-time
Xinstead of compile-time.
X.SH STANDARDS
XThis is unsupported, non-standard software. It is not the subject of any
Xstandards effort.
END_OF_FILE
if test 3652 -ne `wc -c <'lic.1.2/liblic/LIC_Query.3'`; then
echo shar: \"'lic.1.2/liblic/LIC_Query.3'\" unpacked with wrong size!
fi
# end of 'lic.1.2/liblic/LIC_Query.3'
fi
if test -f 'lic.1.2/liblic/Modify.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/liblic/Modify.c'\"
else
echo shar: Extracting \"'lic.1.2/liblic/Modify.c'\" \(3108 characters\)
sed "s/^X//" >'lic.1.2/liblic/Modify.c' <<'END_OF_FILE'
X/*
X * $Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/Modify.c,v 1.6 1993/07/28 18:54:58 casey Exp $
X */
X
X/*
X * Copyright (c) 1993 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by the University of
X * California, Lawrence Livermore National Laboratory and its
X * contributors.
X * 4. Neither the name of the University nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
X static char rcsid[] = "$Header: /d/sisal/a/casey/tmp/lic/liblic/RCS/Modify.c,v 1.6 1993/07/28 18:54:58 casey Exp $";
X static char copyright[] =
X "Copyright (c) 1993 The Regents of the University of California.\n"
X "All rights reserved.\n";
X#endif
X
X
X#include "liblic.h"
X
X
X/*
X * Change various features of LIC instances.
X * =========================================
X */
X
X
Xvoid
XLIC_ChangeLength(LIC *This, double length)
X /*
X * Change the length of the filter kernel.
X */
X{
X This->Length = (length < 0.0) ? 0.0 : length;
X This->NeedIntegration = TRUE;
X}
X
X
Xvoid
XLIC_ChangePhase(LIC *This, double phase)
X /*
X * Change the phase of the filter kernel.
X */
X{
X This->Phase = phase;
X This->NeedIntegration = TRUE;
X}
X
X
Xvoid
XLIC_ChangeFrequency(LIC *This, double frequency)
X /*
X * Change the frequency of the filter kernel.
X */
X{
X This->Frequency = (frequency <= 0.0) ? 1e-6 : frequency;
X This->NeedIntegration = TRUE;
X}
X
X
Xvoid
XLIC_ChangeFilter(LIC *This, LIC_Filter filter)
X /*
X * Change the filter kernel.
X */
X{
X This->Filter = filter;
X This->NeedIntegration = TRUE;
X}
END_OF_FILE
if test 3108 -ne `wc -c <'lic.1.2/liblic/Modify.c'`; then
echo shar: \"'lic.1.2/liblic/Modify.c'\" unpacked with wrong size!
fi
# end of 'lic.1.2/liblic/Modify.c'
fi
if test -f 'lic.1.2/test/BasketWeave.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/test/BasketWeave.c'\"
else
echo shar: Extracting \"'lic.1.2/test/BasketWeave.c'\" \(5711 characters\)
sed "s/^X//" >'lic.1.2/test/BasketWeave.c' <<'END_OF_FILE'
X/*
X * $Header: /d/sisal/a/casey/tmp/lic/test/RCS/BasketWeave.c,v 1.4 1993/08/10 17:18:22 casey Exp $
X */
X
X/*
X * Copyright (c) 1993 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by the University of
X * California, Lawrence Livermore National Laboratory and its
X * contributors.
X * 4. Neither the name of the University nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
X static char rcsid[] = "$Header: /d/sisal/a/casey/tmp/lic/test/RCS/BasketWeave.c,v 1.4 1993/08/10 17:18:22 casey Exp $";
X static char copyright[] =
X "Copyright (c) 1993 The Regents of the University of California.\n"
X "All rights reserved.\n";
X#endif
X
X
X#include <stdlib.h>
X#include <unistd.h>
X#include <errno.h>
X#include <fcntl.h>
X#include <string.h>
X#include <stdio.h>
X
X
X/*
X * Create a two-dimensional floating point vector field with horizontal and
X * vertical vectors alternating in a checkerboard fashion. Each checker
X * will be surrounded by a border of zero vectors. When rendered with
X * Line Integral Convolution and white noise as input, this will generate
X * a basket weave texture.
X */
X
X
X#ifdef NEED_EXIT_CODES
X /*
X * EXIT_SUCCESS and EXIT_FAILURE are supposed to be defined in <stdlib.h>
X * according to the ANSI C X3.159-1989 specification, but Sun OS 4.1.1
X * fails to define them ...
X */
X# define EXIT_SUCCESS 0
X# define EXIT_FAILURE 1
X#endif
X
X
X#ifdef NEED_STRERROR
X /*
X * strerror is supposed to be defined in <string.h> and supplied in the
X * standard C library according to the ANSI C X3.159-1989 specification,
X * but Sun OS 4.1.1 fails to define or supply it ... Unfortunately the
X * only way we can control this is with an externally supplied define.
X */
X extern int errno; /* system error number */
X extern char *sys_errlist[]; /* system error messages */
X extern int sys_nerr; /* number of entries in sys_errlist */
X
X char *
X strerror(int err)
X {
X if (err < 0 || err >= sys_nerr) {
X static char msg[100];
X
X sprintf(msg, "system error number %d", err);
X return(msg);
X }
X return(sys_errlist[err]);
X }
X#endif
X
X
X#define HORIZONTAL 0 /* must == !VERTICAL */
X#define VERTICAL 1 /* must == !HORIZONTAL */
X
X
Xmain(int argc, char *argv[])
X{
X char *myname;
X char *file;
X int Xres, Yres, Xchecks, Ychecks;
X int Xchecker, Ychecker;
X register int Orientation;
X float *VectorField;
X register float fx, fy;
X register int i, j;
X int fd, cc;
X
X myname = argv[0];
X if (argc != 6)
X {
X (void)fprintf(stderr, "usage: %s file-name x-res y-res x-checks"
X " y-checks\n", myname);
X exit(EXIT_FAILURE);
X }
X
X /* grab arguments */
X file = argv[1];
X Xres = atoi(argv[2]);
X Yres = atoi(argv[3]);
X Xchecks = atoi(argv[4]);
X Ychecks = atoi(argv[5]);
X
X Xchecker = Xres / Xchecks;
X Ychecker = Yres / Ychecks;
X
X VectorField = (float *)malloc(sizeof(float)*Yres*Xres*2);
X if (VectorField == NULL)
X {
X (void)fprintf(stderr, "%s: insufficient memory for creating the basket"
X " weave\n", myname);
X exit(EXIT_FAILURE);
X }
X
X Orientation = HORIZONTAL;
X for (j = 0; j < Yres; j++)
X {
X if ((j % Ychecker) == 0)
X Orientation = !Orientation;
X
X for (i = 0; i < Xres; i++)
X {
X if ((i % Xchecker) == 0)
X Orientation = !Orientation;
X
X if ((i % Xchecker) == 0 || (j % Ychecker) == 0)
X {
X fx = 0;
X fy = 0;
X }
X else
X {
X fx = Orientation;
X fy = !Orientation;
X }
X VectorField[2*(j*Xres + i) + 0] = fx;
X VectorField[2*(j*Xres + i) + 1] = fy;
X }
X }
X
X fd = open(file, O_CREAT|O_WRONLY, 0666);
X if (fd < 0)
X {
X (void)fprintf(stderr, "%s: unable to open %s: %s\n", myname, file,
X strerror(errno));
X exit(EXIT_FAILURE);
X }
X
X cc = write(fd, VectorField, 2*sizeof(float)*Xres*Yres);
X if (cc != 2*sizeof(float)*Xres*Yres)
X {
X (void)fprintf(stderr, "%s: write returned short: %s\n", myname,
X strerror(errno));
X (void)close(fd);
X exit(EXIT_FAILURE);
X }
X (void)close(fd);
X exit(EXIT_SUCCESS);
X}
END_OF_FILE
if test 5711 -ne `wc -c <'lic.1.2/test/BasketWeave.c'`; then
echo shar: \"'lic.1.2/test/BasketWeave.c'\" unpacked with wrong size!
fi
# end of 'lic.1.2/test/BasketWeave.c'
fi
if test -f 'lic.1.2/test/CircleField.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/test/CircleField.c'\"
else
echo shar: Extracting \"'lic.1.2/test/CircleField.c'\" \(5101 characters\)
sed "s/^X//" >'lic.1.2/test/CircleField.c' <<'END_OF_FILE'
X/*
X * $Header: /d/sisal/a/casey/tmp/lic/test/RCS/CircleField.c,v 1.2 1993/08/10 17:18:22 casey Exp $
X */
X
X/*
X * Copyright (c) 1993 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by the University of
X * California, Lawrence Livermore National Laboratory and its
X * contributors.
X * 4. Neither the name of the University nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
X static char rcsid[] = "$Header: /d/sisal/a/casey/tmp/lic/test/RCS/CircleField.c,v 1.2 1993/08/10 17:18:22 casey Exp $";
X static char copyright[] =
X "Copyright (c) 1993 The Regents of the University of California.\n"
X "All rights reserved.\n";
X#endif
X
X
X#include <stdlib.h>
X#include <unistd.h>
X#include <errno.h>
X#include <fcntl.h>
X#include <string.h>
X#include <stdio.h>
X
X
X/*
X * Create a two-dimensional floating point circular vector field. Each
X * vector will point 90 degrees, clockwise, away from the center of the
X * field. v(x, y) = (x, -y). Note that the vector magnitudes are *not*
X * equal to 1.0.
X */
X
X
X#ifdef NEED_EXIT_CODES
X /*
X * EXIT_SUCCESS and EXIT_FAILURE are supposed to be defined in <stdlib.h>
X * according to the ANSI C X3.159-1989 specification, but Sun OS 4.1.1
X * fails to define them ...
X */
X# define EXIT_SUCCESS 0
X# define EXIT_FAILURE 1
X#endif
X
X
X#ifdef NEED_STRERROR
X /*
X * strerror is supposed to be defined in <string.h> and supplied in the
X * standard C library according to the ANSI C X3.159-1989 specification,
X * but Sun OS 4.1.1 fails to define or supply it ... Unfortunately the
X * only way we can control this is with an externally supplied define.
X */
X extern int errno; /* system error number */
X extern char *sys_errlist[]; /* system error messages */
X extern int sys_nerr; /* number of entries in sys_errlist */
X
X char *
X strerror(int err)
X {
X if (err < 0 || err >= sys_nerr) {
X static char msg[100];
X
X sprintf(msg, "system error number %d", err);
X return(msg);
X }
X return(sys_errlist[err]);
X }
X#endif
X
X
Xmain(int argc, char *argv[])
X{
X char *myname;
X char *file;
X int Xres, Yres;
X float *VectorField;
X register float fx, fy;
X register int i, j;
X int fd, cc;
X
X myname = argv[0];
X if (argc != 4)
X {
X (void)fprintf(stderr, "usage: %s file-name x-res y-res\n", myname);
X exit(EXIT_FAILURE);
X }
X
X /* grab arguments */
X file = argv[1];
X Xres = atoi(argv[2]);
X Yres = atoi(argv[3]);
X
X VectorField = (float *)malloc(sizeof(float)*Yres*Xres*2);
X if (VectorField == NULL)
X {
X (void)fprintf(stderr, "%s: insufficient memory for creating the circle"
X " field\n", myname);
X exit(EXIT_FAILURE);
X }
X
X for ( j = 0; j < Yres; j++ )
X {
X fy = (float)j/(float)(Yres-1) - 0.5;
X for ( i = 0; i < Xres; i++ )
X {
X fx = (float)i/(float)(Xres-1) - 0.5;
X VectorField[2*((Yres - j)*Xres + i) + 0] = fy;
X VectorField[2*((Yres - j)*Xres + i) + 1] = -fx;
X }
X }
X
X fd = open(file, O_CREAT|O_WRONLY, 0666);
X if (fd < 0)
X {
X (void)fprintf(stderr, "%s: unable to open %s: %s\n", myname, file,
X strerror(errno));
X exit(EXIT_FAILURE);
X }
X
X cc = write(fd, VectorField, 2*sizeof(float)*Xres*Yres);
X if (cc != 2*sizeof(float)*Xres*Yres)
X {
X (void)fprintf(stderr, "%s: write returned short: %s\n", myname,
X strerror(errno));
X (void)close(fd);
X exit(EXIT_FAILURE);
X }
X (void)close(fd);
X exit(EXIT_SUCCESS);
X}
END_OF_FILE
if test 5101 -ne `wc -c <'lic.1.2/test/CircleField.c'`; then
echo shar: \"'lic.1.2/test/CircleField.c'\" unpacked with wrong size!
fi
# end of 'lic.1.2/test/CircleField.c'
fi
if test -f 'lic.1.2/test/Makefile.tmpl' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/test/Makefile.tmpl'\"
else
echo shar: Extracting \"'lic.1.2/test/Makefile.tmpl'\" \(1993 characters\)
sed "s/^X//" >'lic.1.2/test/Makefile.tmpl' <<'END_OF_FILE'
X#
X# $Header: /d/sisal/a/casey/tmp/lic/test/RCS/Makefile.tmpl,v 1.5 1993/08/10 17:46:40 casey Exp $
X#
X DEFINES = $(IMAGE_DEFINES) $(MMAP_DEFINES)
X
X SRCS1 = WhiteNoise.c
X OBJS1 = WhiteNoise.o
X DEPLIBS1 = $(LIBLIC)
X SYSLIBS1 =
X PROGRAM1 = WhiteNoise
X
X SRCS2 = BasketWeave.c
X OBJS2 = BasketWeave.o
X DEPLIBS2 =
X SYSLIBS2 =
X PROGRAM2 = BasketWeave
X
X SRCS3 = CircleField.c
X OBJS3 = CircleField.o
X DEPLIBS3 =
X SYSLIBS3 =
X PROGRAM3 = CircleField
X
X SRCS4 = SpiralField.c
X OBJS4 = SpiralField.o
X DEPLIBS4 =
X SYSLIBS4 =
X PROGRAM4 = SpiralField
X
X SRCS5 = ElectroStatic.c
X OBJS5 = ElectroStatic.o
X DEPLIBS5 =
X SYSLIBS5 = -lm
X PROGRAM5 = ElectroStatic
X
X ALL = $(PROGRAM1) $(PROGRAM2) $(PROGRAM3) $(PROGRAM4) $(PROGRAM5)
X
Xall: $(ALL)
X
Xincludes:
X
X$(PROGRAM1): $(OBJS1) $(DEPLIBS1)
X $(CC) $(CFLAGS) -o $(PROGRAM1) $(OBJS1) $(DEPLIBS1) $(SYSLIBS1)
X
X$(PROGRAM2): $(OBJS2) $(DEPLIBS2)
X $(CC) $(CFLAGS) -o $(PROGRAM2) $(OBJS2) $(DEPLIBS2) $(SYSLIBS2)
X
X$(PROGRAM3): $(OBJS3) $(DEPLIBS3)
X $(CC) $(CFLAGS) -o $(PROGRAM3) $(OBJS3) $(DEPLIBS3) $(SYSLIBS3)
X
X$(PROGRAM4): $(OBJS4) $(DEPLIBS4)
X $(CC) $(CFLAGS) -o $(PROGRAM4) $(OBJS4) $(DEPLIBS4) $(SYSLIBS4)
X
X$(PROGRAM5): $(OBJS5) $(DEPLIBS5)
X $(CC) $(CFLAGS) -o $(PROGRAM5) $(OBJS5) $(DEPLIBS5) $(SYSLIBS5)
X
Xtest: $(ALL)
X rm -f noise.out weave.out lic.out
X ./WhiteNoise noise.out 256 256
X ./BasketWeave weave.out 256 256 8 8
X $(TOP)/lic/lic -v -x 256 -y 256 -N -n fixed noise.out weave.out lic.out
X
Xinstall:
X
Xclean:
X rm -f $(PROGRAM1) $(OBJS1)
X rm -f $(PROGRAM2) $(OBJS2)
X rm -f $(PROGRAM3) $(OBJS3)
X rm -f $(PROGRAM4) $(OBJS4)
X rm -f $(PROGRAM5) $(OBJS5)
X rm -f noise.out weave.out lic.out
X rm -f *~ *.o core a.out MAKELOG
X
Xlint:
X
Xdepend:
X
XWhiteNoise.o: WhiteNoise.c $(BUILDINCTOP)/lic.h
XBasketWeave.o: BasketWeave.c
XCircleField.o: CircleField.c
XSpiralField.o: SpiralField.c
XElectroStatic.o: ElectroStatic.c
END_OF_FILE
if test 1993 -ne `wc -c <'lic.1.2/test/Makefile.tmpl'`; then
echo shar: \"'lic.1.2/test/Makefile.tmpl'\" unpacked with wrong size!
fi
# end of 'lic.1.2/test/Makefile.tmpl'
fi
if test -f 'lic.1.2/test/SpiralField.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/test/SpiralField.c'\"
else
echo shar: Extracting \"'lic.1.2/test/SpiralField.c'\" \(5342 characters\)
sed "s/^X//" >'lic.1.2/test/SpiralField.c' <<'END_OF_FILE'
X/*
X * $Header: /d/sisal/a/casey/tmp/lic/test/RCS/SpiralField.c,v 1.3 1993/08/10 17:20:01 casey Exp $
X */
X
X/*
X * Copyright (c) 1993 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by the University of
X * California, Lawrence Livermore National Laboratory and its
X * contributors.
X * 4. Neither the name of the University nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
X static char rcsid[] = "$Header: /d/sisal/a/casey/tmp/lic/test/RCS/SpiralField.c,v 1.3 1993/08/10 17:20:01 casey Exp $";
X static char copyright[] =
X "Copyright (c) 1993 The Regents of the University of California.\n"
X "All rights reserved.\n";
X#endif
X
X
X#include <stdlib.h>
X#include <unistd.h>
X#include <errno.h>
X#include <fcntl.h>
X#include <string.h>
X#include <stdio.h>
X
X
X/*
X * Create a three-dimensional floating point spiral vector field. Each
X * vector will point 90 degrees, clockwise, away from the vertical (Z)
X * center of the field and slightly up: v(x, y, z) = (x, -y, 0.1). Note
X * that the vector magnitudes are *not* equal to 1.0.
X */
X
X
X#ifdef NEED_EXIT_CODES
X /*
X * EXIT_SUCCESS and EXIT_FAILURE are supposed to be defined in <stdlib.h>
X * according to the ANSI C X3.159-1989 specification, but Sun OS 4.1.1
X * fails to define them ...
X */
X# define EXIT_SUCCESS 0
X# define EXIT_FAILURE 1
X#endif
X
X
X#ifdef NEED_STRERROR
X /*
X * strerror is supposed to be defined in <string.h> and supplied in the
X * standard C library according to the ANSI C X3.159-1989 specification,
X * but Sun OS 4.1.1 fails to define or supply it ... Unfortunately the
X * only way we can control this is with an externally supplied define.
X */
X extern int errno; /* system error number */
X extern char *sys_errlist[]; /* system error messages */
X extern int sys_nerr; /* number of entries in sys_errlist */
X
X char *
X strerror(int err)
X {
X if (err < 0 || err >= sys_nerr) {
X static char msg[100];
X
X sprintf(msg, "system error number %d", err);
X return(msg);
X }
X return(sys_errlist[err]);
X }
X#endif
X
X
Xmain(int argc, char *argv[])
X{
X char *myname;
X char *file;
X int Xres, Yres, Zres;
X float *VectorField;
X register float fx, fy;
X register int i, j, k;
X int fd, cc;
X
X myname = argv[0];
X if (argc != 5)
X {
X (void)fprintf(stderr, "usage: %s file-name x-res y-res z-res\n",
X myname);
X exit(EXIT_FAILURE);
X }
X
X /* grab arguments */
X file = argv[1];
X Xres = atoi(argv[2]);
X Yres = atoi(argv[3]);
X Zres = atoi(argv[4]);
X
X VectorField = (float *)malloc(sizeof(float)*Yres*Xres*Zres*3);
X if (VectorField == NULL)
X {
X (void)fprintf(stderr, "%s: insufficient memory for creating the spiral"
X " field\n", myname);
X exit(EXIT_FAILURE);
X }
X
X for ( k = 0; k < Yres; k++ )
X {
X for ( j = 0; j < Yres; j++ )
X {
X fy = (float)j/(float)(Yres-1) - 0.5;
X for ( i = 0; i < Xres; i++ )
X {
X fx = (float)i/(float)(Xres-1) - 0.5;
X VectorField[3*(k*Xres*Yres + (Yres - j)*Xres + i) + 0] = fy;
X VectorField[3*(k*Xres*Yres + (Yres - j)*Xres + i) + 1] = -fx;
X VectorField[3*(k*Xres*Yres + (Yres - j)*Xres + i) + 2] = 0.1;
X }
X }
X }
X
X fd = open(file, O_CREAT|O_WRONLY, 0666);
X if (fd < 0)
X {
X (void)fprintf(stderr, "%s: unable to open %s: %s\n", myname, file,
X strerror(errno));
X exit(EXIT_FAILURE);
X }
X
X cc = write(fd, VectorField, 3*sizeof(float)*Xres*Yres*Zres);
X if (cc != 2*sizeof(float)*Xres*Yres)
X {
X (void)fprintf(stderr, "%s: write returned short: %s\n", myname,
X strerror(errno));
X (void)close(fd);
X exit(EXIT_FAILURE);
X }
X (void)close(fd);
X exit(EXIT_SUCCESS);
X}
END_OF_FILE
if test 5342 -ne `wc -c <'lic.1.2/test/SpiralField.c'`; then
echo shar: \"'lic.1.2/test/SpiralField.c'\" unpacked with wrong size!
fi
# end of 'lic.1.2/test/SpiralField.c'
fi
if test -f 'lic.1.2/test/WhiteNoise.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lic.1.2/test/WhiteNoise.c'\"
else
echo shar: Extracting \"'lic.1.2/test/WhiteNoise.c'\" \(4914 characters\)
sed "s/^X//" >'lic.1.2/test/WhiteNoise.c' <<'END_OF_FILE'
X/*
X * $Header: /d/sisal/a/casey/tmp/lic/test/RCS/WhiteNoise.c,v 1.5 1993/08/11 01:51:12 casey Exp $
X */
X
X/*
X * Copyright (c) 1993 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X * notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X * notice, this list of conditions and the following disclaimer in the
X * documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X * must display the following acknowledgement:
X * This product includes software developed by the University of
X * California, Lawrence Livermore National Laboratory and its
X * contributors.
X * 4. Neither the name of the University nor the names of its contributors
X * may be used to endorse or promote products derived from this software
X * without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
X static char rcsid[] = "$Header: /d/sisal/a/casey/tmp/lic/test/RCS/WhiteNoise.c,v 1.5 1993/08/11 01:51:12 casey Exp $";
X static char copyright[] =
X "Copyright (c) 1993 The Regents of the University of California.\n"
X "All rights reserved.\n";
X#endif
X
X
X#include <stdlib.h>
X#include <unistd.h>
X#include <errno.h>
X#include <fcntl.h>
X#include <string.h>
X#include <stdio.h>
X#include <sys/types.h>
X
X#include <lic.h>
X
X
X/*
X * Create a simple white noise image.
X */
X
X
X#ifdef NEED_EXIT_CODES
X /*
X * EXIT_SUCCESS and EXIT_FAILURE are supposed to be defined in <stdlib.h>
X * according to the ANSI C X3.159-1989 specification, but Sun OS 4.1.1
X * fails to define them ...
X */
X# define EXIT_SUCCESS 0
X# define EXIT_FAILURE 1
X#endif
X
X
X#ifdef NEED_STRERROR
X /*
X * strerror is supposed to be defined in <string.h> and supplied in the
X * standard C library according to the ANSI C X3.159-1989 specification,
X * but Sun OS 4.1.1 fails to define or supply it ... Unfortunately the
X * only way we can control this is with an externally supplied define.
X */
X extern int errno; /* system error number */
X extern char *sys_errlist[]; /* system error messages */
X extern int sys_nerr; /* number of entries in sys_errlist */
X
X char *
X strerror(int err)
X {
X if (err < 0 || err >= sys_nerr) {
X static char msg[100];
X
X sprintf(msg, "system error number %d", err);
X return(msg);
X }
X return(sys_errlist[err]);
X }
X#endif
X
X
Xmain(int argc, char *argv[])
X{
X char *myname;
X char *file;
X int Xres, Yres;
X unsigned char *Noise;
X size_t pixel, scanline;
X register int i, j;
X int fd, cc;
X
X myname = argv[0];
X if (argc != 4)
X {
X (void)fprintf(stderr, "usage: %s file_name x_res y_res\n", myname);
X exit(EXIT_FAILURE);
X }
X
X /* grab arguments */
X file = argv[1];
X Xres = atoi(argv[2]);
X Yres = atoi(argv[3]);
X
X pixel = LIC_ConfiguredPixelSize();
X scanline = sizeof(unsigned char) * pixel * Xres;
X
X Noise = (unsigned char *)malloc(scanline);
X if (Noise == NULL)
X {
X (void)fprintf(stderr, "%s: insufficient memory for creating the noise"
X " field\n", myname);
X exit(EXIT_FAILURE);
X }
X
X srand(98639); /* Seed with a prime number */
X
X fd = open(file, O_CREAT|O_WRONLY, 0666);
X if (fd < 0)
X {
X (void)fprintf(stderr, "%s: unable to open %s: %s\n", myname, file,
X strerror(errno));
X exit(EXIT_FAILURE);
X }
X
X for (j = 0; j < Yres; j++)
X {
X for (i = 0; i < Xres; i++)
X {
X int p, r;
X
X r = rand() & 255;
X for (p = 0; p < pixel; p++)
X Noise[i*pixel + p] = r;
X }
X
X cc = write(fd, Noise, scanline);
X if (cc != scanline)
X {
X (void)fprintf(stderr, "%s: write returned short: %s\n", myname,
X strerror(errno));
X (void)close(fd);
X exit(EXIT_FAILURE);
X }
X }
X
X (void)close(fd);
X exit(EXIT_SUCCESS);
X}
END_OF_FILE
if test 4914 -ne `wc -c <'lic.1.2/test/WhiteNoise.c'`; then
echo shar: \"'lic.1.2/test/WhiteNoise.c'\" unpacked with wrong size!
fi
# end of 'lic.1.2/test/WhiteNoise.c'
fi
echo shar: End of archive 9 \(of 10\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 10 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...