1.16 Game 2302-0150: applications of the vector dot product  (Page 5/14)

 Page 5 / 14

Once the required vectors had been created in Listing 3 , there is nothing new in the code in Listing 4 . Therefore, no explanation of Listing 4 should be required beyond the comments embedded in the code.

The bottom line on the program named DotProd3D05

The bottom line is that because the methods in the game-math library named GM02 were designed to do most of the hard work, writing application programs such as DotProd3D05 using the game-math library is not difficult at all. You simply need to understand how to organize your code to accomplish the thingsthat you need to accomplish.

That concludes the explanation of the program named DotProd3D05 .

The program named DotProd3D06

This program demonstrates how the dot product can be used to find vectors that are perpendicular to a given vector.

An infinite number of possibilities

Recall that you learned in the previous module that there are an infinite number of vectors that are perpendicular to a given vector in 3D. This programcomputes and displays normalized and scaled versions of six somewhat unique vectors of the infinite setof vectors that are perpendicular to a user specified vector.

The graphic output

The screen output from this program is shown in Figure 4 .

Figure 4 - Six (magenta) vectors that are perpendicular to a given (black) vector.

Output on the command-line screen

In addition to the graphic output shown in Figure 4 , the program also displays the values of three of the perpendicular vectors on the command-linescreen along with the angle between the perpendicular vector and the user-specified vector. The angle should always be 90 degrees or very close to 90degrees if the program is working properly. The other three of the six perpendicular vectors are simply negated versions of the three for which thevalues are displayed.

Special case of one zero coordinate value

If the user specifies one of the coordinate values to be zero (or close to zero) , the program only computes and displays four of the possible vectors in order to avoid performing division by a near-zero value. In this case, theorientation of two of the vectors will overlay the orientation of the other two. Because the vectors are normalized to the same length and occupy the same space,you will only see two vectors instead of four. This is illustrated in Figure 5 where the value of the z-axis coordinate value was set to zero relative to thevalue used in Figure 4 .

Figure 5 - Screen output when one coordinate has a value of zero.

Special case of two coordinates with a value of zero

If the user specifies two of the coordinate values to be zero or close to zero, the program doesn't produce a valid result. Instead, it draws aperpendicular vector where all of the coordinate values are zero resulting in a magenta vector head at the origin. It also displays NaN (Not a Number) for the angle on the command line screen.

The graphical user interface

The GUI shown in Figure 4 is provided to allow the user to enter three double values that define a GM02.Vector3D object. The GUI also provides an OK button in addition to a 3D drawing area.

What is demand
the amount of a good that buyers are willing and able to purchase
Asit
what is population
The people living within a political or geographical boundary.
Ziyodilla
what happens to price and quantity when demand curves shift to the right
price level goes up. quantity demand increases
Asit
example- inferior goods
Asit
demand law
Athony
Its states that higher the price the of the commodity, and lower the quantity demanded
Kosiso
I am confused but quantity demand will increase.
Asit
No. That's the law of supply
Kosiso
what happens to price and quantity when supply curve shifts left?
price level will increase
Asit
quantity demand will decrease
Asit
what is inflation
inflation is a general and ongoing rise in the level of prices in an entire economy.
cynthia
is the pasistance increase in the price of a country economy
Liyu
kk
Duppy
yes
how does inflation affects the economy of a country? what is deflation?
Augustine
deflation can simply be define as the persistence decrease in price of a countrys economy
Liyu
the revenge of malthus relates "revenge" with "commodity prices". collect data for 3 commodoties and check their price evolution
what is elasticity
Elasticity is an economics concept that measures responsiveness of one variable to changes in another variable.
cynthia
right
Augustine
wooow!!
cynthia
Computer software represents
पर्यावरण राज्यों में से किस राज्य में शिष्य शिक्षक अनुपात 30 से अधिक वाले विद्यालयों का प्रतिशत न्यूनतम होता है
Hey what are you trying to mean?
Kenyana
what is Asset
MUBARAK
like a banana
Ahmed
demand is the process whereby consumers are willing and able to purchase a particular product at various price over a given period of time
The law of dinimish
What is the law of dinimish
Frank
What is the law of dinimish
Frank
What is the law of dinimish
Frank
opportunity cost is to forgo something for another.
yes
King
what is financial market
what is demand
Demand is an economic principle referring to a consumer's desire to purchase goods and services and willingness to pay a price for a specific good or service.
Ali
explain any three exceptions to the law of demand
Got questions? Join the online conversation and get instant answers!