public class XyTriangle extends java.lang.Object implements XyArea<XyTriangle>
Triangles are useful for many reasons other than as another area or shape. Many problems (e.g. bisecting an directional angle) can be expressed as relationships between three points with connecting line segments. And of course much of trigonometry is based on triangle relationships.
Our model of triangle is based on three ordered vertices vertexA, vertexB, and vertexC. You can then derive lineSegmentAB, lineSegmentBC, and lineSegmentCA, angleA, angleB, angleC, and so forth. The terminology for all of these should be painfully obvious.
Much of the math is derived from examples at http://en.wikipedia.org/wiki/Triangle.
Copyright 2008 Partner Software, Inc.
| Constructor and Description |
|---|
XyTriangle(double xA,
double yA,
double xB,
double yB,
double xC,
double yC)
Build a triangle with vertices in the given order.
|
XyTriangle(XyPoint vertexA,
XyPoint vertexB,
XyPoint vertexC)
Build a triangle with vertices in the given order.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(XyPoint point)
Tests if a point is inside this area.
|
XyDirection |
getAngleBisectorDirectionA()
The direction of the angle bisector for vertex A (going from A to the opposite side).
|
XyDirection |
getAngleBisectorDirectionB()
The direction of the angle bisector for vertex B (going from B to the opposite side).
|
XyDirection |
getAngleBisectorDirectionC()
The direction of the angle bisector for vertex C (going from C to the opposite side).
|
double |
getArea()
Returns the 2-dimensional area covered by this...
|
XyBounds |
getBounds()
Returns an XyBounds object representing the rectangular extents of this
shape.
|
XyDeflection |
getDeflectionABC()
The deflection of the line segment connecting vertexB to vertexC as compared to the line segment from vertexA to vertexB.
|
XyDeflection |
getDeflectionACB()
The deflection of the line segment connecting vertexC to vertexB as compared to the line segment from vertexA to vertexC.
|
XyDeflection |
getDeflectionBAC()
The deflection of the line segment connecting vertexA to vertexC as compared to the line segment from vertexB to vertexA.
|
XyDeflection |
getDeflectionBCA()
The deflection of the line segment connecting vertex C to vertex A as compared to the line segment from vertexB to vertexC.
|
XyDeflection |
getDeflectionCAB()
The deflection of the line segment connecting vertexA to vertexC as compared to the line segment from vertexC to vertexA.
|
XyDeflection |
getDeflectionCBA()
The deflection of the line segment connecting vertexB to vertexA as compared to the line segment from vertexC to vertexB.
|
XyDirection |
getDirectionAB()
The direction of the line segment connecting vertexA to vertexB.
|
XyDirection |
getDirectionAC()
The direction of the line segment connecting vertexA to vertexC.
|
XyDirection |
getDirectionBA()
The direction of the line segment connecting vertexB to vertexA.
|
XyDirection |
getDirectionBC()
The direction of the line segment connecting vertexB to vertexC.
|
XyDirection |
getDirectionCA()
The direction of the line segment connecting vertexC to vertexA.
|
XyDirection |
getDirectionCB()
The direction of the line segment connecting vertexC to vertexB.
|
XyAngle |
getExteriorAngleA()
The exterior interior angle at vertex A.
|
XyAngle |
getExteriorAngleB()
The exterior interior angle at vertex B.
|
XyAngle |
getExteriorAngleC()
The exterior interior angle at vertex C.
|
XyAngle |
getInteriorAngleA()
The interior angle at vertex A.
|
XyAngle |
getInteriorAngleB()
The interior angle at vertex B.
|
XyAngle |
getInteriorAngleC()
The interior angle at vertex C.
|
double |
getLengthAB()
The length of line segment (side) AB.
|
double |
getLengthBC()
The length of line segment (side) BC.
|
double |
getLengthCA()
The length of line segment (side) CA.
|
XyLineSegment |
getLineSegmentAB()
The line segment connecting vertexA to vertexB.
|
XyLineSegment |
getLineSegmentAC()
The line segment connecting vertexA to vertexC.
|
XyLineSegment |
getLineSegmentBA()
The line segment connecting vertexB to vertexA.
|
XyLineSegment |
getLineSegmentBC()
The line segment connecting vertexB to vertexC.
|
XyLineSegment |
getLineSegmentCA()
The line segment connecting vertexC to vertexA.
|
XyLineSegment |
getLineSegmentCB()
The line segment connecting vertexC to vertexB.
|
double |
getPerimeter()
Returns the total length of the lines and/or curves bounding the area.
|
XyVector |
getVectorAB()
The vector from vertexA to vertexB.
|
XyVector |
getVectorAC()
The vector from vertexA to vertexC.
|
XyVector |
getVectorBA()
The vector from vertexB to vertexA.
|
XyVector |
getVectorBC()
The vector from vertexB to vertexC.
|
XyVector |
getVectorCA()
The vector from vertexC to vertexA.
|
XyVector |
getVectorCB()
The vector from vertexC to vertexB.
|
XyPoint |
getVertexA()
The first vertex, labeled A.
|
XyPoint |
getVertexB()
The second vertex, labeled B.
|
XyPoint |
getVertexC()
The third vertex, labeled C.
|
java.util.Iterator<XyPoint> |
iterator() |
XyTriangle |
scaledBy(double factor)
Return a scaled version of the shape by multiplying all coordinates by
the given factor in both dimensions.
|
XyPolygon |
toPolygon()
Same as
XyArea.toPolygon(XyAngle) with a default angle granularity of
1/60 circle (1 degree, pi/30 radians). |
XyPolygon |
toPolygon(XyAngle granularity)
Converts this area to a polygon which approximates it in some fashion.
|
XyShape |
transformedBy(XyTransform transform)
Transform the shape using the given transform.
|
XyTriangle |
translatedBy(double offsetX,
double offsetY)
Translate the shape by adding all coordinates to the given x and y
offsets.
|
public XyTriangle(XyPoint vertexA, XyPoint vertexB, XyPoint vertexC)
public XyTriangle(double xA,
double yA,
double xB,
double yB,
double xC,
double yC)
public XyPoint getVertexA()
public XyPoint getVertexB()
public XyPoint getVertexC()
public XyLineSegment getLineSegmentAB()
public XyLineSegment getLineSegmentBC()
public XyLineSegment getLineSegmentCA()
public XyLineSegment getLineSegmentBA()
public XyLineSegment getLineSegmentCB()
public XyLineSegment getLineSegmentAC()
public XyVector getVectorAB()
public XyVector getVectorBC()
public XyVector getVectorCA()
public XyVector getVectorBA()
public XyVector getVectorCB()
public XyVector getVectorAC()
public double getLengthAB()
public double getLengthBC()
public double getLengthCA()
public XyDirection getDirectionAB()
public XyDirection getDirectionBC()
public XyDirection getDirectionCA()
public XyDirection getDirectionAC()
public XyDirection getDirectionBA()
public XyDirection getDirectionCB()
public XyDeflection getDeflectionABC()
public XyDeflection getDeflectionBCA()
public XyDeflection getDeflectionCAB()
public XyDeflection getDeflectionACB()
public XyDeflection getDeflectionBAC()
public XyDeflection getDeflectionCBA()
public XyAngle getInteriorAngleA()
public XyAngle getInteriorAngleB()
public XyAngle getInteriorAngleC()
public XyAngle getExteriorAngleA()
public XyAngle getExteriorAngleB()
public XyAngle getExteriorAngleC()
public XyDirection getAngleBisectorDirectionA()
public XyDirection getAngleBisectorDirectionB()
public XyDirection getAngleBisectorDirectionC()
public boolean contains(XyPoint point)
XyAreacontains in interface XyArea<XyTriangle>point - point to test for containmentpublic double getArea()
XyAreagetArea in interface XyArea<XyTriangle>public double getPerimeter()
XyAreagetPerimeter in interface XyArea<XyTriangle>public XyPolygon toPolygon(XyAngle granularity)
XyAreaThe angle parameter allows a certain level of control of the output. Essentially it dictates the minimum angular granularity used to approximate curved paths. For example, a circle would be turned into a polygon by placing points around the circle, separated by the given angle.
toPolygon in interface XyArea<XyTriangle>public XyPolygon toPolygon()
XyAreaXyArea.toPolygon(XyAngle) with a default angle granularity of
1/60 circle (1 degree, pi/30 radians).toPolygon in interface XyArea<XyTriangle>public XyBounds getBounds()
XyShapegetBounds in interface XyShape<XyTriangle>public XyTriangle scaledBy(double factor)
XyShapescaledBy in interface XyShape<XyTriangle>factor - scaling factorpublic XyShape transformedBy(XyTransform transform)
XyShapetransformedBy in interface XyShape<XyTriangle>transform - affine transform to apply.public XyTriangle translatedBy(double offsetX, double offsetY)
XyShapetranslatedBy in interface XyShape<XyTriangle>offsetX - offset for the x dimensionoffsetY - offset for the y dimension