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

void javamorph::CTriangle::calculateXBounds ( int  y  )  [inline, private]

Calculate left & right edge point of the scan line. The scan line must cross two of the three edges. Seldom the scan line crosses one edge + two end points of the other both edges.

Parameters:
y Vertical position of the scan line.

Definition at line 163 of file CTriangle.java.

References getXIntersection(), p, x_max, and x_min.

Referenced by CTriangle().

                                        {
        int 
            x1 = getXIntersection(y, p[0], p[1]),
            x2 = getXIntersection(y, p[0], p[2]),
            x3 = getXIntersection(y, p[1], p[2]);
        if(Integer.MIN_VALUE == x1)
        {
            this.x_min = Math.min(x2, x3);
            this.x_max = Math.max(x2, x3);
        }else if(Integer.MIN_VALUE == x2){
            this.x_min = Math.min(x1, x3);
            this.x_max = Math.max(x1, x3);
        }else if(Integer.MIN_VALUE == x3){
            this.x_min = Math.min(x2, x1);
            this.x_max = Math.max(x2, x1);
        }else if(x1 != x2){
            this.x_min = Math.min(x2, x1);
            this.x_max = Math.max(x2, x1);
        }else if(x1 != x3){
            this.x_min = Math.min(x3, x1);
            this.x_max = Math.max(x3, x1);
        }else if(x3 != x2){
            this.x_min = Math.min(x2, x3);
            this.x_max = Math.max(x2, x3);
        }
    }


Generated by  Doxygen 1.6.0   Back to index