edu.byu.phun2d
Class Triangle

java.lang.Object
  extended by edu.byu.phun2d.DrawObj
      extended by edu.byu.phun2d.Triangle

public class Triangle
extends DrawObj

This class will draw a triangle based on any three points.


Constructor Summary
Triangle(double x1, double y1, double x2, double y2, double x3, double y3)
          Constructs a triangle object with the specified three corners.
 
Method Summary
 void setP1(double x, double y)
          Change the location of point 1 on the triangle
 void setP2(double x, double y)
          Change the location of point 2 on the triangle
 void setP3(double x, double y)
          Change the location of point 3 on the triangle
 
Methods inherited from class edu.byu.phun2d.DrawObj
getFillColor, getLineColor, getLineWidth, getRotate, getScaleX, getScaleY, getTranslate, insideToOutside, outsideToInside, setFillColor, setLineColor, setLineWidth, setRotate, setScale, setTranslate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Triangle

public Triangle(double x1,
                double y1,
                double x2,
                double y2,
                double x3,
                double y3)
Constructs a triangle object with the specified three corners.

Parameters:
x1 - X coordinate of corner 1
y1 - Y coordinate of corner 1
x2 - X coordinate of corner 2
y2 - Y coordinate of corner 2
x3 - X coordinate of corner 3
y3 - Y coordinate of corner 3
Method Detail

setP1

public void setP1(double x,
                  double y)
Change the location of point 1 on the triangle

Parameters:
x - new X coordinate
y - new Y coordinate

setP2

public void setP2(double x,
                  double y)
Change the location of point 2 on the triangle

Parameters:
x - new X coordinate
y - new Y coordinate

setP3

public void setP3(double x,
                  double y)
Change the location of point 3 on the triangle

Parameters:
x - new X coordinate
y - new Y coordinate