Header menu logo Euclid

Tria3D Type

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

Static members

Static member Description

Tria3D.area (a, b, c)

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

Parameters:
Returns: float
Modifiers: inline

Returns the area of a triangle described by 3 points.

a : Pnt
b : Pnt
c : Pnt
Returns: float

Tria3D.areaDouble (a, b, c)

Full Usage: Tria3D.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 length of the cross product vector.

a : Pnt
b : Pnt
c : Pnt
Returns: float

Tria3D.intersectLine (line, p1, p2, p3)

Full Usage: Tria3D.intersectLine (line, p1, p2, p3)

Parameters:
Returns: Pnt option

Calculates the intersection of a finite line with a triangle. Returns Some(Pnt) or None if no intersection was found, or if the input line has near zero length, or if the input triangle has near zero area. This algorithm still returns an intersection even if line and triangle are almost parallel. Since it is using the triple product, it is hard to find an appropriate tolerance for considering lines and triangles parallel based on the volume of the tetrahedron between them.

line : Line3D
p1 : Pnt
p2 : Pnt
p3 : Pnt
Returns: Pnt option

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

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

Parameters:
    a : Pnt
    b : Pnt
    c : Pnt
    ?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 : Pnt
b : Pnt
c : Pnt
?distanceTolerance : float
Returns: bool

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

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

Parameters:
    a : Pnt
    b : Pnt
    c : Pnt
    ?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 : Pnt
b : Pnt
c : Pnt
?maxAreaParallelogram : float
Returns: bool

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

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

Parameters:
Returns: Pnt * Pnt * Pnt

Offsets all points by a given distance. The offset is inwards for positive distance and outwards for negative distance.

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

Tria3D.offsetPnt (pntToOffset, prev, next, dist)

Full Usage: Tria3D.offsetPnt (pntToOffset, prev, next, dist)

Parameters:
    pntToOffset : Pnt
    prev : Pnt
    next : Pnt
    dist : float

Returns: Pnt

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.

pntToOffset : Pnt
prev : Pnt
next : Pnt
dist : float
Returns: Pnt

Tria3D.offsetVar (ptToOffset, prev, next, distPrev, distNext)

Full Usage: Tria3D.offsetVar (ptToOffset, prev, next, distPrev, distNext)

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

Returns: ValueOption<Pnt>

Finds the offset point based on the previous and next unit normals (= offset direction), and their offset distances.

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

Type something to start searching.