5

Click here to load reader

Computer Graphics Algorithm Based on Visualization ...dline.info/fpaper/jdim/v13i3/v13i3_1.pdfComputer Graphics Algorithm Based on Visualization ... straight line, circle (ellipse)

Embed Size (px)

Citation preview

Page 1: Computer Graphics Algorithm Based on Visualization ...dline.info/fpaper/jdim/v13i3/v13i3_1.pdfComputer Graphics Algorithm Based on Visualization ... straight line, circle (ellipse)

Journal of Digital Information Management Volume 13 Number 3 June 2015 137

Computer Graphics Algorithm Based on Visualization Teaching Theory

Journal of DigitalInformation Management

ABSTRACT: Visualization as one of the important toolsfor understanding complex phenomenon and resolvinglarge-scale data is observed with a significant applicationvalue in natural science field. Since the concept ofvisualization was proposed in 1986, its research progressis constantly promoted. Based on visualization theory athome and abroad, this study discussed over thesignificance of introducing visualization theory, performedalgorithm design and implementation based on the contentand target of computer graphics teaching, and gave outproblems found in practical process as well as solutions,in order to change the teaching means of teachers andhelp students to understand computer graphics algorithmusing visualization teaching.

Subject Categories and DescriptorsI.3.6 [Methodology and Techniques]: Computer graphicsalgorithm

General Terms: Visualization, Computer graphics algorithm

Keywords: Visualization, Computer Graphics, AlgorithmImplementation

Received: 12 January 2015, Revised 20 February 2015, Accepted25 February 2015

1. Introduction

Computer graphics is an important subject that solvesgraphic formation, processing and displaying usingcomputer knowledge, whose major application directionis to construct harmonious man-machine interactionenvironment [1]. This course aims to make studentsmaster the basic concept, method and algorithm ofcomputer graphics. However, we find that, most students

Fangzheng WangYancheng Institute of Health SciencesYancheng, Jiangsu, [email protected]

are confused on some hard algorithms which must belearned; as a result, many students have less learningenthusiasm and reduced initiative, thereby affectingschedule of the course [2]. Algorithm teaching isconsidered as complex and difficult, and the most mainfactors is that students must understand the dynamicchange of data structure by implementing static procedurecode as algorithm taught by teachers in class cannot beimaged in brain [3]; moreover, textbooks usually presentillustrations of key concept but ignore the details ofalgorithm due to the limitation of space, thus studentshave to make up the details by their own understandingduring reading, which is not good for them to learn andmaster algorithm [4].

To solve this teaching problem, people begin to studyvisualization technology related to teaching to convertnonintuitive information into visible graph or imageinformation and demonstrate it on computer screen [5].Visualization technology has attached great importancesince it was proposed in 1986. Many experts and scholarshave obtained several achievements in studying processand Balsa visualization prototype system developed byBrown, Sedgewick et al. in workstation is the mostinfluential. It is applied in educational computing laboratoryin Brown University as a means for teaching computerscience afterwards. Then Stasko designed Tango systemwhich makes algorithm visualization suitable for teachingdemonstration [6]. Making use of visualization of Windowsprogramming, thus study converted basic algorithm ofcomputer graphics into visualization algorithm anddemonstrated it by dynamic images, which is apparentlydifferent from traditional teaching software which onlyrepeats the manufacturing method in textbooks. It canhelp students to master algorithms deeply as they candirectly see implementation process or structure and

Page 2: Computer Graphics Algorithm Based on Visualization ...dline.info/fpaper/jdim/v13i3/v13i3_1.pdfComputer Graphics Algorithm Based on Visualization ... straight line, circle (ellipse)

138 Journal of Digital Information Management Volume 13 Number 3 June 2015

understand algorithms through vivid graph animation whenthey are learning algorithm.

2. Overall Design of Visualization of ComputerGraphics Algorithm

2.1 Confirming Content and TargetTeaching content of visualization is shown in figure 1. Thecore lies in visual mapping, including visualization schemedesign and graphics drawing. Visualization targets on

expressing method, process, concept and significanceby visualization method. The first step is to makeconceptual description for visualization target and next isto educe visualization scheme from conceptualdescription.

Detailed process of confirming content and target ofvisualization can be divided into procedures pf algorithmvisualization implementation, interface design, informationgiving of user, user control and pseudo code comparison.

Figure 1. Visualization of teaching content

2.2 Construction of Visualization Teaching ModelVisualization teaching model is shown in figure 2. Everyalgorithm can be implemented by visualize algorithm byvisualization programming tool, then organize thesevisualization algorithm modules by related software suchas PowerPoint and finally form multi-media teachingsoftware for teaching.

2.3 Interface DesignUser interface is the important element of applicationprogram. Interface is the part first come into sight whenusers contact application program. Interface usually clearlydisplaying the distribution of general content of the programdecide usability and operability of the program [7]. Itsdesign should follow the principle of simplification andconsistency. Aesthetic feeling of interface can beconsidered only when the design meets the demand ofusers. Usability and aesthetic feeling can be improvedtaking layout of interface, position of elements, andconsistency of elements into account. Though algorithms

