Triangle

data class Triangle(x1: Vector2, x2: Vector2, x3: Vector2) : ShapeProvider, ShapeContourProvider

Creates a simple three-point polygon.

Constructors

Triangle
Link copied to clipboard
common
fun Triangle(x1: Vector2, x2: Vector2, x3: Vector2)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

contains
Link copied to clipboard
common
operator fun contains(v: Vector2): Boolean

Returns true if given v lies inside the Triangle.

div
Link copied to clipboard
common
operator fun div(scale: Double): Triangle
minus
Link copied to clipboard
common
operator fun minus(right: Triangle): Triangle
plus
Link copied to clipboard
common
operator fun plus(right: Triangle): Triangle
randomPoint
Link copied to clipboard
common
fun randomPoint(random: Random = Random.Default): Vector2

Generates a random point that lies inside the Triangle.

times
Link copied to clipboard
common
operator fun times(scale: Double): Triangle

Properties

area
Link copied to clipboard
common
val area: Double

The unitless area covered by this Triangle.

centroid
Link copied to clipboard
common
val centroid: Vector2

The centroid of the Triangle.

contour
Link copied to clipboard
common
open override val contour: ShapeContour

Returns ShapeContour representation of the Triangle.

shape
Link copied to clipboard
common
open override val shape: Shape

the provided shape

x1
Link copied to clipboard
common
val x1: Vector2
x2
Link copied to clipboard
common
val x2: Vector2
x3
Link copied to clipboard
common
val x3: Vector2