<< Chapter < Page Chapter >> Page >

The program named GM01test02

Because I made some changes to the existing 2D classes in the game-math library and added some new methods to some of the existing 2D classes, I feltthe need to write a program that would step through and test the behavior of most of the 2D methods in the library. That was the purpose of the programnamed GM01test02 .

This program produces both a graphic screen output and lots of text on the command-line screen. The graphic output is shown in Figure 2 .

Figure 2 Graphics output from the program named GM01test02.

Missing image.

Command-line output from the program named GM01test02

The command-line output is shown in Figure 3 .

Figure 3 . Command-line output from the program named GM01test02.

Test overridden toString of ColMatrix2D 1.5,2.5Test setData and getData of ColMatrix2D 4.55.5 Test equals method of ColMatrix2Dfalse trueTest add method of ColMatrix2D 9.0,11.0Test subtract method of ColMatrix2D 0.0,0.0Test toString method of Point2D 4.5,5.5Test setData and getData of Point2D 1.12.2 Test getColMatrix method of Point2D1.1,2.2 Test equals method of Point2Dfalse trueTest getDisplacementVector method of Point2D 1.5,2.54.5,5.5 3.0,3.0Test addVectorToPoint method of Point2D 1.5,2.57.0,9.0 Test toString method of Vector2D1.5,2.5 Test setData and getData methods of Vector2D4.5 5.5Test getColMatrix method of Vector2D 4.5,5.5Test equals method of Vector2D falsetrue Test add method of Vector2D4.5,5.5 -1.5,3.53.0,9.0 Test getLength method of Vector2D3.0,4.0 5.0Test toString method of Line2D Tail = 1.5,2.5Head = 4.5,5.5 Test setTail, setHead, getTail,and getHead methods of Line2D 4.5,5.51.5,2.5

Not too exciting

Neither the graphics output in Figure 2 nor the command-line output in Figure 3 are terribly exciting, and neither will mean much to you unless you are willing to examine the code and compare the output with the code.

Source code for the program named GM01test02

A complete listing of the program named GM01test02 is shown in Listing 27 near the end of the module.

Listing 3 shows two of the statements in the constructor for the GUI class in the program named GM01test02 . The call to the method named testUsingText produces the command-line output shown in Figure 3 , while the call to the method named drawOffScreen produces the graphic output shown in Figure 2 .

Listing 3 . Code in the constructor for the GUI class in the program named GM01test02.
//Perform tests using text. testUsingText();//Perform tests using graphics.drawOffScreen(g2D);

If you examine the source code for those two methods in Listing 27 , you will see that each of the methods contains calls to library methods for thepurpose of confirming that the library methods behave as expected. The code in most of those methods is straightforward and should not requirefurther explanation beyond the embedded comments in Listing 27 .

End of the discussion for the program named GM01test02

That concludes the discussion of the program named GM01test02 . You will find a complete listing of this program in Listing 27 .

The program named GM01test01

Code in the program named GM01test01 makes calls to library methods, which in turn make calls to the method named convert3Dto2D shown in Listing 1 . Because of the complexity of projecting 3D points onto a 2D screen for display, it will be useful to discuss the three library methods thatmake calls to the library method named convert3Dto2D . Those three methods are shown in the following list :

Questions & Answers

what is phylogeny
Odigie Reply
evolutionary history and relationship of an organism or group of organisms
AI-Robot
ok
Deng
what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Game 2302 - mathematical applications for game development. OpenStax CNX. Jan 09, 2016 Download for free at https://legacy.cnx.org/content/col11450/1.33
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Game 2302 - mathematical applications for game development' conversation and receive update notifications?

Ask