Figure 2. Visualization teaching model

in graphics course in this study have differentcharacteristics, their similarity is extracted to form unifiedalgorithm dynamic demonstration interface, as shown infigure 3.

3. Specific Implementation of Visualization OfComputer Graphics Algorithm

3.1 Custom CoordinateCoordinated system is the graphic basis used by everygraphic operation. There are three coordinated systemsin VB 6.0, screen coordinated system, form coordinatedsystem and object coordinated system within form. Thesethree coordinated systems differ with common geometriccoordinate system in one point, that is, top left corner istheir coordinate’s origin.

VB allows programmers to define the position of the originbased on demand. In coordinated system of VB,measurement unit defining position along coordinate axis

Page 3: Computer Graphics Algorithm Based on Visualization ...dline.info/fpaper/jdim/v13i3/v13i3_1.pdfComputer Graphics Algorithm Based on Visualization ... straight line, circle (ellipse)

Journal of Digital Information Management Volume 13 Number 3 June 2015 139

is called scale. Every axis in coordinated system has itsown scale. Direction, starting point and scale of coordinateaxis are changeable. Users can set it into custom patternthrough Scale model attribute of the object, such as[Object.] ScaleMode = vbUser. Coordinated system canbe set by Scale method which is the most convenientmethod to build coordinated system. Its grammar is asfollows: [Object.] Scale (x1, y1) - (x2, y2), in which, (x1, y1)stands for the left-corner coordinate value of the objectand (x2, y2) stands for the right-corner coordinate value.

3.2 Attribute and Graphic Method of Basic ControlIn short, control is designed for implementing specifictasks. As a concrete object, control possesses attributes,events and methods. VB standard control used inalgorithm visualization implementation includes CommandButton, Text Box, Label, List Box, Message Box, PictureBox, etc. Caption attribute is used to set text on control;Enabled attribute is to make object respond to users’operation or not, i.e., object valid or invalid; size and fontof words is set by Font attribute; display mode of font canbe set by MultiLine attribute; Scroll Bars attribute can beused to endow text box with horizontal scroll bar, verticalscroll bar or both of them. VB graphic method refers toprecede drawing action on forms, picture box, etc.Common graphic methods include Pset method, Linemethod, Cirle method. Point, straight line, circle (ellipse)and geometric figures can be drawn by graphic methodsof VB, in the process of various events.

3.3 “Rubber band” DrawingAfter a point is defined by mouse, another point is definedby dynamically moving mouse. Graph drawn changingaccordingly during mouse movement is called “runnerband” effect, which can also be achieved by xor method.If we intend to draw any straight line with “rubber band”effect in Picture Box control using a mouse, the first stepis to draw a starting point in the current position by mouse,then the previous straight line is erased when the mousemoves, and finally a line is drawn in the new position. Torealize the above procedures, we need to respond MouseMove event in Picture Box control.

3.4 Real-time Tracking of CoordinateAs a common control, status bar is usually taken to doreal-time tracking of coordinate, so that users can observe

Figure 3. Visualization interface of algorithm

coordinates of points at any time. In default state, statusbar is not in control panel; therefore, it need to be addedbefore usage.

For instance, if we hope the first form to display Xcoordinate of the point and the second form displays Ycoordinate when the mouse moves to any position inPicture Box control, the codes are as follows:

Private Sub picture1_MouseMove (Button as Integer, Shift asInteger, X As Single, Y as Single)StatusBar1.Panels (1).Text = “X Coordinate:”& Format(X, “##.##”)StatusBar1.Panels (2).Text = “Y Coordinate:”& Format(Y, “##.##”)End Sub

3.5 Combination of Pseudocode and DemonstrationOperating VB program inside and displaying operation ofC program outside is the key of algorithm visualizationdeveloping, as shown in figure 4.

4.Specific Problems of Algorithm VisualizationImplementation and Solutions

4.1 Visualization Implementation of Curve DerivativeAlgorithmAs to visualization implementation of curve derivativealgorithm, this study put the focus of visualization inpresentation form and property of curve. As knowledgeinvolved in learning of curve is complex, visualizationdemonstration will divide students’ attention, which isineffective in promoting abstract thinking andcomprehensive analysis ability of students. Thoughvisualization is a tool for expanding teaching contents,learning means and thinking space, it cannot solve allproblems existing in teaching. As to some contents,visualization teaching is supposed to combine withtraditional teaching mode, such as performing formulamanipulation on blackboard to promote interactionbetween students and teachers. Therefore, visualizationis not suitable for all contents. However, presentation formof curves can be reflected by visualization technology, asshown in figure 5. As a result, students can understandthe property and presentation of curve better based onknowing curve derivative principled.

Page 4: Computer Graphics Algorithm Based on Visualization ...dline.info/fpaper/jdim/v13i3/v13i3_1.pdfComputer Graphics Algorithm Based on Visualization ... straight line, circle (ellipse)

140 Journal of Digital Information Management Volume 13 Number 3 June 2015

Figure.4. Connection between executions inside outside

Figure 5. Curve visualization implementation

4.2 Fractal Visualization ImplementationWord “Fractals” was invited by a famous mathematicianB.Mandelbrot using Latin roots in 1975. It means shred,crush, etc. He set up a brand new geometric mathematicalmethod, i.e., fractal geometry, which provides a usefulteaching tool for description of natural scene and computersimulation. In ideas of fractal geometry, every local part ofa graphic can be regarded as a reduced copy of the wholegraphic, i.e., self-similarity nature of fractal geometry.Based on that, recursive algorithm is required inconstructing fractal graphics. Following is a recursivealgorithm for building fractal tree.

(1) Suppose coordinate of A, B, C and D is (x, y), (x0, y0),(x1, y1) and (x2, y2) respectively, L is the length of tree stemand α is the angle between branch and stem.;2) Draw stem AB, (x, y) − (x0, y0);(3) Calculate coordinate of

