posY= (int)Math.round(((oy - currentPoint.y) * sy));
}
// draw current point
g2.setColor(Color.RED);
g2.setStroke(new BasicStroke());
g2.fillOval(posX - 5, posY - 5, 10, 10);
// Display slope
double slopeX = currentPoint.slop_x * sx;
double slopeY = currentPoint.slop_y * sy;
// Normalize slope vector
double lenth = Math.sqrt(slopeX*slopeX + slopeY*slopeY);
slopeX = (slopeX/lenth) * SLOP_LENGTH;
slopeY = (slopeY/lenth) * SLOP_LENGTH;
int slopeEndposX = (int)Math.round(posX + slopeX );
int slopeEndposY = (int)Math.round(posY -slopeY);
g2.setStroke(new BasicStroke(2));
g2.draw(new Line2D.Double(posX, posY, slopeEndposX, slopeEndposY));
// Draw arrow
double theta = Math.atan2((slopeEndposY-posY),(slopeEndposX-posX));