<< Chapter < Page Chapter >> Page >
Listing 12 . Draw six lines connecting the vertices of the hexagon.
GM2D02.Line line01 = new GM2D02.Line(point0,point1); GM2D02.Line line12 = new GM2D02.Line(point1,point2);GM2D02.Line line23 = new GM2D02.Line(point2,point3); GM2D02.Line line34 = new GM2D02.Line(point3,point4);GM2D02.Line line45 = new GM2D02.Line(point4,point5); GM2D02.Line line50 = new GM2D02.Line(point5,point0);//Now draw a visual manifestation of each line // on g2Da.line01.draw(g2Da); line12.draw(g2Da);line23.draw(g2Da); line34.draw(g2Da);line45.draw(g2Da); line50.draw(g2Da);

Then Listing 12 calls the draw method belonging to the GM2D02.Line class six times in succession to cause visible lines to be rendered on the specified off-screen image. You can see those sixlines in the left image in Figure 1 .

That completes the drawing that is performed on the off-screen image shown in the left image in Figure 1 . Next I will explain the drawing that is performed on the off-screen image that is shown as the right image in Figure 1 .

Instantiate three objects of type GM2D02.Vector

According to Kjell, "A vector is a geometrical object that has two properties: length and direction ." He also tells us, "A vector does not have a position."

The right image in Figure 1 shows visual manifestations of three differentobjects of the GM2D02.Vector class. One vector is represented as a red line with a small red circle at its head. A second vector isrepresented as a blue line with a small blue circle at its head. The third vector is shown in three different positions represented by green lines withsmall green circles at their heads.

Listing 13 instantiates three objects of the GM2D02.Vector class, which are visually represented by the red, green, and blue lines in Figure 1 . References to these three objects are saved in the variables named vecA , vecB , and vecC in Listing 13 .

Listing 13 . Instantiate three objects of type GM2D02.Vector.
GM2D02.Vector vecA = new GM2D02.Vector( new GM2D02.ColMatrix(50,100));GM2D02.Vector vecB = new GM2D02.Vector( new GM2D02.ColMatrix(75,25));GM2D02.Vector vecC = new GM2D02.Vector( new GM2D02.ColMatrix(125,125));

Note that each vector is described by two values in a GM2D02.ColMatrix object.

Call the draw method to draw the vector

Listing 14 begins by setting the drawing color to red for the off-screen image on which the visual manifestation of the first Vector object will be drawn. Then Listing 14 calls the draw method of the GM2D02.Vector class to cause the object referred to by vecA to be represented as a (red) line with its tail at the origin. (Unlike the image on the left side of Figure 1 , the origin for the image on the right was not translated to the center.)

Listing 14 . Call the draw method to draw the vector.
g2Db.setColor(Color.RED);vecA.draw(g2Db,new GM2D02.Point( new GM2D02.ColMatrix(0,0)));

Note that two parameter are passed to the draw method in Listing 14:

  • A reference to the off-screen graphics context on which the visual manifestation of the vector will be drawn.
  • A new object of the class GM2D02.Point that will be used to determine the position on the off-screen image in which the visualmanifestation will appear.

Questions & Answers

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
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.
Bharti
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
Daniel
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
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
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
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
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
Abhijith Reply
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?
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.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
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
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller 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