블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday

Category

'python'에 해당되는 글 6건

  1. 2008.02.24 Python tutorials
  2. 2007.10.29 [Dave Pape] Graphics hardware & software; Python
  3. 2007.10.29 [Dave Pape] Programming Graphics 1
  4. 2007.07.11 Using Python for CGI programming
  5. 2007.07.11 classes in Python
  6. 2007.06.26 Python
2008. 2. 24. 01:40 Computation/Language
아니 뭐 이런 천사 같은 사람들이 이렇게 많아...

http://www.diveintopython.org/


1
How to Think Like a Computer Scientist
Learning with Python (2nd Edition)
by Jeffrey Elkner, Allen B. Downey and Chris Meyers
illustrated by Udit Bhatnager and Chris Schmeelk

-> 너무나 친절한 설명. 컴퓨터 프로그래밍 언어에 대한 개념을 처음 잡을 때 힘들게 정리했던 것들이 1장에 깔끔하게 요약되어 있고. @.@ 진도 진짜 천천히 나간다. 자연계라면 좀 지루할 정도. 손 놓고 있는 동안 다 잊어 버렸을까 걱정했는데 이거 한 번 보면 될 듯. 파이썬 아니, 코딩 처음 공부할 때 여기 알았으면 진짜 편했을텐데. ㅜㅜ

2
Python Tutorial
Guido van Rossum
Python Software Foundation

-> 지금 보면 좀 나으려나? 설명이 압축적이라 막상 코딩을 짤 때에는 의외로 큰 도움이 되지 못했었다. 코딩에 대한 것이 아니라 언어 자체에 대한 설명이기 때문이다. 나한텐 어렵다. 내겐 필요 없는 내용도 많다. 그래도 필독. 일종의 사전이라고 생각한다. (사전 본다고 글이 써지는 건 아니잖아? ^^;)

3
Penzilla.net's Python Tutorial


4
O'Reilly Python Center

-> 그래도 중급 이상 되기 전에는 안 사. ㅋ 오호. Jython이라...
Jython is an implementation of the Python programming language written in Java, allowing Python programs to integrate seamlessly with any Java code.



Python에서의 프로그래밍, Part 1



etc.

Text Processing in Python
by David Mertz -- published by Addison Wesley

-> 나중에 유용할 날이 있을 듯한 예감.


http://coreapython.hosting.paran.com/

'Computation > Language' 카테고리의 다른 글

16진수 10진수로 변환 strtol()  (0) 2008.08.12
numeric library  (0) 2008.03.18
Using Python for CGI programming  (0) 2007.07.11
classes in Python  (0) 2007.07.11
Python  (0) 2007.06.26
posted by maetel
Dave Pape's
Class 2 (30 Aug) - Graphics hardware & software; Python

Python

Features:

  • Dynamic data typing

  • Automatic memory management

  • Advanced data types (strings, lists, dictionaries)

  • A large standard library

  • Extensible & embeddable

Building Blocks

  • Comments
  • Numbers
  • Strings
  • Lists
  • Variables
  • Operators
  • Statements
    • Assignment
    • If - elif - else
    • For loops
    • While loops
  • Functions
  • Variable scope
  • Modules
  • Advanced data types


8진수는 영어 문자 o 를 붙여서 표현하고
16진수는 0x를 붙여서 표현하고
10진수는 그냥 표시한다.

% operator (modulo)

pass

Modules are pre-written packages of code that can be used in a Python program.
They are similar to libraries in other languages.

math modules (Numeric and Mathematical Modules)

string modules
(string manipulation operations)

keys ()

Mapping Types -- dict

A class is a data type, for objects that can contain both variables and functions.
A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by defining methods with special names.


Graphics Pipeline

  • Program & data reside in PC memory
  • CPU runs program, calling graphics commands
  • Commands & data transferred to graphics card
  • Images rendered into graphics card memory
  • Video display generated from graphics card memory
Interface between CPU & graphics card:
  • PCI
  • AGP (1x, 2x, 4x, 8x)
  • PCI Express
Interface between graphics card & display:
  • VGA
  • DVI
  • Composite, S-Video


A scene graph is a tree used to represent a graphical scene.
A scene-graph is a data structure that arranges the logical and often (but not necessarily) spatial representation of a graphical scene.

Graphics APIs

  • OpenGL
  • Direct3D

  • Performer
  • OpenInventor
  • OpenSceneGraph
  • Java3D

  • Virtools
  • OpenDX
  • AVS

OpenGL (Open Graphics Library) is a standard specification defining a cross-language cross-platform API for writing applications that produce 2D and 3D computer graphics. http://www.opengl.org/

Direct3D

Performer

Open Inventor, originally IRIS Inventor, is a C++ object oriented retained mode 3D graphics API designed by SGI to provide a higher layer of programming for OpenGL. http://oss.sgi.com/projects/inventor/

OpensceneGraph

Java3D

Virtools

OpenDX

AVS


GLUT (the OpenGL Utility Toolkit) is a library of utilities for OpenGL programs, which primarily perform system-level I/O with the host operating system.

posted by maetel
Dave Pape is a member of the Department of Media Study at the University at Buffalo.
The course was informed by Ed.

DMS 423/523: Programming Graphics 1
Fall 2007

Course Info

When: Tuesday/Thursday 2:00 - 3:50 pm
Where: CFA 242

Instructor: Dave Pape
e-mail: depape at buffalo.edu
Office: CFA 250
Office hours: Wed 12-1pm; Tues/Thurs 1-2pm

Website: http://resumbrae.com/ub/dms423/

Course Description

This production course introduces students to the concepts and practice of programming 2-D and 3-D computer graphics using OpenGL. The major focus is on developing the skills needed to create interactive, real-time CG experiences. Students write their own code to create customized computer tools and visuals and learn the fundamentals of graphics.

Upon completing this course, a student should have an understanding of basic computer graphics technical concepts - e.g., be able to describe the different types of geometric transformations, define what a normal vector is and what it's used for, understand how a texture image is applied to a shape, etc. The student should also be comfortable with using programming and mathematics (trigonometry, interpolation, vectors) to build and control a graphical scene.

Textbook

There is no single required text. Rather, students should choose one of the following texts, based on their background and programming experience:

  • OpenGL Programming Guide, Fourth Edition, David Shreiner et al.
  • OpenGL Distilled, Paul Martz
  • Computer Graphics with OpenGL, Donald Hearn, Pauline Baker.
  • Interactive Computer Graphics: A Top-Down Approach Using OpenGL, Edward Angel.

Useful websites:

Topics

The major topics that we will cover are:

  • Color
  • Geometry (shapes)
  • Transformations
  • Projections
  • Lighting
  • Texturing
  • Sound
  • Math



Draft Schedule

Aug 28/30 Introduction
Sep 4/6 Images, frame buffer
Sep 11 Geometry, coordinate systems
Sep 20/22 Transformations
Sep 25/27 More transformations, 3D coordinates
Oct 2/4 Depth cues
Oct 9/11 Math
Oct 16/18 Interaction
Oct 23/25 Texturing
Oct 30/Nov 1 Lighting
Nov 6/8 Motion math
Nov 13/15 Sound
Nov 20 Alpha
Nov 27/29 PD
Dec 4/6 Special topics TBD

posted by maetel
2007. 7. 11. 21:10 Computation/Language
Using Python for CGI programming

Author: Guido van Rossum
Email: guido@python.org
Home Page: http://www.python.org/~guido/


Subclasses
class Stack:
    "A well-known data structure..."
    def __init__(self):
        self.items = []
    def push(self, x):
        self.items.append(x)
    def pop(self):
        x = self.items[-1]
        del self.items[-1]
        return x
    def empty(self):
        return len(self.items) == 0
   
#x = Stack()
#x.empty()
#x.push(1)
#x.empty()
#x.push("hello")
#x.pop()
#print x.items
#x.push("hello")
#print x.items
   
class FancyStack(Stack):
    "stack with added ability to inspect inferior stack items"
   
    def peek(self, n):
        "peek(0) returns top; peek(-1) returns item below that; etc."
        size = len(self.items)
        assert 0 <= n < size
        return self.items[size-1-n]
       

class LimitedStack(FancyStack):
    "fancy stack with limit on stack size"
   
    def __init__(self, limit):
        self.limit = limit
        FancyStack.__init__(self)
       
    def push(self, x):
        assert len(self.items) < self.limit
        FancyStack.push(self, x)

> Instance variable rules
- Use via instace (self.x), search order: (1) instance, (2) class, (3) base classes
- assignment via instace (self.x = ...) always makes an instacne variable
- Class variables "default" for instance variables  


'Computation > Language' 카테고리의 다른 글

numeric library  (0) 2008.03.18
Python tutorials  (0) 2008.02.24
classes in Python  (0) 2007.07.11
Python  (0) 2007.06.26
features of object-oriented programming  (0) 2007.06.20
posted by maetel
2007. 7. 11. 14:34 Computation/Language
ref. Python tutorial 9. Classes

The class inheritance mechanism allows multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain an arbitrary amount of private data.

In Python, all data types are objects.

A namespace is a mapping from names to objects. Name spaces are created at different moments and have different lifetimes.
The word attribute is for any name following a dot. Attributes may be read-only or writable.
A scope is a textual region of a Python program where a namespace is directly accessible.

Assignments always go into the innermost scope. Assignments do not copy data -- they just bind names to objects.

A class object is basically a wrapper around the contents of the namespace created by the class definition.

Class objects support two kinds of operations: attribute references and instantiation.
Attribute references
use the standard syntax used for all attribute references in Python: obj.name.
Class instantiation uses function notation. Just pretend that the class object is a parameterless function that returns a new instance of the class.

The only operations understood by instance objects are attribute references. There are two kinds of valid attribute names, data attributes and methods.
Data attributes
correspond to "instance variables'' in Smalltalk, and to "data members'' in C++.
A method is a function that "belongs to'' an object. The special thing about methods is that the object is passed as the first argument of the function.

Any function object that is a class attribute defines a method for instances of that class.

The global scope associated with a method is the module containing the class definition. (The class itself is never used as a global scope!) Functions and modules imported into the global scope can be used by methods, as well as functions and classes defined in it. Usually, the class containing the method is itself defined in this global scope.



ref. 이강성 <열혈강의 파이썬(Python)> 개정판 Ver.2: 12 클래스, 프리렉

파이썬의 클래스는 새로운 이름 공간을 지원하는 단위이다. 이 이름 공간에는 함수와 변수가 포함될 수 있다. 클래스는 하나 이상의 인스턴스 객체를 생성하는 틀과 같다.
(클래스 자체가 이름 공간을 가지지만, 각각의 인스턴스도 독립적인 이름 공간을 가진다. ->) 동적으로 클래스 외부에서 멤버를 생성할 수 있다.

Class : class 문으로 정의되며, 멤버와 메쏘드를 가지는 객체
Class Object
Class Instance : 클래스를 호출하여 만들어지는 객체
Class Instance Object
Member : 클래스가 갖는 변수
Method : 클래스 내에 정의된 함수
Attribute : 멤버와 메쏘드 전체. 즉, 이름 공간의 이름 전체.
Super Class = Base Class
Sub Class = Derived Class

> Features of Classes in OOP
Inheritance 상속: (A 클래스를 수퍼 클래스로 하는 클래스 B를 생성하였다면 B 'is-a' A 관계라고 함.)
Multiple Inheritance 다중 상속: 두 개 이상의 수퍼 클래스로부터 상속받는 것
Polymorphism 다형성: 상속 관계 내의 다른 클래스의 인스턴스들이 같은 멤버 함수 호출에 대해 각각 다르게 반응하도록 하는 기능
Encapsulation 정보 은닉: 메쏘드와 멤버를 클래스 내에 포함시키고 외부에서 접근 가능하도록 인터페이스만을 공개하고 다른 속성들은 내부에 숨기는 것
Composition 합성: 어떤 객체가 다른 객체에 포함되어 활용되는 것 (x라는 객체가 클래스 A안에 포함되어 A의 각종 메쏘드를 구현하는데 사용된다면, A가 x를 포함하므로 'has-a'관계라고 함.)

self: 메쏘드를 정의할 때 사용하는 첫 인수. 자신의 인스턴스 객체를 가리키는 레퍼런스이다.
- 모든 메쏘드는 반드시 self를 첫 인수로 받아야 한다. (이 self를 이용하여 클래스의 이름 공간에 접근해야 하기 때문이다.)
- 지역(local) 이름은 함수가 종료되면 리턴과 동시에 없어지므로 객체 이름 공간에 값을 저장해 두지 않으면 나중에 사용할 수 없다.
- 메쏘드를 인스턴스 객체를 통하여 직접 호출할 때는 첫번째 인수인 self는 없다고 생각하면 된다.
- 클래스의 멤버나 메쏘드를 참조하려면 언제나 self를 이용해야 한다.

Unbound Class Method 호출: 클래스 객체를 이용하여 메쏘드를 호출하는 것
Bound Instance Method 호출: 인스턴스를 통하여 자동으로 self인수를 전달하는 방식

Static Method 정적 메쏘드: 인스턴스 객체를 생성하지 않고도, 또는 인스턴스 객체를 이용하지 않고도 클래스 이름을 이용하여 직접 호출할 수 있는 메쏘드
Class Method

Class Member - 메쏘드 바깥에 정의된다.
Instance Member - 메쏘드 내부에서 self를 이용하여 정의된다.

Constructor 생성자: 인스턴스 객체가 생성될 때 초기화를 위해서 자동적으로 불려지는 초기화 함수
Destructor 소멸자: 인스턴스 객체가 사용이 끝나서 메모리에서 해체될 때 자원 해제를 위해서 자동으로 호출되는 함수

Reserved Words 예약어: 미리 어떤 기능이 정의된 경우
    eg1. __init__
    eg2. __del__







'Computation > Language' 카테고리의 다른 글

Python tutorials  (0) 2008.02.24
Using Python for CGI programming  (0) 2007.07.11
Python  (0) 2007.06.26
features of object-oriented programming  (0) 2007.06.20
내 컴퓨터에서 Processing의 source code 보기  (0) 2007.04.19
posted by maetel
2007. 6. 26. 11:00 Computation/Language
posted by maetel