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.

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
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
it is a goid question and i want to know the answer as well
Maciej
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
are you nano engineer ?
s.
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.
Tarell
what is the actual application of fullerenes nowadays?
Damian
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.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
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.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
for screen printed electrodes ?
SUYASH
What is lattice structure?
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
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!