Pentagon

smile.pictures.Pentagon
object Pentagon

Factory object for creating polygons.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Pentagon.type

Members list

Value members

Concrete methods

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

Creates a pentagon based on its width, height, center position, fill style, and stroke style.

Creates a pentagon based on its width, height, center position, fill style, and stroke style.

Value parameters

center

The center position of the pentagon.

fillStyle

The fill style of the pentagon.

height

The height of the pentagon in pixels.

strokeStyle

The stroke style of the pentagon.

width

The width of the pentagon (diagonal length) in pixels.

Attributes

Returns

A VectorGraphic representing the pentagon.

Throws
IllegalArgumentException

If either width or height is negative.

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

Creates a pentagon based on its circumradius, center position, fill style, and stroke style.

Creates a pentagon based on its circumradius, center position, fill style, and stroke style.

Value parameters

center

The center position of the pentagon.

circumradius

The circumradius of the pentagon in pixels.

fillStyle

The fill style of the pentagon.

strokeStyle

The stroke style of the pentagon.

Attributes

Returns

A VectorGraphic representing the pentagon.

Throws
IllegalArgumentException

If the circumradius is negative.

def limitCircumradiusTo(width: Double, height: Double): Double

Calculates the maximum possible circumradius for a pentagon with given width and height, ensuring that the pentagon fits within these dimensions.

Calculates the maximum possible circumradius for a pentagon with given width and height, ensuring that the pentagon fits within these dimensions.

Value parameters

height

The height constraint in pixels.

width

The width constraint in pixels.

Attributes

Returns

The maximum possible circumradius that fits within the given dimensions.

def pointsFor(circumradius: Double, startAngle: Angle): Seq[Pos]

Generates the points for a pentagon given its circumradius and a starting angle.

Generates the points for a pentagon given its circumradius and a starting angle.

Value parameters

circumradius

The circumradius of the pentagon in pixels.

startAngle

The starting angle for the first point of the pentagon.

Attributes

Returns

A sequence of positions defining the vertices of the pentagon.

Concrete fields

Magnitude of regular convex pentagon's rotational symmetry angle.

Magnitude of regular convex pentagon's rotational symmetry angle.

Attributes