Triangle

class Triangle(var a: Int, var b: Int, var c: Int)(source)

Represents a triangle defined by three node indices in a physical simulation.

A Triangle is primarily used to perform calculations related to its geometry, such as computing its signed area based on the positions of nodes in a given list.

Parameters

a

the index of the first node in the triangle.

b

the index of the second node in the triangle.

c

the index of the third node in the triangle.

Constructors

Link copied to clipboard
constructor(a: Int, b: Int, c: Int)

Creates a Triangle with indices pointing to nodes in a list.

Properties

Link copied to clipboard
var a: Int
Link copied to clipboard
var b: Int
Link copied to clipboard
var c: Int

Functions

Link copied to clipboard
fun signedArea(nodes: List<Node>): Double

Computes the signed area of the triangle defined by the nodes referenced in this triangle. The signed area is positive if the nodes are ordered counterclockwise, and negative if they are ordered clockwise.