# global MapGen.Triangle --- ## methods --- ### Triangle.new --- ```lua function Triangle.new( p1: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }, p2: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }, p3: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, } ) -> MapGen.Triangle { p1 = MapGen.Peak, p2 = MapGen.Peak, p3 = MapGen.Peak, e1 = MapGen.Triangulation.Edge, e2 = MapGen.Triangulation.Edge, e3 = MapGen.Triangulation.Edge, h1 = MapGen.Triangulation.Edge, h2 = MapGen.Triangulation.Edge, h3 = MapGen.Triangulation.Edge, neighbours = MapGen.Triangle.Neighbours, color = ColorString?, new = function, toString = function, eq = function, same = function, getCenter = function, getArea = function, getHeight = function, getHeight2D = function, getSidesLength = function, getSidesLength2D = function, getCircumCenter2D = function, getCircumRadius2D = function, getCircumCircle2D = function, inCircumCircle2D = function, } ``` ### Triangle.toString --- ```lua function Triangle.toString() -> string ``` Returns a string describing the object in a readable form. ### Triangle.eq --- ```lua function Triangle.eq(other: MapGen.Triangle { p1 = MapGen.Peak, p2 = MapGen.Peak, p3 = MapGen.Peak, e1 = MapGen.Triangulation.Edge, e2 = MapGen.Triangulation.Edge, e3 = MapGen.Triangulation.Edge, h1 = MapGen.Triangulation.Edge, h2 = MapGen.Triangulation.Edge, h3 = MapGen.Triangulation.Edge, neighbours = MapGen.Triangle.Neighbours, color = ColorString?, new = function, toString = function, eq = function, same = function, getCenter = function, getArea = function, getHeight = function, getHeight2D = function, getSidesLength = function, getSidesLength2D = function, getCircumCenter2D = function, getCircumRadius2D = function, getCircumCircle2D = function, inCircumCircle2D = function, }) -> boolean ``` Returns true if the triangles are equivalent. ### Triangle.same --- ```lua function Triangle.same(other: MapGen.Triangle { p1 = MapGen.Peak, p2 = MapGen.Peak, p3 = MapGen.Peak, e1 = MapGen.Triangulation.Edge, e2 = MapGen.Triangulation.Edge, e3 = MapGen.Triangulation.Edge, h1 = MapGen.Triangulation.Edge, h2 = MapGen.Triangulation.Edge, h3 = MapGen.Triangulation.Edge, neighbours = MapGen.Triangle.Neighbours, color = ColorString?, new = function, toString = function, eq = function, same = function, getCenter = function, getArea = function, getHeight = function, getHeight2D = function, getSidesLength = function, getSidesLength2D = function, getCircumCenter2D = function, getCircumRadius2D = function, getCircumCircle2D = function, inCircumCircle2D = function, }) -> boolean ``` Returns true if the triangles are similar. ### Triangle.getCenter --- ```lua function Triangle.getCenter() -> vector ``` Returns the coordinates of the triangle's center. ### Triangle.getArea --- ```lua function Triangle.getArea() -> number ``` Returns the area of a triangle. ### Triangle.getHeight --- ```lua function Triangle.getHeight( p1: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }, p2: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }, p3: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, } ) -> MapGen.Triangulation.Edge { p1 = MapGen.Peak, p2 = MapGen.Peak, new = function, toString = function, eq = function, same = function, length = function, getMidPoint = function, } ``` Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3. ### Triangle.getHeight2D --- ```lua function Triangle.getHeight2D( p1: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }, p2: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }, p3: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, } ) -> MapGen.Triangulation.Edge { p1 = MapGen.Peak, p2 = MapGen.Peak, new = function, toString = function, eq = function, same = function, length = function, getMidPoint = function, } ``` Returns the perpendicular from the vertex Peak1 to the line Peak2-Peak3. Note: This function does not take into account the Y-coordinate, that is, the calculation is performed on the projection of the triangle XZ. ### Triangle.getSidesLength --- ```lua function Triangle.getSidesLength() -> number -> number -> number ``` Returns the length of the edges ### Triangle.getSidesLength2D --- ```lua function Triangle.getSidesLength2D() -> number -> number -> number ``` Returns the length of the edges. Note: This function does not take into account the Y-coordinate, that is, the calculation is performed on the projection of the triangle XZ. ### Triangle.getCircumCenter2D --- ```lua function Triangle.getCircumCenter2D() -> vector ``` Returns the coordinates of the circumcircle center. Note: This function does not take into account the Y-coordinate, that is, the calculation is performed on the projection of the triangle XZ. ### Triangle.getCircumRadius2D --- ```lua function Triangle.getCircumRadius2D() -> number ``` Returns the radius of the circumcircle. Note: This function does not take into account the Y-coordinate, that is, the calculation is performed on the projection of the triangle XZ. ### Triangle.getCircumCircle2D --- ```lua function Triangle.getCircumCircle2D() -> vector -> number ``` Returns the coordinates of the circumcircle center and its radius. Note: This function does not take into account the Y-coordinate, that is, the calculation is performed on the projection of the triangle XZ. ### Triangle.inCircumCircle2D --- ```lua function Triangle.inCircumCircle2D(p: MapGen.Peak { id = number, getPeakPos = function, getColor = function, getGroups = function, new = function, toString = function, eq = function, }) -> boolean ``` Checks if a given point lies into the triangle circumcircle. Note: This function does not take into account the Y-coordinate, that is, the calculation is performed on the projection of the triangle XZ. ## fields --- ### Triangle.p1 --- ```lua Triangle.p1 : MapGen.Peak { id: number, getPeakPos: function, getColor: function, getGroups: function, new: function, toString: function, eq: function, } ``` ### Triangle.p2 --- ```lua Triangle.p2 : MapGen.Peak { id: number, getPeakPos: function, getColor: function, getGroups: function, new: function, toString: function, eq: function, } ``` ### Triangle.p3 --- ```lua Triangle.p3 : MapGen.Peak { id: number, getPeakPos: function, getColor: function, getGroups: function, new: function, toString: function, eq: function, } ``` ### Triangle.e1 --- ```lua Triangle.e1 : MapGen.Triangulation.Edge { p1: MapGen.Peak, p2: MapGen.Peak, new: function, toString: function, eq: function, same: function, length: function, getMidPoint: function, } ``` ### Triangle.e2 --- ```lua Triangle.e2 : MapGen.Triangulation.Edge { p1: MapGen.Peak, p2: MapGen.Peak, new: function, toString: function, eq: function, same: function, length: function, getMidPoint: function, } ``` ### Triangle.e3 --- ```lua Triangle.e3 : MapGen.Triangulation.Edge { p1: MapGen.Peak, p2: MapGen.Peak, new: function, toString: function, eq: function, same: function, length: function, getMidPoint: function, } ``` ### Triangle.h1 --- ```lua Triangle.h1 : MapGen.Triangulation.Edge { p1: MapGen.Peak, p2: MapGen.Peak, new: function, toString: function, eq: function, same: function, length: function, getMidPoint: function, } ``` ### Triangle.h2 --- ```lua Triangle.h2 : MapGen.Triangulation.Edge { p1: MapGen.Peak, p2: MapGen.Peak, new: function, toString: function, eq: function, same: function, length: function, getMidPoint: function, } ``` ### Triangle.h3 --- ```lua Triangle.h3 : MapGen.Triangulation.Edge { p1: MapGen.Peak, p2: MapGen.Peak, new: function, toString: function, eq: function, same: function, length: function, getMidPoint: function, } ``` ### Triangle.neighbours --- ```lua Triangle.neighbours : MapGen.Triangle.Neighbours ``` ### Triangle.color --- ```lua Triangle.color : ColorString? ```