In: Computer Science
Write C++ mathematics program that a Given an arc with its center at zero, and the arc should be user defined in 3D-space by means of a 3x3 transformation matrix, and a radius, start-angle and sweep-angle should be user defined. it gives output/tells the most extreme XY points that arc goes to
The radius,start angle and sweep angle should be user defined.
make the code quickly and send me
sir the matrix should always be 3x3 center is at zero
initially
and raduis,start angle and sweep angle should be user defined
The program should
calculate extreme points values of arc
initially assume any assumptions if u don't find sufficient info
kindly solve and send me
In this program , I have used the arc() function in the graphics
library to generate the arc which accepts following
parameters:
arc(x,y,start,end,radius)
Where: x,y are coordinates of the centre
start is the staring angle of the arc
end is the ending angle of the arc
radius is the radius of the arc
Rest all explanations are there in the code itself as comments, wherever required.
CODE:
#include<bits/stdc++.h>
#include <graphics.h>
using namespace std;
int main()
{
// gm is Graphics mode which is a computer display mode that
generates image using pixels.
// DETECT is a macro defined in "graphics.h" header file
int gd = DETECT, gm;
float x,y;
float start,end;
float radius;
// Getting input for the location of the arc from user
cout<<"Enter the starting point of the
arc.\n";
cin>>x>>y;
// Getting input the start and end angle from user
cout<<"Enter the staring and end
angle.\n";
cin>>start>>end;
// Getting the radius of the arc as input
cout<<"Enter the radius of the arc.\n";
cin>>radius;
// The initgraph function initializes the graphics system by loading a graphics driver from disk
initgraph(&gd, &gm, "");
// Calling the arc function to generate the arc
arc(x, y, start, end, radius);
// This closegraph function closes the graphics mode and
deallocates all memory allocated by graphics system
closegraph();
return 0;
}
Hope it helps you.
Please provide a review if you find it helpful.
Thanks! :)