/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1989 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <math.h>
extern int hpos;
extern int vpos;
extern int size;
extern short *pstab;
extern int DX; /* step size in x */
extern int DY; /* step size in y */
extern int drawdot; /* character to use when drawing */
extern int drawsize; /* shrink point size by this facter */
#define abs(n) ((n) >= 0 ? (n) : -(n))
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
int
char *s;
{
int i, numdots;
float incrway;
if (xd == 0) {
for (i = 0; i < numdots; i++) {
}
return (0);
}
if (yd == 0) {
for (i = 0; i < numdots; i++) {
}
return (0);
}
dirmot = 'h';
perp = 'v';
}
else {
dirmot = 'v';
perp = 'h';
}
for (i = 0; i < numdots; i++) {
if (dirmot == 'h')
else
if (perp == 'h')
else
}
}
return (0);
}
int
char *s;
{
int i, j, numdots, N;
p = s;
}
x[0] = x[1] = hpos;
y[0] = y[1] = vpos;
for (i = 1; i < N; i++) {
x[i+1] += x[i];
y[i+1] += y[i];
}
x[N] = x[N-1];
y[N] = y[N-1];
for (i = 0; i < N-1; i++) { /* interval */
for (j = 0; j < numdots; j++) { /* points within */
w = (float) j / numdots;
t1 = 0.5 * w * w;
w = w - 0.5;
t2 = 0.75 - w * w;
w = w - 0.5;
t3 = 0.5 * w * w;
}
}
}
return (0);
}
char *p, *temp;
{
while (*p == ' ' || *p == '\t' || *p == '\n')
p++;
if (*p == '\0') {
temp[0] = 0;
return(NULL);
}
while (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\0')
*temp++ = *p++;
*temp = '\0';
return(p);
}
int
drawcirc(d)
{
return (0);
}
int
{
}
int
{
return (0);
}
int
drawellip(a, b)
{
return (0);
}
#define sqr(x) (long int)(x)*(x)
int
{
/* based on Bresenham, CACM, Feb 77, pp 102-3 */
/* by Chris Van Wyk */
/* capitalized vars are an internal reference frame */
long dotcount = 0;
long delta;
if (a != b) /* an arc of an ellipse; internally, will still think of circle */
if (a > b) {
xstep = (float)a / b;
ystep = 1;
radius = b;
} else {
xstep = 1;
ystep = (float)b / a;
radius = a;
}
else { /* a circular arc; radius is computed from center and first point */
}
/* now, use start and end point locations to figure out
the angle at which start and end happen; use these
angles with known radius to figure out where start
and end should be
*/
slope = 3.14159265;
slope = 3.14159265;
/* step 2: translate to zero-centered circle */
/* step 3: normalize to first quadrant */
if (xs < 0)
if (ys < 0) {
qs = 3;
M1x = 0;
M1y = -1;
M2x = 1;
M2y = -1;
M3x = 1;
M3y = 0;
} else {
qs = 2;
M1x = -1;
M1y = 0;
M2x = -1;
M2y = -1;
M3x = 0;
M3y = -1;
}
else if (ys < 0) {
qs = 0;
M1x = 1;
M1y = 0;
M2x = 1;
M2y = 1;
M3x = 0;
M3y = 1;
} else {
qs = 1;
M1x = 0;
M1y = 1;
M2x = -1;
M2y = 1;
M3x = -1;
M3y = 0;
}
if (xt < 0)
if (yt < 0) {
qt = 3;
} else {
qt = 2;
}
else if (yt < 0) {
qt = 0;
} else {
qt = 1;
}
/* step 4: calculate number of quadrant crossings */
% 4 == 0)
)
Q = 3;
else
/* step 5: calculate initial decision difference */
/* here begins the work of drawing
we hope it ends here too */
while ((Q >= 0)
|| ((Q > -2)
)
)
) {
if (Yc < 0.5) {
/* reinitialize */
Q--;
{
int T;
T = M2y;
M2x = -T;
T = M3y;
M3x = -T;
}
} else {
if (delta <= 0)
move = 1;
else
move = 2;
move = 2;
else
move = 3;
switch (move) {
case 1:
Xc++;
break;
case 2:
Xc++;
Yc--;
break;
case 3:
Yc--;
break;
}
}
}
return (0);
}
int
putdot(x, y)
{
arcmove(x, y);
return (0);
}