コード例 #1
0
  public TwoDPoint getMidpoint() {
    double midpointX = (pointA.getX() + pointB.getX()) / 2;
    double midpointY = (pointA.getY() + pointB.getY()) / 2;

    TwoDPoint midpoint = new TwoDPoint(midpointX, midpointY);
    return midpoint;
  }
コード例 #2
0
 public double getSlope() {
   double slope = (pointB.getY() - pointA.getY()) / (pointB.getX() - pointA.getX());
   return slope;
 }