1.13 Game 2302-0135: venturing into a 3d world  (Page 18/30)

 Page 18 / 30

Within the method named drawOffScreen , the only really interesting code is the statement that calls the rotate method of the game-math library on each Point2D object inside a for loop. Knowing what you do about the rotate method, you should have no problem understanding the code in Listing 18 .

End of the discussion

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

The program named StringArt03

I saved the best for last, or at least I saved the most difficult program until last. In this program, I will teach you how to use the new GM01.Point3D.rotate method to rotate objects in 3D space.

Not only is the code for doing rotations in 3D space much more complicated than the rotation code in 2D, it is also more difficult to examine the graphicoutput produced by rotating an object in 3D space and be certain that the program is working as it should. Therefore, we need to start this discussionwith an explanation of the game-math library method named GM01.Point3D.rotate . Before we can get to that method, however, we must deal with the rotationequations for rotation of a point in 3D space.

The six 3D rotation equations

Unlike with 2D rotation where things were less complicated, we now have to deal with three coordinate values, three rotation angles, and six equations.Using the Spatial Transformations webpage and other online material as well, we can conclude that our 3D rotation method must implement the six equations shown in Figure 12 .

Figure 12 . The six 3D rotation equations.
```Let rotation angle around z-axis be zAngle Let rotation angle around z-axis be xAngleLet rotation angle around z-axis be yAngle Rotation around the z-axisx2 = x1*cos(zAngle) - y1*sin(zAngle) y2 = x1*sin(zAngle) + y1*cos(zAngle)Rotation around the x-axis y2 = y1*cos(xAngle) - z1*sin(xAngle)z2 = y1*sin(xAngle) + z1* cos(xAngle) Rotation around the y-axisx2 = x1*cos(yAngle) + z1*sin(yAngle) z2 = -x1*sin(yAngle) + z1*cos(yAngle)Where: x1, y1, and z1 are coordinates of original pointx2, y2, and z2 are coordinates of rotated point```

Also, as before, these six equations are only good for rotation around the origin, but our objective is to be able to rotate a point about anyarbitrary anchor point in 3D space. Once again, we will use the trick of translating the anchor point to the origin, rotating the object around theorigin, and then translating the object back to the anchor point.

Beginning of the method named GM01.Point3D.rotate

The method named GM01.Point3D.rotate begins in Listing 19 .

Listing 19 . Beginning of the method named GM01.Point3D.rotate.
`public GM01.Point3D`

The purpose of this method is to rotate a point around a specified anchor point in 3D space in the following order:

• Rotate around z - rotation in x-y plane.
• Rotate around x - rotation in y-z plane.
• Rotate around y - rotation in x-z plane.

A useful upgrade to the game-math library might be to write three separate rotation methods, each designed to rotate a Point3D object around only one of the three axes.

where we get a research paper on Nano chemistry....?
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!