오픈소스 까서 주석다는중인데..


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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
 
// #Geometry
// #adun.Geom
/**
 * 기하학과 기하학적 도형의 충돌을 다루는 클래스다.
 *
 * @module Adun
 * @submodule Geom
 */
(function(adun) {
    'use strict';
 
    var Geom = adun.Geom = {};
})(adun || (adun = {}));
 
// #AABB
/**
 * AABB(Axis Aligned Bounding Box)
 * 축 정렬 경계 박스
 * 2D 기준으로 x, y축에 평행한 경계를 만들어 낸다.
 * 장점: 충돌처리에 연산속도가 빠르며 직관적이다.
 * 단점: 회전하는 물체에 적합 하지않다.
 *
 * @Class AABB
 * @namespace Adun.Geom
 * @constructor
 * @param [cx=0] {Number} 박스 x축의 중앙 위치
 * @param [cy=0] {Number} 박스 y축의 중앙 위치
 * @param [width=0] {number} 박스의 넓이
 * @param [height=0] {number} 박스의 높이
 * @return {adun.Geom.AABB} AABB object
 */
(function(adun) {
    'use strict';
 
    var AABB = adun.Geom.AABB = adun.Class({
        TYPE: 'AABB',
 
        init: function(cx, cy, width, height) {
 
            /**
             * 박스 x축의 중앙 위치
             *
             * @property cx
             * @type {Number}
             * @default 0
             * @public
             */
            this.cx = 0;
 
            /**
             * 박스 y축의 중앙 위치
             *
             * @property cy
             * @type {Number}
             * @default 0
             * @public
             */
            this.cy = 0;
 
            /**
             * 박스 넓이의 절반
             *
             * @property halfWidth
             * @type {Number}
             * @default 0
             * @public
             */
            this.halfWidth = 0;
 
            /**
             * 박스 높이의 절반
             *
             * @property halfHeight
             * @type {Number}
             * @default 0
             * @public
             */
            this.halfHeight = 0;
 
 
            this.cx = cx || 0;
            this.cy = cy || 0;
            this.halfWidth = width / 2 || 0;
            this.halfHeight = height / 2 || 0;
        },
 
        height: {
            /**
             * 박스의 높이
             *
             * @property height
             * @type {Number}
             * @readyOnly
             * @public
             */
            get: function() {
                return this.halfWidth * 2;
            }
        },
 
        width: {
            /**
             * 박스의 넓이
             *
             * @property height
             * @type {Number}
             * @readyOnly
             * @public
             */
            get: function() {
                return this.width * 2;
            }
        },
 
        /**
         * 캔버스에 객체를 그린다.
         *
         * @method draw
         * @para ctx {CanvasRenderingContext2D} 그리고 싶은 캔버스의 컨텍스트
         * @return {adun.Geom.AABB}
         * @public
         */
        draw: function(ctx) {
            ctx.beginPath();
            ctx.moveTo(this.cx - this.halfWidth, this.cy);
            ctx.lineTo(this.cx + this.halfWidth, this.cy);
            ctx.moveTo(this.cx, this.cy - this.halfHeight);
            ctx.lineTo(this.cx, this.cy + this.halfHeight);
            ctx.stroke();
            return this;
        },
 
        /**
         * 객체의 새로운 위치를 설정한다.
         *
         * @method setPosition
         * @param cx {Number} 박스 x축의 새로운 중앙 위치
         * @param cy {Number} 박스 y축의 새로운 중앙 위치
         * @return {adun.Geom.AABB}
         * @public
         */
        set function(cx, cy) {
            this.cx = cx || 0;
            this.cy = cy || 0;
 
            return this;
        },
 
        /**
         * 객체의 새로운 위치를 포인트 객체로부터 설정한다.
         *
         * @method setPositionPoint
         * @param pos {adun.Geom.Point}
         * @return {adun.Geom.AABB}
         * @public
         */
        setPositionPoint: function(pos) {
            this.cx = pos.x;
            this.cy = pos.y;
 
            return this;
        },
 
        /**
         * Rectangle 객체로 반환한다.
         *
         * @method toRect
         * @return {adun.Geom.Rectangle}
         * @public
         */
        toRect: function() {
            return new adun.Geom.Rectangle(this.cx - this.halfWidth, this.cy - this.halfHeight, this.halfWidth * 2, this.halfHeight * 2);
        },
 
        /**
         * Rectangle으로부터 AABB의 치수를 받는다.
         *
         * @method setPositionPoint
         * @param rect {adun.Geom.Rectangle}
         * @return {adun.Geom.AABB}
         * @public
         */
        fromRect: function(rect) {
            this.halfWidth = rect.width / 2;
            this.halfHeight = rect.height / 2;
            this.cx = rect.x + this.halfWidth;
            this.cy = rect.y + this.halfHeight;
 
            return this;
        }
    });
 
})(adun || (adun = {}));
 
// #Circle
/**
 * Circle
 * 원
 * Circle 객체는 position에 의해 정의된 중싱점(x, y)과 직경을 가진다.
 *
 * @Class Circle
 * @namespace Adun.Geom
 * @constructor
 * @param [x=0] {Number} 원의 중앙 x좌표
 * @param [y=0] {Number} 원의 중앙 y좌표
 * @param [diameter=0]{Number} 원이 지름
 * @return {adun.Geom.Circle} Circle object
cs

이렇게 주석 계속달아서 스터디에 발표할건데


그림같은거 다로 피료없겠지?