src/main/java/kweimann/mezzure/model/Element1D.java
/* returns the smallest displacement between the most outer points of this element and another element */
returns the smallest displacement between the most outer points of this element and another element
returns the smallest displacement between the most outer points of this element and another element
default int displacement(Element1D element) {
        int thisCenter = this.center() * 2 + (this.length() % 2 == 0 ? 0 : 1);
        int thatCenter = element.center() * 2 + (element.length() % 2 == 0 ? 0 : 1);
        if (Math.abs(thatCenter - thisCenter) > element.length() + this.length()) {
            return thatCenter >= thisCenter
                    ? ((thatCenter - element.length()) - (thisCenter + this.length())) / 2
                    : ((thatCenter + element.length()) - (thisCenter - this.length())) / 2;
        } else return 0;
    }
default int displacement ( Element1D element ) { int thisCenter = this . center ( ) * 2 + ( this . length ( ) % 2 == 0 ? 0 : 1 ) ; int thatCenter = element . center ( ) * 2 + ( element . length ( ) % 2 == 0 ? 0 : 1 ) ; if ( Math . abs ( thatCenter - thisCenter ) > element . length ( ) + this . length ( ) ) { return thatCenter >= thisCenter ? ( ( thatCenter - element . length ( ) ) - ( thisCenter + this . length ( ) ) ) / 2 : ( ( thatCenter + element . length ( ) ) - ( thisCenter - this . length ( ) ) ) / 2 ; } else return 0 ; }
returns the smallest displacement between the most outer points of this element and another element
returns the smallest displacement between the most outer points of this element and another element
// this element lies left to another element // this element lies right to another element