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

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
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.
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
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
characteristics of micro business
for teaching engĺish at school how nano technology help us
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
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
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.
what is the actual application of fullerenes nowadays?
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.
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.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
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.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket 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
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?