Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

#include<iostream.

h>

#include<conio.h>

#include<stdio.h>

#include<graphics.h>

#include<alloc.h>

#include<stdlib.h>

#include<math.h>

#include<dos.h>

int gd=0,gm;

class axes

{private:

int xmx,ymx,yst,xst,zmx,zst;

float xsc,ysc,xstep,ystep,zsc,zstep;

public:

axes();

void display();

int actx(int tmx,int tmy,int tmz)

{ return 320+((xsc*tmx)-(zsc*tmz/2))+tmx-tmy;

int acty(int tmx,int tmy,int tmz)

{return 255-((ysc*tmy)-(zsc*tmz/2))+tmy-tmx;

c1;

axes::axes()
{xmx=280;

ymx=200;

zmx=400;

xsc=280.0/xmx;

xstep=10.0*xmx/280.0;

xst=ceil(xstep);

ysc=200.0/ymx;

ystep=10.0*ymx/200.0;

yst=ceil(ystep);

zsc=400.0/zmx;

zstep=10.0*zmx/400,0;

zst=ceil(zstep);

void axes::display()

{setcolor(CYAN);

line(25,255,615,255);

line(320,25,320,455);

line(actx(0,0,zmx),acty(0,0,zmx),actx(0,0,-zmx),acty(0,0,-zmx));

outtextxy(325,255,"0");

settextstyle(3,0,1);

outtextxy(620,249,"X");

outtextxy(323,20,"Y");

outtextxy(actx(0,0,zmx)+3,acty(0,0,zmx)+3,"Z");

settextstyle(0,0,0);

}
main()

{ initgraph(&gd,&gm,"c:\\tc\\bgi");

cleardevice();

c1.display();

getch();

return 0;

You might also like