Triangle

References
[IoId("00000000-477c-4231-b679-ad5443c33551")] public readonly struct Triangle : IStorable
A 3D triangle defined by corner points.

Constructors

Triangle

#
public Triangle(IReader reader)
reader (IReader)

Triangle

#
public Triangle(Point3d a, Point3d b, Point3d c)
a (Point3d)
b (Point3d)
c (Point3d)

Properties

A

#
public Point3d A { get; }
Gets the first triangle corner.

AB

#
public Line AB { get; }
Gets the triangle edge connecting the A and B corners.

AltitudeA

#
public Line AltitudeA { get; }
Gets the altitude line starting at corner A.

AltitudeB

#
public Line AltitudeB { get; }
Gets the altitude line starting at corner B.

AltitudeC

#
public Line AltitudeC { get; }
Gets the altitude line starting at corner C.

AngleA

#
public Angle AngleA { get; }
Gets the angle at the A corner.

AngleB

#
public Angle AngleB { get; }
Gets the angle at the B corner.

AngleC

#
public Angle AngleC { get; }
Gets the angle at the C corner.

Area

#
public double Area { get; }
Gets the area inside this triangle.

AreaCentre

#
public Point3d AreaCentre { get; }
Gets the triangle area centroid.

B

#
public Point3d B { get; }
Gets the second triangle corner.

BC

#
public Line BC { get; }
Gets the triangle edge connecting the B and C corners.

BisectorA

#
public Line BisectorA { get; }
Gets the bisector line starting at corner A.

BisectorB

#
public Line BisectorB { get; }
Gets the bisector line starting at corner B.

BisectorC

#
public Line BisectorC { get; }
Gets the bisector line starting at corner C.

BoundingBox

#
public BoundingBox BoundingBox { get; }
Gets the bounding box of this triangle.

C

#
public Point3d C { get; }
Gets the third triangle corner.

CA

#
public Line CA { get; }
Gets the triangle edge connecting the C and A corners.

CircumCentre

#
public Point3d CircumCentre { get; }
Gets the triangle circumcentre.

CircumCircle

#
public Circle CircumCircle { get; }
Gets the circumcircle of this triangle.

InCentre

#
public Point3d InCentre { get; }
Gets the triangle incentre.

IsAcute

#
public bool IsAcute { get; }
Gets whether the triangle is acute, i.e. whether all angles are less than 90 degrees.

IsDegenerate

#
public bool IsDegenerate { get; }
Gets whether a triangle is degenerate, i.e. whether two or more points are coincident, or whether one of the corners is coincident with the opposite edge.

IsEquilateral

#
public bool IsEquilateral { get; }
Gets whether a triangle is equilateral, i.e. whether all edges have the same length.

IsIsosceles

#
public bool IsIsosceles { get; }
Gets whether a triangle is isosceles, i.e. whether two edges have the same length.

IsObtuse

#
public bool IsObtuse { get; }
Gets whether the triangle is obtuse, i.e. whether one angle exceeds 90 degrees.

IsRight

#
public bool IsRight { get; }
Gets whether the triangle is right-angled, i.e. whether one angle equals 90 degrees.

IsScalene

#
public bool IsScalene { get; }
Gets whether a triangle is scalene, i.e. whether all edges have different lengths.

IsValid

#
public bool IsValid { get; }
Gets whether all the corner points are valid. Degenerate triangles are not considered invalid.

MedianA

#
public Line MedianA { get; }
Gets the median line starting at corner A.

MedianB

#
public Line MedianB { get; }
Gets the median line starting at corner B.

MedianC

#
public Line MedianC { get; }
Gets the median line starting at corner C.

OrthoCentre

#
public Point3d OrthoCentre { get; }
Gets the triangle orthocentre.

Perimeter

#
public double Perimeter { get; }
Gets the perimeter (or circumference) of this triangle.

PerpendicularAB

#
public Line PerpendicularAB { get; }
Gets the perpendicular bisector for edge AB.

