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

Full Usage: Tria2D.isLinear a b c

Parameters:
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. Uses the default distanceTolerance of 1e-6. Use Tria2D.isLinearWithin to set it.

a : Pt
b : Pt
c : Pt
Returns: bool

Tria2D.isLinearFast a b c

Full Usage: Tria2D.isLinearFast a b c

Parameters:
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 Tria2D.isLinear if you need better control over the actual tolerance distance. Uses the default maxAreaParallelogram of 0.001. Use Tria2D.isLinearFastWithin to set it.

a : Pt
b : Pt
c : Pt
Returns: bool

Tria2D.isLinearFastWithin maxAreaParallelogram a b c

Full Usage: Tria2D.isLinearFastWithin maxAreaParallelogram a b c

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

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. The tolerance maxAreaParallelogram 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 Tria2D.isLinearWithin if you need better control over the actual tolerance distance. Use Tria2D.isLinearFast for the default tolerance of 0.001.

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

Tria2D.isLinearWithin distanceTolerance a b c

Full Usage: Tria2D.isLinearWithin distanceTolerance a b c

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

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. Returns TRUE if this distance is less than distanceTolerance, or if two points are closer than distanceTolerance. Use Tria2D.isLinear for the default distanceTolerance of 1e-6.

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

Tria2D.offset dist a b c

Full Usage: Tria2D.offset dist a b c

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

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.

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

Tria2D.offsetPt dist prev next ptToOffset

Full Usage: Tria2D.offsetPt dist prev next ptToOffset

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

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.

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

Tria2D.offsetPtVariable distPrev distNext prev next ptToOffset

Full Usage: Tria2D.offsetPtVariable distPrev distNext prev next ptToOffset

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

Returns: 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. Fails if the three points are collinear, unless they go in the same direction and the distances are equal. Use Tria2D.tryOffsetPtVar to get ValueNone instead.

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

Tria2D.offsetPtVariableByNormals prevDist nextDist prevN nextN ptToOffset

Full Usage: Tria2D.offsetPtVariableByNormals prevDist nextDist prevN nextN ptToOffset

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

Returns: Pt

Finds the offset point based on the previous and next unit normals (= offset direction), and their offset distances. Fails if the two normals are parallel, unless they point in the same direction and the distances are equal. Use Tria2D.tryOffsetPtVarByNormals to get ValueNone instead.

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

Tria2D.tryOffsetPtVariable distPrev distNext prev next ptToOffset

Full Usage: Tria2D.tryOffsetPtVariable distPrev distNext prev next ptToOffset

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

Returns: Pt voption

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. Returns ValueNone if the three points are collinear, unless they go in the same direction and the distances are equal. This function uses Tria2D.tryOffsetPtVarByNormals(..) internally.

distPrev : float
distNext : float
prev : Pt
next : Pt
ptToOffset : Pt
Returns: Pt voption

Tria2D.tryOffsetPtVariableByNormals prevDist nextDist prevN nextN ptToOffset

Full Usage: Tria2D.tryOffsetPtVariableByNormals prevDist nextDist prevN nextN ptToOffset

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

Returns: Pt voption

Finds the offset point based on the previous and next unit normals (= offset direction), and their offset distances. Returns ValueNone if the two normals are parallel, unless they point in the same direction and the distances are equal. This is the core function for offsetting variable. it is used by Tria2D.tryOffsetPtVar(..).

prevDist : float
nextDist : float
prevN : UnitVc
nextN : UnitVc
ptToOffset : Pt
Returns: Pt voption

Type something to start searching.