question: public PlaSegmentFloat translate ( double p_dist ) { double dx = point_b . v_x - point_a . v_x ; double dy = point_b . v_y - point_a . v_y ; double dxdx = dx * dx ; double dydy = dy * dy ; double lenght = Math . sqrt ( dxdx + dydy ) ; PlaPointFloat new_a ; if ( dxdx <= dydy ) { double rel_x = ( p_dist * lenght ) / dy ; new_a = new PlaPointFloat ( point_a . v_x - rel_x , point_a . v_y ) ; } else { double rel_y = ( p_dist * lenght ) / dx ; new_a = new PlaPointFloat ( point_a . v_x , point_a . v_y + rel_y ) ; } PlaPointFloat new_b = new PlaPointFloat ( new_a . v_x + dx , new_a . v_y + dy ) ; return new PlaSegmentFloat ( new_a , new_b ) ; }
target:  translates the line perpendicular at about p_dist. If p_dist > 0, the line will be translated to the left, else to the right