<< 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 the stm
Brian Reply
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
How can I make nanorobot?
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
how can I make nanorobot?
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Difference between extinct and extici spicies
Amanpreet Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

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?