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

explain and give four Example hyperbolic function
Lukman Reply
The denominator of a certain fraction is 9 more than the numerator. If 6 is added to both terms of the fraction, the value of the fraction becomes 2/3. Find the original fraction. 2. The sum of the least and greatest of 3 consecutive integers is 60. What are the valu
SABAL Reply
1. x + 6 2 -------------- = _ x + 9 + 6 3 x + 6 3 ----------- x -- (cross multiply) x + 15 2 3(x + 6) = 2(x + 15) 3x + 18 = 2x + 30 (-2x from both) x + 18 = 30 (-18 from both) x = 12 Test: 12 + 6 18 2 -------------- = --- = --- 12 + 9 + 6 27 3
Pawel
2. (x) + (x + 2) = 60 2x + 2 = 60 2x = 58 x = 29 29, 30, & 31
Pawel
ok
Ifeanyi
on number 2 question How did you got 2x +2
Ifeanyi
combine like terms. x + x + 2 is same as 2x + 2
Pawel
Mark and Don are planning to sell each of their marble collections at a garage sale. If Don has 1 more than 3 times the number of marbles Mark has, how many does each boy have to sell if the total number of marbles is 113?
mariel Reply
Mark = x,. Don = 3x + 1 x + 3x + 1 = 113 4x = 112, x = 28 Mark = 28, Don = 85, 28 + 85 = 113
Pawel
how do I set up the problem?
Harshika Reply
what is a solution set?
Harshika
find the subring of gaussian integers?
Rofiqul
hello, I am happy to help!
Shirley Reply
please can go further on polynomials quadratic
Abdullahi
hi mam
Mark
I need quadratic equation link to Alpa Beta
Abdullahi Reply
find the value of 2x=32
Felix Reply
divide by 2 on each side of the equal sign to solve for x
corri
X=16
Michael
Want to review on complex number 1.What are complex number 2.How to solve complex number problems.
Beyan
yes i wantt to review
Mark
use the y -intercept and slope to sketch the graph of the equation y=6x
Only Reply
how do we prove the quadratic formular
Seidu Reply
please help me prove quadratic formula
Darius
hello, if you have a question about Algebra 2. I may be able to help. I am an Algebra 2 Teacher
Shirley Reply
thank you help me with how to prove the quadratic equation
Seidu
may God blessed u for that. Please I want u to help me in sets.
Opoku
what is math number
Tric Reply
4
Trista
x-2y+3z=-3 2x-y+z=7 -x+3y-z=6
Sidiki Reply
can you teacch how to solve that🙏
Mark
Solve for the first variable in one of the equations, then substitute the result into the other equation. Point For: (6111,4111,−411)(6111,4111,-411) Equation Form: x=6111,y=4111,z=−411x=6111,y=4111,z=-411
Brenna
(61/11,41/11,−4/11)
Brenna
x=61/11 y=41/11 z=−4/11 x=61/11 y=41/11 z=-4/11
Brenna
Need help solving this problem (2/7)^-2
Simone Reply
x+2y-z=7
Sidiki
what is the coefficient of -4×
Mehri Reply
-1
Shedrak
the operation * is x * y =x + y/ 1+(x × y) show if the operation is commutative if x × y is not equal to -1
Alfred Reply
A soccer field is a rectangle 130 meters wide and 110 meters long. The coach asks players to run from one corner to the other corner diagonally across. What is that distance, to the nearest tenths place.
Kimberly Reply
Jeannette has $5 and $10 bills in her wallet. The number of fives is three more than six times the number of tens. Let t represent the number of tens. Write an expression for the number of fives.
August Reply
What is the expressiin for seven less than four times the number of nickels
Leonardo Reply
How do i figure this problem out.
how do you translate this in Algebraic Expressions
linda Reply
why surface tension is zero at critical temperature
Shanjida
I think if critical temperature denote high temperature then a liquid stats boils that time the water stats to evaporate so some moles of h2o to up and due to high temp the bonding break they have low density so it can be a reason
s.
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris 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?

Ask