Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

javamorph::CTriangle::CTriangle ( Point  _p0,
Point  _p1,
Point  _p2 
) [inline]

Copy constructor.

Parameters:
_p0 First of the three points.
_p1 Second of the three points.
_p2 Third of the three points

Definition at line 43 of file CTriangle.java.

References c, calculateXBounds(), p, withins, x_max, x_min, y_max, and y_min.

                                                     {
       Vector<Point> v = new Vector<Point>();
        p[0].x = _p0.x;
        p[0].y = _p0.y;
        p[1].x = _p1.x;
        p[1].y = _p1.y;
        p[2].x = _p2.x;
        p[2].y = _p2.y;
        c[0].x = _p0.x;
        c[0].y = _p0.y;
        c[1].x = _p1.x;
        c[1].y = _p1.y;
        c[2].x = _p2.x;
        c[2].y = _p2.y;
        Arrays.sort(c, this);
        /* Calculate the y range. */
        for(int i = 0;i < 3; ++i){
            this.y_min = Math.min(this.y_min, p[i].y);
            this.y_max = Math.max(this.y_max, p[i].y);
        }
        /* For all horizontal lines. */
        for(int y = this.y_min; y <= this.y_max; ++y){
            /* Calculate the x range. */
            this.calculateXBounds(y);
            /* For all points of the horizontal line. */
            for(int x = this.x_min; x <= this.x_max; ++x){
                /* Add within - point. */
                Point pt = new Point();
                pt.x = x;
                pt.y = y;
                v.add(pt);
            }
        }
        this.withins = new Point[v.size()];
        /* Make vector to array. */
        v.toArray(this.withins);
    }


Generated by  Doxygen 1.6.0   Back to index