C, L = 2 L/3, x1= x0+L*cos (α ), y1= y0 − L * sin (α);

(4) Calculate coordinate of D, L = 2 L / 3,

x2 = x0 + L * cos(−α ), y2 = y0 − L*sin (−α);

(5) x0 → x,y0→ y, x1 → x0, y1→ y0 in the second step, thendraw a straight line between (x, y) and (x0, y0), i.e., drawbranch BC;

(6) x0 → x,y0→ y, x2 → x0, y2 → y0 in the second step, thendraw a straight line between (x, y) and (x0, y0), i.e., drawbranch BD;(7) Repeat step 3 ->6 until recursive times is finished.

5. Conclusion

Essence of visualization technology lies in integratinggraphic formation and image understanding. As theemerging hot computer technology recently, it can analyzeimage data input into computer, generate graphics fromcomplex multi-dimensional data, i.e., converting data andresults produced in scientific computation into geometricfigure and image information, which is easy forunderstanding and communication [8].

Page 5: Computer Graphics Algorithm Based on Visualization ...dline.info/fpaper/jdim/v13i3/v13i3_1.pdfComputer Graphics Algorithm Based on Visualization ... straight line, circle (ellipse)

Journal of Digital Information Management Volume 13 Number 3 June 2015 141

Recently, problems faced by teachers and students inteaching and learning become frequent. Especially whenteachers teach abstract knowledge, students often havea superficial knowledge or even completely confuse; atthis moment, visualization teaching is required to solvethis problem [9]. Knowledge in computer field is alwaysabstract, which cannot be perfectly represented bytraditional teaching. To meet this teaching demand, peoplestart to study and develop visualization tool used ineducation. Studying and developing visualization teachingsystem and model can effectively reform teaching modeof computer course and improve teaching efficiency andquality, which plays a vital role in learning of students andteaching of teachers.

Acknowledgement

Project category: Guidance Project of Research Fundfor Philosophy and Social Science Research Fund ofJiangsu Universities.

Project Name: Application of Knowledge Visualizationin Computer Courses in Higher Vocational CollegesProject approval number: 2014SJD704

References

[1] Yuzhen, Jiang. (2011). Construction of AlgorithmVisualization Instruction System on Computer Graphics.Modem Computer, (11) 44-46.

[2] Gui, Wu., Jun, Tao. (2011). 3D algorithms andvisualization of computer graphics education based onVRML and JAVA. Journal of Hubei Adult EducationInstitute, (5) 140-143.

[3] Weidong, Chen., Jiping, Zhang. (2010). Positioningand Characteristics of Future Class. E-educationResearch, (7) 23-28.

[4] Yuanmei, Duan., Shichun, Wang., Shuzun, Jiang.(2010). Classroom Teaching Research Based onInteractive Whiteboard. China Educational Technology, (3)84-86.

[5] Guohua, Wu., Kedong, Li. (2011). Meta-analysis ofKnowledge Visualization Teaching Application. E-education Research, (12) 84-90.

[6] Hongjiang, Li., Zijuan, Gui. (2011). Application ofComputer Graphics in Electrical Power System.Technology Trend, (11) 68-69.

[7] Minya, Chen., Xudong, Jin. (2011). Discussion onComputer Graphics and Graphic and Image ProcessingTechnology. Journal of Changchun University of Scienceand Technology, (1):138-139, 146.

[8] Kaibin, Lei., Zhixia, Ma. (2010). Application AbilityCultivation Based on Computer Graphics Course Teaching.Journal of Southwest University for Nationalities (NaturalScience Edition), 36 (9): 56-59

[9] Dan, Wu. (2010). Introduction and Development of LeafyInteractive Model in Classroom. Elementary EducationStudies, (2)16-19.