@ThreadSafety(level=IMMUTABLE) public class CTriangle extends Object implements Serializable
Constructor and Description |
---|
CTriangle(CPoint pointA,
CPoint pointB,
CPoint pointC)
Creates this triangle from the supplied points.
|
Modifier and Type | Method and Description |
---|---|
double |
getArea()
Gets the area of this CTriangle.
|
CLine |
getLineAtoB()
Gets the line from point A to point B.
|
CLine |
getLineBtoC()
Gets the line from point B to point C.
|
CLine |
getLineCtoA()
Gets the line from point C to point A.
|
double |
getPerimeter()
Gets the perimeter of this CTriangle.
|
CPoint |
getPointA()
Gets the pointA of this CTriangle.
|
CPoint |
getPointB()
Gets the pointB of this CTriangle.
|
CPoint |
getPointC()
Gets the pointC of this CTriangle.
|
boolean |
isEquilateral()
Determines whether this triangle is equilateral, which is the case when
all lines of the triangle have equal length.
|
boolean |
isIsosceles()
Determines whether this triangle is isosceles, which is the case when two
lines of the triangle have equal length.
|
String |
toString()
Creates a String representation of this CTriangle.
|
public CTriangle(CPoint pointA, CPoint pointB, CPoint pointC)
pointA
- Point A of this Triangle.pointB
- Point B of this Triangle.pointC
- Point C of this Triangle.NullPointerException
- When one of the supplied points is null.ArithmeticException
- When 2 of the supplied points are equal to
each other.public CPoint getPointA()
public CPoint getPointB()
public CPoint getPointC()
public CLine getLineAtoB()
public CLine getLineBtoC()
public CLine getLineCtoA()
public double getArea()
public double getPerimeter()
public boolean isIsosceles()
public boolean isEquilateral()
Copyright © 2008–2018. All rights reserved.