Advertisement
Guest User

Curve

a guest
Jun 21st, 2016
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. import java.awt.geom.Point2D;
  2.  
  3. public class Curve extends Segment
  4. {
  5.     Curve(Point2D.Float start, Point2D.Float control1, Point2D.Float control2, Point2D.Float end)
  6.     {
  7.         super(start, end);
  8.         this.control1 = control1;
  9.         this.control2 = control2;
  10.     }
  11.  
  12.     public Point2D getControl1()
  13.     {
  14.         return control1;
  15.     }
  16.  
  17.     public Point2D getControl2()
  18.     {
  19.         return control2;
  20.     }
  21.  
  22.     //
  23.     // Object override
  24.     //
  25.     @Override
  26.     public String toString()
  27.     {
  28.         StringBuilder builder = new StringBuilder();
  29.         builder.append("    Curve to: ")
  30.                 .append(end.getX())
  31.                 .append(", ")
  32.                 .append(end.getY())
  33.                 .append(" with Control1: ")
  34.                 .append(control1.getX())
  35.                 .append(", ")
  36.                 .append(control1.getY())
  37.                 .append(" and Control2: ")
  38.                 .append(control2.getX())
  39.                 .append(", ")
  40.                 .append(control2.getY())
  41.                 .append('\n');
  42.         return builder.toString();
  43.     }
  44.  
  45.     final Point2D control1, control2;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement