private Point2d reflect(Point2d p, double x0, double y0, double x1, double y1) {

        double dx, dy, a, b;

        dx = (x1 - x0);
        dy = (y1 - y0);

        a = (dx * dx - dy * dy) / (dx * dx + dy * dy);
        b = 2 * dx * dy / (dx * dx + dy * dy);

        return new Point2d(a * (p.x - x0) + b * (p.y - y0) + x0, b * (p.x - x0) - a * (p.y - y0) + y0);
    }
private Point2d reflect ( Point2d p , double x0 , double y0 , double x1 , double y1 ) { double dx , dy , a , b ; dx = ( x1 - x0 ) ; dy = ( y1 - y0 ) ; a = ( dx * dx - dy * dy ) / ( dx * dx + dy * dy ) ; b = 2 * dx * dy / ( dx * dx + dy * dy ) ; return new Point2d ( a * ( p . x - x0 ) + b * ( p . y - y0 ) + x0 , b * ( p . x - x0 ) - a * ( p . y - y0 ) + y0 ) ; }
Reflect the point {@code p} in the line (x0,y0 - x1,y1).

@param p  the point to reflect
@param x0 plane x start
@param y0 plane y end
@param x1 plane x start
@param y1 plane y end
@return the reflected point