// #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;



-----------------------


// #Matrix

/**

 * Matrix

 * 행렬

 * 2D 변환행렬을 나타낸다.

 * 다른 좌표 사이의 공간을 매핑 하는데 사용될 수 있다.

 * 매트릭스는 Transform에 의해 사용되어진다.

 * 행렬 객체는 물체가 세계의 어디나 또는 카메라의 어디에있는지 확인하기 위해 위치, 스케일및 회전 변화를 나타낸다.

 *

 * 참고: https://www.en.wikipedia.org/wiki/Transformation_matrix#

 * 참고: https://www.en.wikipedia.org/wiki/Transformation_matrix#/media/File:2D_affine_transformation_matrix.svg

 *

 * 2D 변환 행렬을 나타낸다.

 * HTML canvas transform() Method에 사용.

 * void ctx.transform(a, b, c, d, e, f)

 * [a   b]

 * [c   d]

 * [tx ty]

 * - basic -

 * [1  0]

 * [0  1]

 * [0  0]

 *

 *

 * a (m11) => Horizonatal scaling => y축 scale

 * b (m12) => Horizonatal skewing => y축 rotate

 * c (m21) => Vertical skewing => x축 rotate

 * d (m22) => Vertical scaling => x축 scale

 * tx (tx)  => Horizonatal moving => x축 이동

 * ty (ty)  => Vertical moving => y축 이동

 *

 * 번외 행렬 변환

 *

 * [x  x]

 * [y  y]

 *

 * [k  0] [x]    =>[kx]

 * [0  k] [y]    =>[ky]    k배 확대 닮은 변환 행렬

 *

 *

 * [1  0][x]     =>[x]

 * [0 -1][y]     =>[-y]   x축 대칭 행렬

 *

 *

 * [-1 0][x]     =>[-x]

 * [0  1][y]     =>[y]    y축 대칭 행렬

 *

 *

 * [-1 0][x]     => [-x]

 * [0 -1][y]     => [-y]  원점 대칭 행렬

 *

 *

 * [0  1][x]     => [y]

 * [1  0][y]     => [x]   y=x 대칭 변환 행렬

 *

 *

 * [0 -1][x]     => [-y]

 * [-1 0][y]     => [-x]   y=-x 대칭 변환 행렬

 *

 *

 * [cosΘ  -sinΘ] [x]    =>  [x']

 * [sinΘ   cosΘ] [y]    =>  [y']   Θ만틈 반시계 방향으로 회전한 회전변환 행렬

 *

 * [cosΘ  sinΘ] [x]    =>  [x']

 * [-sinΘ cosΘ] [y]    =>  [y']   Θ만틈 시계 방향으로 회전한 회전변환 행렬

 *

 *

 *

 * [a, c, tx]

 * [b, d, ty]

 *

 * [1, 0, 0]

 * [0, 1, 1]

 *

 *

 * @class Matrix

 * @namespace adun.Geom

 * @constructor

 * @param [a=1] {Number} Horizonatal scaling => y축 scale

 * @param [b=0] {Number} Horizonatal skewing => y축 rotate

 * @param [c=0] {Number} Vertical skewing => x축 rotate

 * @param [d=1] {Number} Vertical scaling => x축 scale

 * @param [tx=0] {Number} Horizonatal moving => x축 이동

 * @param [ty=0] {Number} Vertical moving => y축 이동

 * @reutn {adun.Geom.Matrix} This object

 */

(function() {

    'use strict';

    var Matrix = adun.Geom.Matrix = adun.Class({

        TYPE: 'Matrix',


        init: function(a, b, c, d, tx, ty) {

            this.a = 1;

            this.b = 0;

            this.c = 0;

            this.d = 1;

            this.tx = 0;

            this.ty = 0;


            this.setTo(a, b, c, d, tx, ty);

        },


        setTo: function(a, b, c, d, tx, ty) {

            this.a = a || 1;

            this.b = b || 0;

            this.c = c || 0;

            this.d = d || 1;

            this.tx = tx || 0;

            this.ty = ty || 0;

        },



죄송합니다 죄송합니다.