src/jtwod/engine/metrics/Vector.java
public final Vector constrain(Vector min, Vector max)
    {
        if (this.x < min.x - min.bufferX) {
            this.x = min.x - min.bufferX;
        }

        if (this.y < min.y - min.bufferY) {
            this.y = min.y - min.bufferY;
        }

        if (this.x > max.x + max.bufferX) {
            this.x = max.x + max.bufferX;
        }

        if (this.y > max.y + max.bufferY) {
            this.y = max.y + max.bufferY;
        }

        return this;
    }
/**
     * Constrain this vector to a specific max and min constraint.
     *
     * @param min The minimum constraint to use.
     * @param max The maximum constraint to use.
     *
     * @return Vector This Vector.
     */
Constrain this vector to a specific max and min constraint.

@param min The minimum constraint to use.
@param max The maximum constraint to use.

@return Vector This Vector.
Constrain this vector to a specific max and min constraint . @param min The minimum constraint to use . @param max The maximum constraint to use . @return Vector This Vector .
public final Vector constrain(Vector min, Vector max)
    {
        if (this.x < min.x - min.bufferX) {
            this.x = min.x - min.bufferX;
        }
        if (this.y < min.y - min.bufferY) {
            this.y = min.y - min.bufferY;
        }
        if (this.x > max.x + max.bufferX) {
            this.x = max.x + max.bufferX;
        }
        if (this.y > max.y + max.bufferY) {
            this.y = max.y + max.bufferY;
        }
        return this;
    }
public final Vector constrain ( Vector min , Vector max ) { if ( this . x < min . x - min . bufferX ) { this . x = min . x - min . bufferX ; } if ( this . y < min . y - min . bufferY ) { this . y = min . y - min . bufferY ; } if ( this . x > max . x + max . bufferX ) { this . x = max . x + max . bufferX ; } if ( this . y > max . y + max . bufferY ) { this . y = max . y + max . bufferY ; } return this ; }
Constrain this vector to a specific max and min constraint.
Constrain this vector to a specific max and min constraint .