Triangle

smile.pictures.Triangle
object Triangle

Equilateral, isosceles and scalene triangles, with the apex up.

Every side has to have a length, and the sides have to satisfy the triangle inequality. A factory given sides that cannot make a triangle refuses with an IllegalArgumentException.

import smile.colors.PresetColor.*

val triangle = Triangle(80, fillWith(SeaGreen), None)

A green triangle with its apex up

Attributes

Source
Shapes.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Triangle.type

Members list

Value members

Concrete methods

def apply(sideLength: Double, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An equilateral triangle with sides of sideLength, centered at the origin.

An equilateral triangle with sides of sideLength, centered at the origin.

Attributes

Source
Shapes.scala
def apply(sideLength: Double, center: Pos, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An equilateral triangle with sides of sideLength, its box centered at center.

An equilateral triangle with sides of sideLength, its box centered at center.

Attributes

Source
Shapes.scala
def apply(sideLength: Double, baseLength: Double, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An isosceles triangle with two sides of sideLength over a base of baseLength, centered at the origin.

An isosceles triangle with two sides of sideLength over a base of baseLength, centered at the origin.

Attributes

Source
Shapes.scala
def apply(sideLength: Double, baseLength: Double, center: Pos, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An isosceles triangle with two sides of sideLength over a base of baseLength, its box centered at center.

An isosceles triangle with two sides of sideLength over a base of baseLength, its box centered at center.

Attributes

Source
Shapes.scala
def apply(baseLength: Double, leftSideLength: Double, rightSideLength: Double, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

A triangle with the given base and sides, the left side rising from the base's left end, centered at the origin.

A triangle with the given base and sides, the left side rising from the base's left end, centered at the origin.

Attributes

Source
Shapes.scala
def apply(baseLength: Double, leftSideLength: Double, rightSideLength: Double, center: Pos, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

A triangle with the given base and sides, the left side rising from the base's left end, its box centered at center.

A triangle with the given base and sides, the left side rising from the base's left end, its box centered at center.

Attributes

Source
Shapes.scala
def basedOnHeight(height: Double, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An equilateral triangle height high, centered at the origin.

An equilateral triangle height high, centered at the origin.

Attributes

Source
Shapes.scala
def basedOnHeight(height: Double, center: Pos, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An equilateral triangle height high, its box centered at center.

An equilateral triangle height high, its box centered at center.

Attributes

Source
Shapes.scala
def basedOnHeightAndBase(height: Double, baseLength: Double, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An isosceles triangle height high over a base of baseLength, centered at the origin.

An isosceles triangle height high over a base of baseLength, centered at the origin.

Attributes

Source
Shapes.scala
def basedOnHeightAndBase(height: Double, baseLength: Double, center: Pos, fill: Option[FillStyle], line: Option[StrokeStyle]): Shape

An isosceles triangle height high over a base of baseLength, its box centered at center.

An isosceles triangle height high over a base of baseLength, its box centered at center.

Attributes

Source
Shapes.scala

Concrete fields

The height of an equilateral triangle as a multiple of its side.

The height of an equilateral triangle as a multiple of its side.

Attributes

Source
Shapes.scala

The side of an equilateral triangle as a multiple of its height.

The side of an equilateral triangle as a multiple of its height.

Attributes

Source
Shapes.scala