PerpendicularBC

#
public Line PerpendicularBC { get; }
Gets the perpendicular bisector for edge BC.

PerpendicularCA

#
public Line PerpendicularCA { get; }
Gets the perpendicular bisector for edge CA.

Unset

#
public static Triangle Unset { get; }
Gets a triangle with unset points.

Methods

AppendToMesh

#
public void AppendToMesh(Mesh mesh, int density)
Append this triangle to an existing mesh.
mesh (Mesh)Mesh to append to.
density (int)Density, or number of mesh edges per triangle edge.

ClosestBarycentricParameters

#
public void ClosestBarycentricParameters(Point3d point, out double aʹ, out double bʹ, out double cʹ)
Gets the projection of a point onto the barycentric coordinates.
point (Point3d)Point to project.
aʹ (out double)Barycentric mass for vertex A.
bʹ (out double)Barycentric mass for vertex B.
cʹ (out double)Barycentric mass for vertex C.

ClosestParameterOnBoundary

#
public double ClosestParameterOnBoundary(Point3d point)
Gets the parameter on the triangle boundary closest to a test point.
point (Point3d)

ClosestParameterOnInterior

#
public bool ClosestParameterOnInterior(Point3d point, out double u, out double v)
Gets the axial parameters on the triangle interior which are closest to a test point.
point (Point3d)Point.
u (out double)First axial parameter.
v (out double)Second axial parameter.
True on success.

ClosestPointOnBoundary

#
public Point3d ClosestPointOnBoundary(Point3d point)
Gets the point on the triangle boundary closest to a test point.
point (Point3d)

ClosestPointOnInterior

#
public Point3d ClosestPointOnInterior(Point3d point)
Gets the point on the triangle interior or boundary closest to a test point.
point (Point3d)

Offset

#
public Triangle Offset(double amount)
Offset this triangle by a specific amount.
amount (double)Offset distance. Positive distances offset towards the outside.
Offset triangle.

PointAlongBoundary

#
public Point3d PointAlongBoundary(double t)
Gets the point along the boundary of the triangle. The triangle boundary has a domain [0, 3] where each subsequent unit domain maps to a different edge.
t (double)Parameter along boundary.

PointAtBarycentric

#
public Point3d PointAtBarycentric(double aʹ, double bʹ, double cʹ)
Gets a point within this triangle using barycentric coordinates.
aʹ (double)Barycentic mass for vertex A.
bʹ (double)Barycentic mass for vertex B.
cʹ (double)Barycentic mass for vertex C.
Point at barycentric mass.

PointAtTrilinear

#
public Point3d PointAtTrilinear(double u, double v, double w)
Gets a point within this triangle using trilinear coordinates.
u (double)Trilinear ratio u.
v (double)Trilinear ratio v.
w (double)Trilinear ratio w.
Point at trilinear coordinates.

PointOnInterior

#
public Point3d PointOnInterior(double u, double v)
Gets the point on the triangle using the AB and AC primary axes.
u (double)Parameter along the AB edge.
v (double)Parameter along the AC edge.
Point at parameter.

Store

#
public void Store(IWriter writer)
writer (IWriter)
Store

ToMesh

#
public Mesh ToMesh(int density)
Create a mesh from this triangle.
density (int)Density, or number of mesh edges per triangle edge.

ToPolyline

#
public Polyline ToPolyline()
Create a polyline from this triangle.

ToRounded

#
public Curve ToRounded(double radius)
Create a triagle curve with filleted corners.
radius (double)Fillet radius.

Transform

#
public Triangle Transform(Transform transform)
Transform this triangle.
transform (Transform)

WithA

#
public Triangle WithA(Point3d a)
Replace the A corner.
a (Point3d)

WithB

#
public Triangle WithB(Point3d b)
Replace the B corner.
b (Point3d)

WithC

#
public Triangle WithC(Point3d c)
Replace the C corner.
c (Point3d)