Triangle

public struct Triangle : ConvexPolygonProtocol
extension Triangle: Equatable

Model of a triangle.

  • Points comprising Triangle.

    Declaration

    Swift

    public var points: (p1: Point, center: Point, p2: Point) { get }

Instance Properties

Initializers

  • Create a Triangle with the given three vertices.

    Declaration

    Swift

    public init(_ a: Point, _ b: Point, _ c: Point)
  • Create a Triangle with the given vertices.

    Warning

    Will crash if given more or less than three vertices!

    Declaration

    Swift

    public init<S>(vertices: S) where S : Sequence, S.Element == Point
  • Declaration

    Swift

    public func contains(_ point: Point) -> Bool

    Return Value

    true if Triangle contains the given point in its area.