1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
     * interpolation(보간): 두 점을 연결하는 방법을 의미한다.
     *
     * 지정한 두 Point 객체 사이의 부분을 반환한다..
     * 매개변수 f는 pointA와 pointB로 지정된 위치에 상대적으로 어디에 위치잘히를 결정한다.
     *
     * 매개변수 f값은 0 ~ 1 이다.
     * 1에 가까울수록 pointA에 가깝다.
     * 0에 가까울수록 pointB에 가깝다.
     *
     *
     * @method interplate
     * @param pointA {adun.Geom.Point}
     * @param pointB {adun.Geom.Point}
     * @param f {Number} 두점 사이의 보간 수준이다. 새로운지점과, pt1, pt2, 사이의 선을 따를것이다 만약 f=1이면 pointA가 반환되고 f=0이며 fointB가 반환된다.
     * @return {adun.Geom.Point}
     */
    Point.interpolate = function(pointA, pointB, f) {
        var xDiff = pointB.x - pointA.x;
        var yDiff = pointB.y - pointA.y;
 
        return new adun.Geom.Point(pointB.x - xDiff * f, pointB.y - yDiff * f);
    }
cs