This is the README for ContourPlot.1.4.NIHS.bs.tar.gz [Download] [Browse] [Up]
ContourPlot.app
Contour Plot object and application with color fills.
OS requirement: Release 3.0 or later.
Version: V1.01 93-01-25
[Archive Maintainer, please put this into the 3.0 Source Code directory.]
-------------------------------------------------------------------------------------
ContourPlot.app demonstrates the use of object class ContourView, but
at the same time it tries to be a usable application for generating
contour plots WITH COLOR FILLS from 2-dimensional grid data.
While I have seen many contour plot routines and programs that produce
contour lines in color, I could not find any that could FILL regions
inside contour paths. Hence, the ContourView class and this application.
It can only handle 2-D data on a regularly spaced Cartesian grid.
ContourPlot reads 2-D grid data files in a simple ASCII format which
may be generated easily by other programs. See the Info/Help Panel
and a sample data file for details of the file format.
* Press File -> Open Sample File on the menu for a demo plot.
* Press File -> View Sample File on the menu to look at the data
file that generates the demo plot.
Plots may be copied to the pasteboard as EPS (Encapsulated PostScript)
by clicking the plot area once and pressing Edit -> Copy on the menu.
Then, the plot may be pasted into documents that accept PostScript
data, such as NeXTMail Compose window (In NeXTMail mode), Edit document
(in RTF mode), ohter drawing/layout apps.
To save to an EPS file, first paste into a Yap (or my BBFig)
(/NextDeveloper/Apps/Yap.app) document, then save from Yap.
From ContourView README.
-------------------------------------------------------------------------------------
Distinguishing features of this ContourView class are:
[1] It does color fills within contours just like colored geological maps.
As far as I am aware, this is the only public domain source code that can
do this for PostScript, not as bitmaps. (Let me know if you know of
any other PD code that does color-filled contour plots.)
[2] It is a pretty self contained object in the form of a View subclass.
[3] PostScript may be copied onto pasteboard and pasted into other apps that
accept EPS data. Try pasting it into Yap document, NeXTmail compose
window, Edit RTFD document, etc.
There is really no documentation. Look at the class implementation file
ContourView.m and an example test application ContourPlotApp.m for usage
information. The app included here is just for testing ContourView
class. ContourView is meant to be included in your apps like any other
objects.
It is pretty easy to use. If instantiated within IB, all you need to do
to get a plot is to call the following two method to get a default
plot. If you understand the following method, you can use the
ContourView object easily.
- setCartesianGridData:(float *)f :(float)xmin :(float)xmax
:(float)ymin :(float)ymax
ofSize:(int)nx :(int)ny
withInterpolationTo:(int)n1x :(int)n1y;
f[nx*ny] is a 1-d array containing 2-d grid data such that f[iy*nx+ix]
contains the value at (ix, iy).
Typicall, just 3 messages below will produce a contour plot with color
fills.
[contourView setCartesianGridData: fdata :1.0 :5.0 :1.0 :5.0
ofSize: 20 :20
withInterpolationTo: 50 :50];
[contourView setFillEnable:YES];
[contourView display];
-------------------------------------------------------------------------------
TO USE:
ContourView class consists of the following modules/files. Other files are
the glue needed for the test application ContourPlot.app. When incorporating
ContourView into your app, you need to copy only the follwoing to your
project directory:
ContourView.h
ContourView.m (Class implementation)
computeContour.m (contour path computation engine)
contour.h
sortContour.c (sorting of contour path based on inclusion relation)
splin2.c (bicubic spiline: ## This file is NOT INCLUDED, see below)
splin2.h
-------------------------------------------------------------------------------
TO COMPILE:
When all the files are ready, you can type build the whole application from
the ProjectBuilder application, or typing "make" from Terminal in this
directory. Unfortunately, before you can do that, you must obtain several
files from the disk for the book "Numerical Recipes in C".
Because the authors of the book "Numerical Recipes in C - The Art of
Scientific Computing" does not allow source distribution of their routines,
I cannot distribute splin2.c which is necessary for ContourView. However,
you can create my version of splin2.c using the "patch" program and applying
the patch to the original files.
[The restrictions stink, but I guess I have to be legal even if the rules
are virtually unenforceable.]
Here's how:
[1] Obtain the following files from "Numerical Recipes in C" disk, and
store them into the subdirectory ./NumRec
splin2.c splie2.c splint.c spline.c nrutil.c
These files should be obtained, if possible, from the 1-st edition's disk.
I do not know if these files have changed from the 1-st to the 2-nd edition.
[2] Rename them to *.c.orig, so you will have the following files in NumRec
splin2.c.orig splie2.c.orig splint.c.orig spline.c.orig nrutil.c.orig
in addition to MakeNR.sh and NRpatch.
[3] Type "MakeNR.sh" from Terminal in NumRec directory.
This creates the file splin2NEW.c.
[4] Copy splin2NEW.c into the source directory as splin2.c
[5] Build the application ContourPlot.
## NOTE: If you do not have the program "patch", you should get it. If
you don't want to mess with sources, executable for NeXT is available
from "sutro.sfsu.edu" [130.212.15.230] as /pub/patch.Z via anonymous FTP.
## NOTE2: Be aware that there is a bug in the splin2.c in the book (both
1-st and 2-nd editions and on the disk). The patch fixes it.
-------------------------------------------------------------------------------
This can use a lot more optimizations which should speed up the drawing
significantly. Some of these are:
[1] All parameter changes currently trigger recomputation of all contour paths,
because almost everything is done in drawSelf:: method.
This should not be necessary for some. E.g., changing fill colors, line
width etc should not cause recomputation of contour paths.
[2] Use DoUserPath() etc to optimize drawing.
[3] Some methods are not yet implemented (It does what I wanted now).
-------------------------------------------------------------------------------
Send comments, bug reports, suggestions and improvements to below:
---
Izumi Ohzawa, Ph.D. [ 大澤五住 ]
USMail: University of California, 360 Minor Hall, Berkeley, CA 94720
Telephone: (510) 642-6440 Fax: (510) 642-3323
Internet: izumi@pinoko.berkeley.edu (NeXT Mail OK)
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.