Triangle

smile.pictures.Triangle
object 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 Object
trait Matchable
class Any
Self type
Triangle.type

Members list

Value members

Concrete methods

def apply(sideLength: Double, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def apply(sideLength: Double, center: Pos, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def apply(sideLength: Double, baseLength: Double, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def apply(sideLength: Double, baseLength: Double, center: Pos, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def apply(baseLength: Double, leftSideLength: Double, rightSideLength: Double, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def apply(baseLength: Double, leftSideLength: Double, rightSideLength: Double, center: Pos, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def basedOnHeight(height: Double, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def basedOnHeight(height: Double, center: Pos, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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.

def basedOnHeightAndBase(height: Double, baseLength: Double, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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 or baseLength is negative.

def basedOnHeightAndBase(height: Double, baseLength: Double, center: Pos, fillStyle: Option[FillStyle], strokeStyle: Option[StrokeStyle]): VectorGraphic

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 or baseLength 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.

Attributes