This commit is contained in:
Miloslav Ciz 2024-11-17 15:37:32 +01:00
parent 5f2a713689
commit 8dc4c812eb
11 changed files with 1838 additions and 1834 deletions

View file

@ -1,6 +1,6 @@
# Triangle
Triangle is a three sided [polygon](polygon.md), one of the most basic [geometric](geometry.md) shapes. It is a [convex](convex.md) shape. Furthermore it is a 2-[simplex](simplex.md), i.e. the simplest ["shape composed of sides"](polytope.md) in [2 dimensions](2d.md). Triangles are very important, they for example help us to compute [distances](distance.md) or define functions like [sine](sin.md) and [cosine](cos.md) (see [trigonometry](trigonometry.md)).
Triangle is a three sided [polygon](polygon.md), one of the most basic [geometric](geometry.md) shapes. It is a [convex](convex.md) shape. Furthermore it is a 2-[simplex](simplex.md), i.e. the simplest ["shape composed of sides"](polytope.md) in [2 dimensions](2d.md). Triangles are very important, they for example help us compute [distances](distance.md) or define functions like [sine](sin.md) and [cosine](cos.md) (see [trigonometry](trigonometry.md)).
{ In my favorite book [Flatland](flatland.md) triangles represent the lowest class of men with isoscele triangles being the lowest as they are most similar to [women](woman.md) who are just straight [lines](line.md). ~drummyfish }
@ -33,7 +33,7 @@ Some basic facts, features and equations regarding triangles are following (bewa
- general triangle: *a * altitude(a) / 2*
- right triangle: *a * b / 2*
- **[Pythagorean theorem](pythagorean_theorem.md)**: For the lengths of the sides of a RIGHT triangle (i.e. one angle is 90 degrees) it always holds that *a^2 + b^2 = c^2*. This is extremely important and can be used to determine unknown side lengths of right triangles.
- **[Thales's theorem](thales_theorem.md)**: if points *A*, *B* and *C* lie on a [circle](circle.md), then they form a right triangle with hypotenuse equal to the circle diameter (and the center of the circle lying in the middle of the hypotenuse).
- **[Thales's theorem](thales_theorem.md)**: Take a circle on which all points *A*, *B* and *C* lie; if the line *AB* is the circle's diameter, then the triangle is right triangle and *AB* is its hypotenuse.
- **Triangle inequality**: Sum of any two side lengths can't be greater than the length of the third side, i.e. *a + b <= c*. That means that e.g. a triangle with side lengths 1, 2 and 4 can't exist because 1 + 4 > 2. If one side of a triangle is exactly the sum of the other two, the triangle is called **degenerate**, its vertices lie on the same line and it is completely "squashed".
- **Law of sines**: *a / sin(alpha) = b / sin(beta) = c / sin(gamma)*
- **Law of cosines** (generalization of Pythagorean theorem to any triangle, not just right one): *a^2 = b^2 + c^2 - 2 * b * c * cos(alpha)*.
@ -41,7 +41,7 @@ Some basic facts, features and equations regarding triangles are following (bewa
- Every triangle has two special associated [circles](circle.md):
- **[incircle](incircle.md)**: circle inside the triangle which touches each of its sides at one point, its center (incenter) lies on the intersection of all angle bisectors.
- **[circumcircle](circumcircle.md)**: circle outside the triangle which touches each of its vertices, its center (circumcenter) lies on the perpendicular bisectors of each side.
- Triangle vertices always line in a single [plane](plane.md) (unlike other polygons).
- Triangle vertices always line in a single [plane](plane.md) -- it's pretty clear but good to realize e.g. in 3D graphics, every face in a triangle mesh will always have a clearly defined normal etc.
In non [Euclidean](euclidean.md) ("crazy") geometries triangles behave weird, for example we can draw a triangle with three right angles on a surface of a [sphere](sphere.md) (i.e. its angles add to more than 180 degrees). This fact can be exploited by inhabitants of a space (e.g. our [Universe](universe.md)) to find out if they in fact live in a non Euclidean space (and possibly determine the space's exact [curvature](curvature.md)).
@ -51,7 +51,7 @@ Triangles also play a big role e.g. in [realtime](realtime.md) [3D rendering](3d
**[Barycentric coordinates](barycentric_coords.md)** provide a [coordinate](coordinate.md) system that can address specific points inside any triangle -- these are used e.g. in [computer graphics](graphics.md) for [texturing](texture.md). The coordinates are three numbers that always add up to 1, e.g. [0.25, 0.25, 0.5]. The coordinates can be though of as ratios of areas of the three subtriangles the point creates. Points inside the triangle have all three numbers positive. E.g. the coordinates of the vertices *A*, *B* and *C* are [1, 0, 0], [0, 1, 0] and [0, 0, 1], and the coordinates of the triangle center are [1/3, 1/3, 1/3].
**Winding** of the triangle says whether the ordered vertices of the triangle go clockwise or counterclockwise. I.e. winding says whether if we were to go in the direction *A -> B -> C* we'd be going clockwise or counterclockwise around the triangle center. This is important e.g. for [backface culling](backface_culling.md) in computer graphics (determining which side of a triangle in 3D we are looking at). Determining of the winding of triangle can be derived from the sign of the z-component of the [cross product](cross_product.md) of the triangle's sides. For the lazy: compute *w = (y1 - y0) * (x2 - x1) - (x1 - x0) * (y2 - y1)*, if *w > 0* the points go clockwise, if *w < 0* the points go counterclockwise, otherwise (*w = 0*) the points lie on a line.
Triangle **winding** says whether the ordered vertices of the triangle go clockwise or counterclockwise. I.e. winding says whether if we were to go in the direction *A -> B -> C* we'd be going clockwise or counterclockwise around the triangle center. This is important e.g. for [backface culling](backface_culling.md) in computer graphics (determining which side of a triangle in 3D we are looking at). Determining of the winding of triangle can be derived from the sign of the z-component of the [cross product](cross_product.md) of the triangle's sides. For the lazy: compute *w = (y1 - y0) * (x2 - x1) - (x1 - x0) * (y2 - y1)*, if *w > 0* the points go clockwise, if *w < 0* the points go counterclockwise, otherwise (*w = 0*) the points lie on a line.
[Sierpinski triangle](sierpinski_triangle.md) is a [fractal](fractal.md) related to triangles.