public class Triangle extends Shape
DEFAULT_COLOR
Constructor and Description |
---|
Triangle(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Creates a triangle with the given vertex coordinates.
|
Triangle(Point p,
Point q,
Point r)
Creates a triangle with the given vertex points..
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point point)
Determines if this triangle contains the given point.
|
void |
draw(android.graphics.Canvas canvas)
Draws this triangle on the given canvas.
|
Point |
getCenter()
Returns the center of this triangle.
|
Point |
getP1()
Returns the first vertex of this triangle.
|
Point |
getP2()
Returns the second vertex of this triangle.
|
Point |
getP3()
Returns the third vertex of this triangle.
|
void |
move(double dx,
double dy)
Moves this triangle by the given displacement.
|
public Triangle(double x1, double y1, double x2, double y2, double x3, double y3)
x1
- the x-coordinate of the first vertexy1
- the y-coordinate of the first vertexx2
- the x-coordinate of the second vertexy2
- the y-coordinate of the second vertexx3
- the x-coordinate of the third vertexy3
- the y-coordinate of the third vertexpublic boolean contains(Point point)
public void draw(android.graphics.Canvas canvas)
public Point getCenter()
public Point getP1()
public Point getP2()
public Point getP3()