public class Triangle
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Triangle.CycleSense |
Constructor and Description |
---|
Triangle(java.awt.Point ptA,
java.awt.Point ptB,
java.awt.Point ptC)
Point positions are assumed to be pixels within an image, so the length
units are Length.Units.PIXEL.
|
Modifier and Type | Method and Description |
---|---|
double |
area(Length.Units requiredUnits)
There is not yet an Area class - there may be in future.
|
Triangle |
clone() |
void |
cycle(Triangle.CycleSense sense) |
boolean |
equalAngles(Triangle other,
Angle tolerance)
True even if the vertices are cycled round in the other triangle,
in which case - NB! - other is cycled by this method so it matches,
but false if other is flipped over relative to this.
|
boolean |
equals(java.lang.Object other) |
double |
getAngleTo(Triangle other)
Assuming this and other pass the equalAngles() test, find the rotation
angle to get from this to other
as an average of the orientation differences for the 3 sides.
|
double |
getScaleTo(Triangle other)
Assuming this and other pass the equalAngles() test, find the length
ratio to get from this to other
as an average of the scale factors for the 3 sides.
|
java.awt.Point[] |
getVertices()
Get an array of copies of the vertices.
|
int |
hashCode() |
static java.awt.Point[] |
makeClockwise(java.awt.Point ptA,
java.awt.Point ptB,
java.awt.Point ptC)
Given any 3 points, put them in an array in an order so that when used to
define a triangle they will be clockwise around the perimeter.
|
Length |
perimeter(Length.Units requiredUnits) |
java.lang.String |
toString() |
public Triangle(java.awt.Point ptA, java.awt.Point ptB, java.awt.Point ptC)
public java.awt.Point[] getVertices()
public static java.awt.Point[] makeClockwise(java.awt.Point ptA, java.awt.Point ptB, java.awt.Point ptC)
public Length perimeter(Length.Units requiredUnits)
public double area(Length.Units requiredUnits)
public Triangle clone()
clone
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean equalAngles(Triangle other, Angle tolerance)
public void cycle(Triangle.CycleSense sense)
public double getScaleTo(Triangle other)
public double getAngleTo(Triangle other)
public java.lang.String toString()
toString
in class java.lang.Object