<< 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

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
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
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
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.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar 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?