Triangle
Factory object for creating triangles.
Provides methods to create equilateral, isosceles, and scalene triangles based on side lengths, height, base length, or specific corner positions.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Triangle.type
Members list
Value members
Concrete methods
Creates an equilateral triangle with a specified side length.
Creates an equilateral triangle with a specified side length.
Value parameters
- fillStyle
-
Optional fill style for the triangle.
- sideLength
-
Length of each side of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing an equilateral triangle. - Throws
-
IllegalArgumentException
if the side length is negative.
Creates an equilateral triangle with a specified side length.
Creates an equilateral triangle with a specified side length.
Value parameters
- center
-
Center of the triangle.
- fillStyle
-
Optional fill style for the triangle.
- sideLength
-
Length of each side of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing an equilateral triangle. - Throws
-
IllegalArgumentException
if the side length is negative.
Creates an isosceles triangle with specified side lengths and base length.
Creates an isosceles triangle with specified side lengths and base length.
Value parameters
- baseLength
-
Length of the base of the triangle.
- fillStyle
-
Optional fill style for the triangle.
- sideLength
-
Length of the two equal sides of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing an isosceles triangle. - Throws
-
IllegalArgumentException
if any of the lengths are negative or if the triangle inequality does not hold.
Creates an isosceles triangle with specified side lengths and base length.
Creates an isosceles triangle with specified side lengths and base length.
Value parameters
- baseLength
-
Length of the base of the triangle.
- center
-
Center of the triangle.
- fillStyle
-
Optional fill style for the triangle.
- sideLength
-
Length of the two equal sides of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing an isosceles triangle. - Throws
-
IllegalArgumentException
if any of the lengths are negative or if the triangle inequality does not hold.
Creates a scalene triangle with specified side lengths.
Creates a scalene triangle with specified side lengths.
Value parameters
- baseLength
-
Length of the base of the triangle.
- fillStyle
-
Optional fill style for the triangle.
- leftSideLength
-
Length of the left side of the triangle.
- rightSideLength
-
Length of the right side of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing a scalene triangle. - Throws
-
IllegalArgumentException
if any of the lengths are negative or if the triangle inequality does not hold.
Creates a scalene triangle with specified side lengths.
Creates a scalene triangle with specified side lengths.
Value parameters
- baseLength
-
Length of the base of the triangle.
- center
-
Center of the triangle.
- fillStyle
-
Optional fill style for the triangle.
- leftSideLength
-
Length of the left side of the triangle.
- rightSideLength
-
Length of the right side of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing a scalene triangle. - Throws
-
IllegalArgumentException
if any of the lengths are negative or if the triangle inequality does not hold.
Creates an equilateral triangle based on the specified height.
Creates an equilateral triangle based on the specified height.
Value parameters
- fillStyle
-
Optional fill style for the triangle.
- height
-
Height of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing an equilateral triangle. - Throws
-
IllegalArgumentException
if the height is negative.
Creates an equilateral triangle based on the specified height.
Creates an equilateral triangle based on the specified height.
Value parameters
- center
-
Center of the triangle.
- fillStyle
-
Optional fill style for the triangle.
- height
-
Height of the triangle.
- strokeStyle
-
Optional stroke style for the triangle.
Attributes
- Returns
-
A
VectorGraphic
representing an equilateral triangle. - Throws
-
IllegalArgumentException
if the height is negative.
Creates a new isosceles triangle based on specified height and base length.
Creates a new isosceles triangle based on specified height and base length.
Value parameters
- baseLength
-
The length of the base of the triangle. Must be non-negative.
- fillStyle
-
Optional fill style for the triangle. None means no fill.
- height
-
The height of the triangle. Must be non-negative.
- strokeStyle
-
Optional stroke style for the triangle. None means no stroke.
Attributes
- Returns
-
A
VectorGraphic
representing the isosceles triangle. - Throws
-
IllegalArgumentException
If either
height
orbaseLength
is negative.
Creates a new isosceles triangle that has a specific center point, based on specified height and base length.
Creates a new isosceles triangle that has a specific center point, based on specified height and base length.
Value parameters
- baseLength
-
The length of the base of the triangle. Must be non-negative.
- center
-
The center position of the triangle.
- fillStyle
-
Optional fill style for the triangle. None means no fill.
- height
-
The height of the triangle. Must be non-negative.
- strokeStyle
-
Optional stroke style for the triangle. None means no stroke.
Attributes
- Returns
-
A
VectorGraphic
representing the isosceles triangle. - Throws
-
IllegalArgumentException
If either
height
orbaseLength
is negative.
Concrete fields
Height of an equilateral triangle as a factor of the length of its side.
Height of an equilateral triangle as a factor of the length of its side.
Attributes
Side length of an equilateral triangle as a factor of its halfHeight.
Side length of an equilateral triangle as a factor of its halfHeight.