PDA

نسخه کامل مشاهده نسخه کامل : درخواست الگوریتم گرافیکی



mehran_ramzi
17-12-2008, 10:50
با سلام خدمت همه دوستان
من یه برنامه یا الگوریتم گرافیکی به زبان c میخواستم واسه درس گرافیک کامپیوتری.
ترجیحا توضیحاتش انگلیسی باشه.
ممنون میشم کمکم کنین

majid-ar
17-12-2008, 15:02
سلام.فكر كنم این كتاب كمكتون بكنه:



Introduction to C++ Programming and Graphics

[ برای مشاهده لینک ، لطفا با نام کاربری خود وارد شوید یا ثبت نام کنید ]






Introduction to C++ Programming and Graphics
Pozrikidis, C.
2007, XII, 372 p., Hardcover
ISBN: 978-0-387-68992-0


About this textbook

* A basic, concise introduction to C++ programming for everyone from students to scientists and engineers seeking a quick grasp of key topics
* Provides a comparative analysis and discussion of C++ in relation to other programming languages such as C, Fortran, and Matlab®
* Graphics chapters allow the reader to apply what is taught in the beginning chapters
* Contains a tutorial on the usage of Matlab® functions in C++ code

C++ has grown rapidly in response to the practical need for a programming language that is able to efficiently handle composite and diverse data types. Today, C++ dominates the commercial market and is favored among application developers.

Introduction to C++ Programming and Graphics offers a venue for rapidly learning the language by concisely revealing its grammar, syntax and main features, and by explaining the key ideas behind object oriented programming (OOP), with emphasis on scientific computing.

The book reviews elemental concepts of computers and computing, describes the primary features of C++, illustrates the use of pointers and user-defined functions, and analyzes the construction of classes. Distinctive features include:

* An effective selection and presentation of topics and supporting examples

* A tutorial on the usage of MATLAB® functions in C++ code

* Tables for translating MATLAB® and Fortran 77 into C++ code, illustrating syntactic differences between these languages

* Chapters on graphics and GUI programming based on the VOGLE library and the GLUT, GLUI and GTK+ utility toolboxes

This invaluable resource provides a basic, concise introduction to C++ for the novice, allowing the reader to easily grasp the necessary concepts, rather than trying to absorb an extensive reference book. Scientists, engineers, professionals and students familiar with the general principles of computer programming and proficient in an easy programming language will find this volume an ideal entry point into C++.
Written for:
Computer scientists, engineers, advanced-level students




Contents
1 Computers and Computing 1
1.1 Hardware and software . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 The binary system . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Binary system arithmetic . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Computer memory and addresses . . . . . . . . . . . . . . . . . . 13
1.5 Computer programming . . . . . . . . . . . . . . . . . . . . . . . 15
1.6 Floating-point representation . . . . . . . . . . . . . . . . . . . . 19
1.7 The hexadecimal system . . . . . . . . . . . . . . . . . . . . . . . 22
2 General Features of C++ 24
2.1 The main function . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.2 Grammar and syntax . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.3 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.4 Vectors, arrays, and composite data types . . . . . . . . . . . . . 34
2.5 System header files . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.6 Standard namespace . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.7 Compiling in Unix . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.8 Simple codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3 Programming in C++ 47
3.1 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.2 Vector and matrix initialization . . . . . . . . . . . . . . . . . . . 51
3.3 Control structures . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.4 Receiving from the keyboard and displaying
on the monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.5 Mathematical library . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.6 Read froma file and write to a file . . . . . . . . . . . . . . . . . 70
3.7 Formatted input and output . . . . . . . . . . . . . . . . . . . . . 74
3.8 Sample algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.9 Bitwise operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.10 Preprocessor define and undefine . . . . . . . . . . . . . . . . . . 88
x Contents
4 User-Defined Functions 91
4.1 Functions in the main file . . . . . . . . . . . . . . . . . . . . . . 91
4.2 Static variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.3 Function return . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.4 Functions in individual files and header files . . . . . . . . . . . . 100
4.5 Functions with scalar arguments . . . . . . . . . . . . . . . . . . 102
4.6 Functions with array arguments . . . . . . . . . . . . . . . . . . . 109
4.7 External variables . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.8 Function overloading . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.9 Recursive calling . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.10 Function templates . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5 Pointers 127
5.1 Pointers to scalars and characters . . . . . . . . . . . . . . . . . . 127
5.2 Pointers to arrays and strings . . . . . . . . . . . . . . . . . . . . 134
5.3 Sorting with the STL . . . . . . . . . . . . . . . . . . . . . . . . . 137
5.4 Command line arguments . . . . . . . . . . . . . . . . . . . . . . 140
5.5 Pointers to functions . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.6 Pointers to free memory . . . . . . . . . . . . . . . . . . . . . . . 145
6 Classes and Objects 149
6.1 Class objects and functions . . . . . . . . . . . . . . . . . . . . . 151
6.2 Class interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
6.3 Class definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
6.4 Private fields, public fields, and global variables . . . . . . . . . . 159
6.5 The fruit class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.6 Friends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
6.7 Circles and squares . . . . . . . . . . . . . . . . . . . . . . . . . . 164
6.8 Algebra on real numbers . . . . . . . . . . . . . . . . . . . . . . . 167
6.9 Operator overloading . . . . . . . . . . . . . . . . . . . . . . . . . 170
6.10 Pointers to class members . . . . . . . . . . . . . . . . . . . . . . 173
6.11 The class of points in a plane . . . . . . . . . . . . . . . . . . . . 175
6.12 The class of runners . . . . . . . . . . . . . . . . . . . . . . . . . 178
6.13 Header files and projects . . . . . . . . . . . . . . . . . . . . . . . 183
6.14 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.15 Pointers and virtual functions . . . . . . . . . . . . . . . . . . . . 189
6.16 Class templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
7 Graphics Programming with VOGLE 197
7.1 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
7.2 Getting started with Vogle . . . . . . . . . . . . . . . . . . . . . 200
7.3 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
7.4 Plotting a line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
7.5 A graph with axes . . . . . . . . . . . . . . . . . . . . . . . . . . 221
7.6 Graph animation . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Contents xi
7.7 Three-dimensional interactive graph . . . . . . . . . . . . . . . . 236
7.8 Three-dimensional interactive object drawing . . . . . . . . . . . 248
8 Graphics Programming with GLUT, GLUI, and GTK+ 252
8.1 GLUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
8.2 Graphics events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
8.3 Drop-down menus . . . . . . . . . . . . . . . . . . . . . . . . . . 279
8.4 GUI programming with GLUI . . . . . . . . . . . . . . . . . . . . 281
8.5 GUI programming with GTK+ . . . . . . . . . . . . . . . . . . . 283
9 Using Matlab 287
9.1 Invoking Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . 288
9.2 The Matlab engine library . . . . . . . . . . . . . . . . . . . . . 289
9.3 The Matlab engine functions . . . . . . . . . . . . . . . . . . . 290
9.4 Transferring data to the Matlab domain . . . . . . . . . . . . . 294
9.5 Transferring data from Matlab to the C++ domain . . . . . . . 306
A Unix Primer 314
B Summary of VOGLE Functions 318
C C++/Matlab/Fortran 77 Dictionary 325
D ASCII Code 337
E C++ Keywords 341
F Matlab Primer 343
F.1 Grammar and syntax . . . . . . . . . . . . . . . . . . . . . . . . . 343
F.2 Precision. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
F.3 Matlab commands . . . . . . . . . . . . . . . . . . . . . . . . . 347
F.4 Elementary examples . . . . . . . . . . . . . . . . . . . . . . . . . 348
F.5 Matlab functions . . . . . . . . . . . . . . . . . . . . . . . . . . 352
F.6 User-defined functions . . . . . . . . . . . . . . . . . . . . . . . . 352
F.7 Numerical methods . . . . . . . . . . . . . . . . . . . . . . . . . . 355
F.8 Matlab graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
G The Standard Template Library 364
Index 367





دانلود:


برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید