블로그 이미지
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

2008. 3. 18. 23:24 Computation/Language
C, 자바, 포트란으로 만들어진 산업 표준 IMSL 수치 라이브러리
http://www.vni.co.kr/products/imsl/documentation/index.html


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

visual c++ solution - dsw  (0) 2008.08.12
16진수 10진수로 변환 strtol()  (0) 2008.08.12
Python tutorials  (0) 2008.02.24
Using Python for CGI programming  (0) 2007.07.11
classes in Python  (0) 2007.07.11
posted by maetel
2008. 2. 27. 00:46 Computation
두 단어 사이의 연관도를 서베이를 통해 측정하여 3D로 보여 준다???
그럼 semantic?

'Computation' 카테고리의 다른 글

OpenFrameworks  (2) 2008.06.18
Conceptual Wavelets  (0) 2008.05.27
Physical Computing  (0) 2007.11.17
Visualization Toolkit (VTK)  (0) 2007.07.09
Fundamentals of network media  (0) 2007.05.29
posted by maetel
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
2007. 12. 29. 01:07 Computation/Algorithm
http://en.wikipedia.org/wiki/Fractal_flame
Fractal flames are a member of the iterated function system class of fractals created by Scott Draves in 1992.

invalid-file

The Fractal Flame Algorithm


Apophysis
Oxidizer

Fractal Software Programs & Links on Paul N. Lee's website

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

(ref) A Multi-Resolution Video Scheme for Multimedia Information Servers in Mobile Computing Environment  (0) 2008.05.21
sorting algorithms  (0) 2008.03.24
steering vector  (0) 2007.06.25
Boids  (0) 2007.06.21
Particle System  (0) 2007.04.30
posted by maetel
2007. 12. 10. 01:56 Computation/HCI

http://compatibleincompatible.synesthesie.com/stelagb.html


posted by maetel
2007. 11. 21. 11:29 Computation/HCI
A New Vision for Pervasive Computing: Moving Beyond Sense and Send
http://www.sensorsmag.com/sensors/article/articleDetail.jsp?id=467493


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

Intelligent / smart environment  (0) 2009.02.14
VRML (Virtual Reality Modeling Language)  (0) 2008.07.09
Body without entity  (0) 2007.12.10
Making Scents: aromatic output for HCI  (0) 2007.02.25
Humane Interface (by Jef Raskin)  (0) 2006.04.26
posted by maetel
2007. 11. 17. 12:00 Computation

'Computation' 카테고리의 다른 글

Conceptual Wavelets  (0) 2008.05.27
Galileo Method  (0) 2008.02.27
Visualization Toolkit (VTK)  (0) 2007.07.09
Fundamentals of network media  (0) 2007.05.29
Name Server 변경  (0) 2007.05.18
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. 7. 9. 17:07 Computation
VTK
Developer: Kitware Inc.
Latest release: 5.0.2
OS: Cross-platform
Available language(s): C++, Tcl, Python, Java
Genre: Scientific visualization
License: BSD-like
Website: www.vtk.org
ref. wikipedia: VTK

VTK is an open source, freely available software system for 3D computer graphics, image processing, and visualization.
invalid-file

<The Design and Implementation Of An Object-Oriented Toolkit For 3D Graphics and Visualization> William J. Schroeder, Kenneth M. Martin, William E. Lorensen (GE Corporate Research & Development)


파이썬 마을>jrcho의 VTK의 소개

'Computation' 카테고리의 다른 글

Galileo Method  (0) 2008.02.27
Physical Computing  (0) 2007.11.17
Fundamentals of network media  (0) 2007.05.29
Name Server 변경  (0) 2007.05.18
physics engine  (0) 2007.05.03
posted by maetel
2007. 6. 26. 11:00 Computation/Language
posted by maetel
2007. 6. 25. 15:29 Computation/Algorithm
"Steering behaviors" are largely independent of the particulars of the character's means of locomotion.

(1)maximum speed and (2)maximum steering force
(3)a method to compute a steering vector towards a given target location

ref.
www.red3d.com/cwr/steer/
www.shiffman.net/teaching/nature/steering/


Steering Vector = “Desired Vector” minus “Velocity”

where “desired vector” is defined as the vector pointing from the object’s location directly towards the target

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

sorting algorithms  (0) 2008.03.24
fractal flame  (0) 2007.12.29
Boids  (0) 2007.06.21
Particle System  (0) 2007.04.30
Pseudo-random  (0) 2007.04.27
posted by maetel
2007. 6. 21. 16:19 Computation/Algorithm
Boids, developed by Craig Reynolds in 1986, is an artificial life program, simulating the flocking behaviour of birds.

As with most artificial life simulations, Boids is an example of emergent behaviour; that is, the complexity of Boids arises from the interaction of individual agents (the boids, in this case) adhering to a set of simple rules.

The movement of Boids can either be characterized as chaotic (splitting groups and wild behaviour) or orderly. Unexpected behaviours, such as splitting flocks and reuniting after avoiding obstacles, can be considered emergent.

The boids framework is often used in computer graphics, providing realistic-looking representations of flocks of birds and other creatures, such as schools of fish or herds of animals.

Boids work in a manner similar to cellular automata, since each boid "acts" autonomously and references a neighbourhood, as do cellular automata.

Craig W. Reynolds called the generic simulated flocking creatures boids. The basic flocking model consists of three simple steering behaviors which describe how an individual boid maneuvers based on the positions and velocities its nearby flockmates.

ref.
Conrad Parker  http://www.vergenet.net/~conrad/boids/
    Boids Pseudocode, the boids algorithm explained with the use of pseudocode

initialise_positions()

LOOP
draw_boids()
move_all_boids_to_new_positions()
END LOOP

	PROCEDURE move_all_boids_to_new_positions()

Vector v1, v2, v3
Boid b

FOR EACH BOID b
v1 = rule1(b)
v2 = rule2(b)
v3 = rule3(b)

b.velocity = b.velocity + v1 + v2 + v3
b.position = b.position + b.velocity
END

END PROCEDURE

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

fractal flame  (0) 2007.12.29
steering vector  (0) 2007.06.25
Particle System  (0) 2007.04.30
Pseudo-random  (0) 2007.04.27
noise  (0) 2007.04.21
posted by maetel
2007. 6. 20. 19:39 Computation/Language
Object-oriented programming (OOP) is a programming paradigm that uses "objects" to design applications and computer programs. It uses several techniques from previously established paradigms, including inheritance, modularity, polymorphism, and encapsulation.
Object-oriented programming may be seen as a collection of cooperating objects, as opposed to a traditional view in which a program may be seen as a list of instructions to the computer. In OOP, each object is capable of receiving messages, processing data, and sending messages to other objects. Each object can be viewed as an independent little machine with a distinct role or responsibility.

#
In object-oriented programming, inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. The new classes, known as derived classes, take over (or inherit) attributes and behavior of the pre-existing classes, which are referred to as base classes (or ancestor classes). It is intended to help reuse existing code with little or no modification.

#
In object-oriented programming, a class is a programming language construct that is used to group related instance variables and methods. A method, called a function in some languages, is a set of instructions that are specific to a class. Depending on the language, classes may support multiple inheritance or may require the use of interfaces to extend other classes. A class may indicate either specifically or abstractly what methods exist when the program is executed. The latter is known as an 'abstract class'. A class must be defined with a constructor if it is to be used as an object, that is, instantiated. However some classes, especially those containing factory methods, are defined as static classes with no constructor merely to organize data hierarchically (e.g. the Math class may contain the static constant PI and the static method abs).

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

classes in Python  (0) 2007.07.11
Python  (0) 2007.06.26
내 컴퓨터에서 Processing의 source code 보기  (0) 2007.04.19
<HeadFirst Java> 클래스와 객체  (0) 2007.03.16
Java tutorials  (0) 2007.02.28
posted by maetel
2007. 5. 29. 03:16 Computation
Fundamentals of network media
Basic course in data communications and networked digital media. Networking and data communications discussed from viewpoints of computer and telecommunication networks. Computer graphics and virtual reality. Digital media and production of contents.

-> read Lectures

'Computation' 카테고리의 다른 글

Physical Computing  (0) 2007.11.17
Visualization Toolkit (VTK)  (0) 2007.07.09
Name Server 변경  (0) 2007.05.18
physics engine  (0) 2007.05.03
shiffman's ICM @NYU  (0) 2006.04.11
posted by maetel
2007. 5. 18. 00:42 Computation
ref. Powered by DNS

안녕하세요. DNS에버입니다.

도메인에 대한 네임서버 변경은 그 내용이 전파되는데에는 최대 2~3일 걸릴
수 있습니다.
whois 서버에 업데이트는 즉시 되더라도, 네임서버에 바로 업데이트되는 것이
아니고, 도메인의 종류(.com .kr)에 따라 하루에 1~3번 사이만 업데이트되어
루트서버에 입력이되고,
또한 전세계 DNS에 남아 있는 cache 내용이 사라지려면 2~3일 걸릴 수 있는 것
입니다. ( 해당내용은 여기 게시판에 여러번 설명되어 있으므로 참조하십시오)

nslookup 으로 확인했을 때, 서버가 죽어있는 것으로 나온 것

C:\>nslookup -q=A www.interwhite.net ns1.dnsever.com
*** Can't find server name for address 222.231.0.1: Server failed
Server:  UnKnown
Address:  222.231.0.1

Name:    www.interwhite.net
Address:  211.172.252.15

위와 같이 나오는 것은 DNS서버가 죽은 것이 아니라,
도스창의 nslookup 은 DNS의 reverse 네임까지 불필요하게 쿼리를 해서
나오는 현상인 것입니다.  ( 오해의 소지가 있을까바
해당 문제 발생하지 않도록 조치를 했습니다. )

위와 같이 확인해보면 , 회원님의 도메인 www.interwhite.net 의
IP주소가 제대로 나오는 것을 확인하실 수 있을 것입니다.



metel wrote..
: 도메인 주소로 연결이 되지 않습니다.
: 네임서버를 dnsever로 옮기고, whois에서 확인을 해 보니 잠시 후 변경이 되 었
: 더군요.
: 그런데 막상 연결이 되지 않아 안내대로 nslookup으로 확인을 했더니
: 서버가 죽어 있다고 나옵니다.
: 도메인을 구입한 업체에 문의했더니 이쪽에서 알아보라고 하네요.
: 도메인 이름은   interwhite.net   입니다.
: 어떻게 된 일인지 빠른 답변 부탁드립니다.

TTL: Short for Time to Live, a field in the Internet Protocol (IP) that specifies how many more hops a packet can travel before being discarded or returned.


'Computation' 카테고리의 다른 글

Visualization Toolkit (VTK)  (0) 2007.07.09
Fundamentals of network media  (0) 2007.05.29
physics engine  (0) 2007.05.03
shiffman's ICM @NYU  (0) 2006.04.11
Ajax and Web 2.0  (0) 2006.03.27
posted by maetel
2007. 5. 3. 16:00 Computation
engine:
The code or software used as the basis for building a game. The game engine literally powers the entire game. Some developers license a game engine to other developers who build a new game based on the technology of the game engine.


Physics_engine



    eg. List_of_games_using_physics_engines

    cf. Game_engine
Despite the specificity of the name, game engines are often used for other kinds of interactive applications with real-time graphical requirements such as marketing demos, architectural visualizations, training simulations, and modeling environments.     

'Computation' 카테고리의 다른 글

Fundamentals of network media  (0) 2007.05.29
Name Server 변경  (0) 2007.05.18
shiffman's ICM @NYU  (0) 2006.04.11
Ajax and Web 2.0  (0) 2006.03.27
code search engine  (0) 2006.02.18
posted by maetel
2007. 4. 30. 17:52 Computation/Algorithm
The term “particle system” was coined in 1983 by William T. Reeves as he worked to create the “Genesis” effect at the end of the movie, Star Trek II: The Wrath of Khan.

ref.
traer.physics

“A particle system is a collection of many many minute particles that together represent a fuzzy object. Over a period of time, particles are generated into a system, move and change from within the system, and die from the system.”
invalid-file

Willian T. Reeves <Particle Systems—a Technique for Modeling a Class of Fuzzy Objects>

ref.
Siggraph: Particle Systems
Evans & Sutherland @http://www.es.com



invalid-file

Karl Sims <Particle animation and rendering using data parallel computation>

http://doi.acm.org/10.1145/97879.97923
ref.
Karl Sims home page
wikipedia: Karl Sims

invalid-file

Alain Fournier (University of Toronto) & Don Fussell (The University of Texas at Austin) & Loren Carpenter (Lucasfilm) <Computer Rendering of Stochastic Models>

http://doi.acm.org/10.1145/358523.358553


TGLTLSBFSSP: Models
wikipedia: Particle_system
Lucasfilm Ltd. @http://www.lucasfilm.com
GenArts @http://www.genarts.com

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

steering vector  (0) 2007.06.25
Boids  (0) 2007.06.21
Pseudo-random  (0) 2007.04.27
noise  (0) 2007.04.21
Perlin Noise  (0) 2007.04.21
posted by maetel
2007. 4. 27. 20:50 Computation/Algorithm
http://en.wikipedia.org/wiki/Pseudo-random

http://en.wikipedia.org/wiki/Pseudo-random_number


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

steering vector  (0) 2007.06.25
Boids  (0) 2007.06.21
Particle System  (0) 2007.04.30
noise  (0) 2007.04.21
Perlin Noise  (0) 2007.04.21
posted by maetel
2007. 4. 21. 18:43 Computation/Algorithm

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

steering vector  (0) 2007.06.25
Boids  (0) 2007.06.21
Particle System  (0) 2007.04.30
Pseudo-random  (0) 2007.04.27
Perlin Noise  (0) 2007.04.21
posted by maetel
2007. 4. 21. 18:01 Computation/Algorithm
Improved Noise
-> Java ref.
invalid-file

the algorithm Ken Perlin described in the SIGGRAPH 2002 paper


Making Noise Ken Perlin talk on noise.
wikipedia: Perlin noise

Perlin Noise code:
http://www.texturingandmodeling.com/CODE/PERLIN/PERLIN.C
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

float bias(float a, float b)
{
return pow(a, log(b) / log(0.5));
}

float gain(float a, float b)
{
float p = log(1. - b) / log(0.5);

if (a < .001)
return 0.;
else if (a > .999)
return 1.;
if (a < 0.5)
return pow(2 * a, p) / 2;
else
return 1. - pow(2 * (1. - a), p) / 2;
}

float noise1(float arg);
float noise2(float vec[]);
float noise3(float vec[]);

float noise(float vec[], int len)
{
switch (len) {
case 0:
return 0.;
case 1:
return noise1(vec[0]);
case 2:
return noise2(vec);
default:
return noise3(vec);
}
}

float turbulence(float *v, float freq)
{
float t, vec[3];

for (t = 0. ; freq >= 1. ; freq /= 2) {
vec[0] = freq * v[0];
vec[1] = freq * v[1];
vec[2] = freq * v[2];
t += fabs(noise3(vec)) / freq;
}
return t;
}

/* noise functions over 1, 2, and 3 dimensions */

#define B 0x100
#define BM 0xff

#define N 0x1000
#define NP 12 /* 2^N */
#define NM 0xfff

static p[B + B + 2];
static float g3[B + B + 2][3];
static float g2[B + B + 2][2];
static float g1[B + B + 2];
static start = 1;

static void init(void);

#define s_curve(t) ( t * t * (3. - 2. * t) )

#define lerp(t, a, b) ( a + t * (b - a) )

#define setup(i,b0,b1,r0,r1)\
t = vec[i] + N;\
b0 = ((int)t) & BM;\
b1 = (b0+1) & BM;\
r0 = t - (int)t;\
r1 = r0 - 1.;

float noise1(float arg)
{
int bx0, bx1;
float rx0, rx1, sx, t, u, v, vec[1];

vec[0] = arg;
if (start) {
start = 0;
init();
}

setup(0, bx0,bx1, rx0,rx1);

sx = s_curve(rx0);

u = rx0 * g1[ p[ bx0 ] ];
v = rx1 * g1[ p[ bx1 ] ];

return lerp(sx, u, v);
}

float noise2(float vec[2])
{
int bx0, bx1, by0, by1, b00, b10, b01, b11;
float rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
register i, j;

if (start) {
start = 0;
init();
}

setup(0, bx0,bx1, rx0,rx1);
setup(1, by0,by1, ry0,ry1);

i = p[ bx0 ];
j = p[ bx1 ];

b00 = p[ i + by0 ];
b10 = p[ j + by0 ];
b01 = p[ i + by1 ];
b11 = p[ j + by1 ];

sx = s_curve(rx0);
sy = s_curve(ry0);

#define at2(rx,ry) ( rx * q[0] + ry * q[1] )

q = g2[ b00 ] ; u = at2(rx0,ry0);
q = g2[ b10 ] ; v = at2(rx1,ry0);
a = lerp(sx, u, v);

q = g2[ b01 ] ; u = at2(rx0,ry1);
q = g2[ b11 ] ; v = at2(rx1,ry1);
b = lerp(sx, u, v);

return lerp(sy, a, b);
}

float noise3(float vec[3])
{
int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
register i, j;

if (start) {
start = 0;
init();
}

setup(0, bx0,bx1, rx0,rx1);
setup(1, by0,by1, ry0,ry1);
setup(2, bz0,bz1, rz0,rz1);

i = p[ bx0 ];
j = p[ bx1 ];

b00 = p[ i + by0 ];
b10 = p[ j + by0 ];
b01 = p[ i + by1 ];
b11 = p[ j + by1 ];

t = s_curve(rx0);
sy = s_curve(ry0);
sz = s_curve(rz0);

#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )

q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
a = lerp(t, u, v);

q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
b = lerp(t, u, v);

c = lerp(sy, a, b);

q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
a = lerp(t, u, v);

q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
b = lerp(t, u, v);

d = lerp(sy, a, b);

return lerp(sz, c, d);
}

static void normalize2(float v[2])
{
float s;

s = sqrt(v[0] * v[0] + v[1] * v[1]);
v[0] = v[0] / s;
v[1] = v[1] / s;
}

static void normalize3(float v[3])
{
float s;

s = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
v[0] = v[0] / s;
v[1] = v[1] / s;
v[2] = v[2] / s;
}

static void init(void)
{
int i, j, k;

for (i = 0 ; i < B ; i++) {
p[i] = i;

g1[i] = (float)((random() % (B + B)) - B) / B;

for (j = 0 ; j < 2 ; j++)
g2[i][j] = (float)((random() % (B + B)) - B) / B;
normalize2(g2[i]);

for (j = 0 ; j < 3 ; j++)
g3[i][j] = (float)((random() % (B + B)) - B) / B;
normalize3(g3[i]);
}

while (--i) {
k = p[i];
p[i] = p[j = random() % B];
p[j] = k;
}

for (i = 0 ; i < B + 2 ; i++) {
p[B + i] = p[i];
g1[B + i] = g1[i];
for (j = 0 ; j < 2 ; j++)
g2[B + i][j] = g2[i][j];
for (j = 0 ; j < 3 ; j++)
g3[B + i][j] = g3[i][j];
}
}


Ken Perlin
http://en.wikipedia.org/wiki/Ken_Perlin
http://mrl.nyu.edu/%7Eperlin/

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

steering vector  (0) 2007.06.25
Boids  (0) 2007.06.21
Particle System  (0) 2007.04.30
Pseudo-random  (0) 2007.04.27
noise  (0) 2007.04.21
posted by maetel
2007. 4. 19. 03:29 Computation/Language
processing.org 홈페이지의 http://dev.processing.org/source/가 아닌 내 컴퓨터의 하드에서 Processing의 source code를 보자.
(cp. Index of /trunk/processing/core/src/processing/core)


1. source code 받기

기본으로는 소스코드를 받지 않고 바로 실행모듈을 받는 거니까 지금 내 컴퓨터에는 소스코드가 없다. 그래서 우선 소스코드를 따로 받아야 한다.

1) 우선 CVS 프로그램을 설치해야 한다.
terminal에서 'cvs'라고 쳤더니 Usage가 나왔다. 컴퓨터에 CVS가 설치되어 있다는 뜻이다.
cf. CVS란? Concurrent Versions System -> def. and Gnu's intro
(공동 버전 시스템: 각종 소스의 버전을 관리할 수 있도록 도와주는 도구. 공동으로 진행하는 프로젝트 수행자들에게 편리한 도구로, Apache, Mozilla 등의 공개 프로젝트에서 사용되어 그 효능을 입증하였고, 우리나라에서도 KLDP(Korean Linux Documentation Project), JS Board 등의 공동 개발 작업에서 사용되고 있다.)

2) 그리고 SVN (Subversion) 프로그램을 설치해야 한다.
ref. http://dev.processing.org/build/
terminal에서 'svn'이라고 쳤더니 에러 메시지가 떴다. 컴퓨터에 SVN이 없기 때문이므로 여기에서 다운 받았다.

3) source code를 받는다.
terminal에서 'svn co svn://processing.org/trunk/processing'을 입력한다. svn://processing.org/trunk/processing 의 코드트리를 check-out (co) 하라는 명령이다.


2. 명령어 배우기

0) pwd - "print working directory"라고 지금 터미널이 어느 디렉토리(폴더)에 있는지 보여 주는 명령
eg. terminal에서 'pwd'를 쳤더니 /Users/lym라고 나왔다는 것은 지금 홈 디렉토리에 있다는 뜻이다.

1) grep - 텍스트 검색 명령
파일 (리스트) 에서 "PATTERN"을 찾는다. 특정한 파일에서 주어진 문장을 검색하는 기능인데 파일 뿐만 아니라 디렉토리를 통째로 검색할 수 있다.
옵션 중에 -R (recursive) 옵션을 쓰면 디렉토리 밑으로 끝까지 찾아 들어간다.
bzgrep, zgrep 등은 압축된 파일에서 찾을 때 쓴다.
eg. 'grep -R constrain processing'이라고 치면, processing 디렉토리 밑의 모든 파일에서 "constrain"이라는 문자열을 찾아 그 파일과 문자열이 있는 줄을 보여 준다.

2) man - 모든 명령과 프로그램의 매뉴얼 페이지를 보여 준다.
eg. 'man grep'이라 치면, grep이 구체적으로 뭘 하는 프로그램이며 어떻게 써 먹는지를 볼 수 있다.

3) apropos - 이 매뉴얼 페이지 중 한줄 요약 리스트를 검색한다.
뭔가 필요한 기능이 있는데 명령이나 프로그램을 모르면 apropos로 원하는 기능을 가진 명령이 있는지 찾아 보고, 있으면 man 으로 그 매뉴얼을 봐서 쓰면 된다.
eg. 뭔가를 검색하고 싶다면 일단 'apropos search'라고 하자. 그러면 매뉴얼 요약 중에 'search'라는 단어가 있는 명령어는 모두 보여 준다.

Tip. apropos 의 출력이 너무 많으면 grep으로 한번 더 "필터링"을 할 수 있다.
예로 다시 grep을 들면, search 외에 file 이라는 키워드도 생각할 수 있겠다.
그럼 'apropos search | grep file'이라고 하면 apropos 의 출력 중에 "file"이라는 단어가 있는 줄만 보여 준다.
cf. ' | ' 는 'pipe'라고 해서 유닉스의 기본 기능 중 하나인데 파이프 왼쪽의 출력을 오른쪽의 입력으로 돌리는 것이다.

4) h 또는 ? 또는 ctrl-C - help


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

Python  (0) 2007.06.26
features of object-oriented programming  (0) 2007.06.20
<HeadFirst Java> 클래스와 객체  (0) 2007.03.16
Java tutorials  (0) 2007.02.28
The Java™ Tutorials  (0) 2007.02.28
posted by maetel
2007. 3. 16. 10:16 Computation/Language
61p
객체 마을로의 여행

constructor(생성자), method(함수), property(변수, 객체)
    cf. instance

절차 지향/객체 지향

 
 procedure
"프로그램이라는 것은 결국은 프로시저를 모아놓은 것"
= Subroutine or method (computer science)
(1) Same as routine, subroutine, and function. A procedure is a section of a program that performs a specific task.
(2) An ordered set of tasks for performing some action.
   
     subroutine http://en.wikipedia.org/wiki/Subroutine
    a portion of code within a larger program, which performs a specific task and is relatively independent of the remaining code.   

 object
Generally, any item that can be individually selected and manipulated. This can include shapes and pictures that appear on a display screen as well as less tangible software entities. In object-oriented programming, for example, an object is a self-contained entity that consists of both data and procedures to manipulate the data.
http://en.wikipedia.org/wiki/Object_%28computer_science%29
http://java.sun.com/docs/books/tutorial/java/concepts/object.html

 method
 In object-oriented programming, a procedure that is executed when an object receives a message. A method is really the same as a procedure, function , or routine in procedural programming languages. The only difference is that in object-oriented programming, a method is always associated with a class.

 instance
(1) 일반적으로 어떤 집합에 대해서, 그 집합의 개별적인 요소. 객체 지향 프로그래밍(OOP)에서, 어떤 등급에 속하는 각 객체를 인스턴스라고 한다. 예를 들면 ‘목록(list)’이라는 등급을 정의하고 그 다음에 ‘본인 목록(my list)’이라는 객체를 생성(기억 장치 할당)하면 그 등급의 인스턴스가 생성된다. 또한 변수가 포함되어 있는 어떤 논리식의 변수에 구체적인 값을 대입하여 식을 만들면 원래 식의 인스턴스가 만들어진다. 이런 의미에서 인스턴스를 실현치라고 한다.
(2) 프로그램 작성 언어 에이다(Ada)에서 매개 변수를 사용해서 절차를 일반적으로 정의한 범용체(generic package)에 대해, 그것으로부터 도출한 구체적인 실체.

 constructor 생성자 生成子
객체 지향 프로그래밍(OOP:objective-oriented programming)에서 쓰이는 객체 초기화 함수. 객체의 생성 시에만 호출되어 메모리 생성과 동시에 객체의 데이터를 초기화하는 역할을 한다.
: 객체를 처음 생성할 때 자동으로 만들어지는 함수.
<=
class의 속성을 정의해 주는 것이 constructor(생성자)이다.



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

features of object-oriented programming  (0) 2007.06.20
내 컴퓨터에서 Processing의 source code 보기  (0) 2007.04.19
Java tutorials  (0) 2007.02.28
The Java™ Tutorials  (0) 2007.02.28
The Java Technology  (0) 2007.02.28
posted by maetel
2007. 2. 28. 12:55 Computation/Language

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

내 컴퓨터에서 Processing의 source code 보기  (0) 2007.04.19
<HeadFirst Java> 클래스와 객체  (0) 2007.03.16
The Java™ Tutorials  (0) 2007.02.28
The Java Technology  (0) 2007.02.28
<HeadFirst Java>  (0) 2006.07.13
posted by maetel
2007. 2. 28. 04:27 Computation/Language

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

<HeadFirst Java> 클래스와 객체  (0) 2007.03.16
Java tutorials  (0) 2007.02.28
The Java Technology  (0) 2007.02.28
<HeadFirst Java>  (0) 2006.07.13
Java  (0) 2006.05.17
posted by maetel