Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CI4810/6810 Spring 2021 Assignment: Program 3 (30 points) Due Date: March 11, 2021 – Thursday – 11:59pm The whole purpose of this assignment is for you to implement a program that given a graphics...

1 answer below »
CI4810/6810
Spring 2021
Assignment: Program 3 (30 points)
Due Date: March 11, 2021 – Thursday – 11:59pm
The whole purpose of this assignment is for you to implement a program that given a graphics
image made up of lines, your program can demonstrate that it can Translate, Scale, Rotate, … the
image (using the matrix representations of the transformations). You should build a simple user-
interface that receives commands from the user, … The following functions are my suggestions
– but I am sure that you are more creative than I am; therefore, use your own program design if
you wish. Assume that the main purpose of writing this program is for you to build a simple
graphics program that you can use to demonstrate to an individual (CEO of a company, manager
of a corporation, …) that your program can perform geometric operations. Thus, what appears
elow (in terms of functions, …) are only suggestions.
Implement each of the following functions:
• Inputlines ( datalines, num )
{ Reads ‘datalines’ from an external file (name of file is provided by the user). On
eturn `num' will contain the number of lines read from the file. }
• ApplyTransformation (matrix, datalines)
{applies the transformation matrix to the lines that appear in “datalines”}
• Displaypixels ( datalines, num, VPx1, VPx2, VPy1, VPy2 )
{ Displays (i.e., scan-converts) ‘datalines’ containing `num' lines – it displays only the
lines and/or line segments that are visible in the ViewPort defined by VPx1, VPx2, VPy1,
VPy2; thus, this function would perform 2D line clipping and then scan-converts only the
entities that are visible. }
• Outputlines ( datalines, num )
{ Outputs ‘datalines’ containing `num' lines to an external file (name of file is provided
by the user). }
• BasicTranslate ( Tx , Ty )
{ Translation - `Tx' is the horizontal and `Ty' is the vertical displacements. }
• BasicScale ( Sx, Sy )
{ Scale - `Sx' and `Sy' are the horizontal and vertical scaling factors;
center of scale is at the origin of the Coordinate System. }
• BasicRotate ( angle )
{ Rotation - angle of rotation is `angle' degrees (clockwise); Center of rotation is at
the origin of the Coordinate System. }
• Scale ( Sx, Sy, Cx, Cy)
{ Scale - `Sx' and `Sy' are the horizontal and vertical scaling factors; center of scale is at
Cx, Cy. }
• Rotate ( angle, Cx, Cy )
{ Rotation - angle of rotation is `angle' degrees (clockwise); Center of rotation is at
Cx, Cy. }
Embed the suggested functions above (together with other functions that may be needed) into a
complete program to build a simple graphics system.
Notes:
o Build a suitable user-interface so that the functionality of your program can easily be
demonstrated.
o Your program must be well structured/engineered.
o There are many program codes available on the web for 2D line clipping (Cohen-
Sutherland Algorithm). Feel free to use the code that is available on the web – you would
need to embed such codes into your program. Make sure that you add comments to the
source program for code-segments that you bo
owed/copied from then web.
o The ONLY built-in drawing function you are permitted to use is the function that when
called would activate a pixel on the display monitor.
o Use the matrix representation of the transformations.
o Concatenation must be done during execution time.

2 4 6 8
1 3 5 7
XXXXXXXXXX
1 2 3 4
Answered 5 days After Mar 07, 2021

Solution

Ria answered on Mar 13 2021
162 Votes
Transformation/.idea/.gitignore
# Default ignored files
shelf
workspace.xml
# Datasource local storage ignored files
dataSources
dataSources.local.xml
# Editor-based HTTP Client requests
httpRequests
Transformation/.idea/.name
Transformation.iml
Transformation/.idea/misc.xml




Transformation/.idea/modules.xml






Transformation/.idea/workspace.xml

















































1614561094503


1614561094503



















Transformation/out/production/Transformation/data.txt
2 4 6 8
1 3 5 7
3 6 9 12
1 2 3 4
Transformation/src/data.txt
2 4 6 8
1 3 5 7
3 6 9 12
1 2 3...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here