Jcalcomp:Calcomp Simulator in Java
Preface
-
"Jcalcomp" simulator is developed mainly for Calcomp plotter users. It
is composed with class libraries which have common methods with subroutines
and/or functions in the flat bed pen plotter, which has been used as a
graphical output device from the main-frame age. Many potential programmers
used to make their own codes for Calcomp plotter.
-
Facilities for Calcomp plottter are extended to Java graphical environmrnt
here. Then, all functions are implemented methods in class libraries. The
features of this class library are 1) interactivity(controlled by scroll
bar or radio button on a browser), 2) perspective/isometric projective
view and its animation, 3) ray tracing 4) contour plotting, and 5) original
vector fonts for ASCII character sets which can be applied by users to
their superset. The style of code seems to be classic but understandable
for beginners.
The language
-
The language applied for this simulator is Java. The reasons of this application
are 1) compact load module, 2) friendly interface of Web documents, 3)
portability, and 4) good advantage in graphical interface. Java is, of
course, one of Object Oriented Languages, and programming in Java need
some pieces of knowledge for this subject. However, this simulator provide
a kind of template and will be understandable for C/FORTRAN programmer.
This means that a lot of graphic codes for Calcomp plotter in archives
can get their role in Web contents. Also, senior programmers can make their
graphic code in Java and give advise to younger programmer in this field.
-
There are many textbook for OOPS, in which B. Meyer's work is very instructive.
Class and Method
-
In this version, the class library is not clearly separated with user code
, and is supplied as a source library, which means that users can make
their own class library by the source code.
-
Following descriptions, therefore, are tentative until version 1.0.
Coordinate system
-
This class library applies three types of coordinates, which is well known
for graphic programmer and, of course, for Calcomp programmer.
1) Screen coordinates
-
Screen monitor coordinates corresponds to pixcel-wise bitmap picture. The
origin is specified by its launching browser/viewer, and usually the left-up
corner in the browser/viewer is default. The increment of coordinate is
then integer number.
2) World coordinates
-
World coordinates is an user's section paper. Users can fit it to the screen
coordinate by specification of two point, which are (x,y) coodinates of
left-up and right-down corner of section paper corresponding the screen
coordinate. Our mathematical coordinate system has oppisite direnction
to the screen y-coordinate(vertical), which are considered in this library.
Users can use their section paper normally.
-
3D coordinte is used in this library for perspective or isometric projection.
Then the world coordinate is used in projection viewing. The 3D users view
objects through this section paper.
3) User's coordinates
-
The user's coordinate is graduation in the section paper written by them.
-
The graduation is usually applied for curve plotting of some functions
and representations of experimetal result. Then this coordinates is only
for curve plotting. Users can draw their curve by methods of "lline" and
"lgline". The former is for linear plotting and the latter is for logarithm
scale. Both have own axis presentation methods "axis" and "lgaxis".
-
In 3D viewing of curve plotting, however, the user's coordinate is not
applied. It is because that if 3D viewing has user's coordinate system,
the projection plane( section paper) has to make new coordinate system
corrresponding to 3D user's coordinate system. While this conversion is
not difficult for the computer, conversion of user's own coordinate to
world coordinates is more comprehensive for the user. This means user have
to caculate the coordinates without graduation in the section paper. In
spite of this, there are two 3D axis plotting method, which are "paxis"
and "plgaxis".
-
They are corresponding to "axis" and "lgaxis" in 2D, respectively.
Class and Method description
Jcalcomp
Syntax
public abstract class Jcalcomp
Description
This Jcalcomp class is basic engineering drawing tool by usage
of Graphics. It provides user's riginal coordinates, contour line
graph and 3D graph.
Jcalcomp is extended from Applet class and user should make
thier own class extended from Jcalcomp.
This class is named after Calcomp plotter library, which has been used
as a flatbet plotter library in FORTRAN library.
MEMBER SUMMARY
Constructors & Destructors
Calcomp() Construct
a new Calcomp simulator area
Basic 2D Drawing Methods
u_plot() Basic
plotting method
symbol() draw ASCII
character in vector font
number() draw double
number in arbitrary format
marker() draw plotting
symbol, whose identification point is its center
2D Function Drawing Methods
axis()
draw linear axis in world coordinates
lgaxis() draw logarithm
axis in world coordinates
lline()
draw 2D line in user's coordinates by linear scale
lgline()
draw 2D logarithm line in user's coordinate by log/log, log/linear,
and linear/log for x/y.
scale()
output converting factor from user's linear coordinates to world ones.
lgscale() output converting
factor from user's linear coordinates to world ones.
2D Contour Line Drawing Methods
3D Drawing Methods
bprep()
pplot()
psymbol()
pnumber()
paxis()
plgaxis()
3D Contour Line Drawing Methods
void Jcalcomp()
PURPOSE
: Construct a new Calcomp simulator area
SYNTAX :
Jcalcomp(int igx0,int igy0,int
igx1,int igy1,double gx0,double gy0,double wid,double hei,int iback,int
ibord)
Jcalcomp(int igx0,int igy0,int igx1,int
igy1,double gx0,double gy0,double wid,double hei,int iback,int ibord)
DESCRIPTION :
Fix 2 points specified by left-up and right down corners.
Corresponding world coordinate system is developed.
PARAMETERS :
int igx0,int igy0,int igx1,int igy1,double
gx0,double gy0,double wid,double hei,int iback,int ibord
RETURNS : none
SEEALSO :
EXAMPLE :
void u_plot()
PURPOSE : 2D Plotting in User's Coordinates
SYNTAX : plot(Graphics g,double x,double
y,int n)
DESCRIPTION : Fix 2 points specified by
left-up and right down corners. Corresponding world coordinate system is
developed.
PARAMETERS :
Graphics g:
double x:
double y:
int n:
RETURNS : none
SEEALSO :
EXAMPLE :
void symbol()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void number()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void marker()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS : x,y,n
RETURNS :
SEEALSO :
EXAMPLE :
void newpen()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void axis()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
x0,y0,d,t,theta,title,n,m,md,sm,smd
RETURNS :
SEEALSO :
EXAMPLE :
void lgaxis()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
x0,y0,t,theta,isep,title,n,m
RETURNS :
SEEALSO :
EXAMPLE :
void lline()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void lgline()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
xp , yp , x , y , nn , ils , isym
RETURNS :
SEEALSO :
EXAMPLE :
void lstyle()
PURPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void scale()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
x,n,dx
RETURNS :
SEEALSO :
EXAMPLE :
void lgscal()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void wcircle()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void wpieslice()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void wlattice()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void box_plt()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void mshplt()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
mod,frm,x,y,flg,m,n,xdim,ydim,fdim,wid,hei
RETURNS :
SEEALSO :
EXAMPLE :
void fmxmn()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
flg,f,m,n,lvl,fdim,vdim,setlvl
RETURNS :
SEEALSO :
EXAMPLE :
void contor()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
mod,title,x,y,f,flg,setlvl,stclr,stlsy,lvl,m,n, xdim,ydim,vdim,fdim,wid,hei
RETURNS :
SEEALSO :
EXAMPLE :
int find()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void bprep()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
ang,idf,h1d,h2d,h3d,phaid,psaid,cvdd,x,y,z
RETURNS :
SEEALSO :
EXAMPLE :
void pplot()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void prect()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void phline()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :
void pcontor()
URPOSE :
SYNTAX :
DESCRIPTION :
PARAMETERS :
RETURNS :
SEEALSO :
EXAMPLE :