Header menu logo Euclid

Tria2D Type

A type containing only static member functions for operations on 2D Triangles.

Static members

Static member Description

Tria2D.area (a, b, c)

Full Usage: Tria2D.area (a, b, c)

Parameters:
Returns: float
Modifiers: inline

Returns the area of a triangle described by 3 points.

a : Pt
b : Pt
c : Pt
Returns: float

Tria2D.areaDouble (a, b, c)

Full Usage: Tria2D.areaDouble (a, b, c)

Parameters:
Returns: float
Modifiers: inline

Returns the double area of a triangle. This is the fastest way to get a comparison or sorting value for the areas of triangles. This is just the absolute value of the 2D Cross Product.

a : Pt
b : Pt
c : Pt
Returns: float

Tria2D.areaSigned (a, b, c)

Full Usage: Tria2D.areaSigned (a, b, c)

Parameters:
Returns: float
Modifiers: inline

Returns the signed area of a triangle. If the result is positive, the points are in counter-clockwise order.

a : Pt
b : Pt
c : Pt
Returns: float

Tria2D.det (a, b, c)

Full Usage: Tria2D.det (a, b, c)

Parameters:
Returns: float
Modifiers: inline

Returns the determinant (2D cross product), i.e., the signed double area of a triangle. If the result is positive, the points are in counter-clockwise order.

a : Pt
b : Pt
c : Pt
Returns: float

Tria2D.isLinear (a, b, c, ?distanceTolerance)

Full Usage: Tria2D.isLinear (a, b, c, ?distanceTolerance)

Parameters:
    a : Pt
    b : Pt
    c : Pt
    ?distanceTolerance : float

Returns: bool

Checks if three points are in one line. By finding the biggest angle in the triangle. And then measuring the distance from this point to the line defined by the other two points.

a : Pt
b : Pt
c : Pt
?distanceTolerance : float
Returns: bool

Tria2D.isLinearFast (a, b, c, ?maxAreaParallelogram)

Full Usage: Tria2D.isLinearFast (a, b, c, ?maxAreaParallelogram)

Parameters:
    a : Pt
    b : Pt
    c : Pt
    ?maxAreaParallelogram : float

Returns: bool
Modifiers: inline

Checks if three points are in one line. This is a very fast check, but it is hard to find an appropriate tolerance. (Default is 0.001) This tolerance is the area of the parallelogram described by two vectors created from the 3 points. So it also returns true if the points are equal or very close to each other. Returns false for NaN input values. Use Points.areInLine if you need better control over the actual tolerance distance.

a : Pt
b : Pt
c : Pt
?maxAreaParallelogram : float
Returns: bool

Tria2D.offset (a, b, c, dist)

Full Usage: Tria2D.offset (a, b, c, dist)

Parameters:
    a : Pt
    b : Pt
    c : Pt
    dist : float

Returns: Pt * Pt * Pt

Offsets all points by a given distance. If the points are in counter-clockwise order, the offset is inwards. Otherwise it is outwards. A negative offset distance inverts the direction.

a : Pt
b : Pt
c : Pt
dist : float
Returns: Pt * Pt * Pt

Tria2D.offsetPt (ptToOffset, prev, next, dist)

Full Usage: Tria2D.offsetPt (ptToOffset, prev, next, dist)

Parameters:
    ptToOffset : Pt
    prev : Pt
    next : Pt
    dist : float

Returns: Pt

Offsets one point by a given distance. If the points 'prev', 'this' and 'next' are in counter-clockwise order, the offset is inwards. Otherwise it is outwards. A negative offset distance inverts the direction.

ptToOffset : Pt
prev : Pt
next : Pt
dist : float
Returns: Pt

Tria2D.offsetPtVar (ptToOffset, prev, next, distPrev, distNext)

Full Usage: Tria2D.offsetPtVar (ptToOffset, prev, next, distPrev, distNext)

Parameters:
    ptToOffset : Pt
    prev : Pt
    next : Pt
    distPrev : float
    distNext : float

Returns: ValueOption<Pt>

Finds the offset point based on the previous and next points, and their offset distances. A positive offset distance will be to the left side of the line from 'prev' to 'ptToOffset'. A negative offset distance inverts the direction. This function use Tria2D.offsetVarByNormals(..) internally.

ptToOffset : Pt
prev : Pt
next : Pt
distPrev : float
distNext : float
Returns: ValueOption<Pt>

Tria2D.offsetPtVarByNormals (ptToOffset, prevN, nextN, prevDist, nextDist)

Full Usage: Tria2D.offsetPtVarByNormals (ptToOffset, prevN, nextN, prevDist, nextDist)

Parameters:
    ptToOffset : Pt
    prevN : UnitVc
    nextN : UnitVc
    prevDist : float
    nextDist : float

Returns: ValueOption<Pt>

Finds the offset point based on the previous and next unit normals (= offset direction), and their offset distances. This is the core function for offsetting variable. it is used by Tria2D.offsetVar(..).

ptToOffset : Pt
prevN : UnitVc
nextN : UnitVc
prevDist : float
nextDist : float
Returns: ValueOption<Pt>

Type something to start searching.