A dolphin image constructed from a triangular mesh, along with a finite element mesh for analysis of the magnetic field in a cylindrically shaped magnetic shield, shaded blue. The red element is a current-carrying wire that generates a test field. (Left, a Wikimedia Commons image by Chrschn; right, a Wikimedia Commons image by Zureks.) |
Hero of Alexandria The proper transliteration of Hero's name from the Greek would be Heron, but he's known as Hero. (Illustration from the Codex of San Gregorio de Nizance, a ninth century Greek manuscript, via Wikimedia Commons.) |
Where the parameter, s, known as the semiperimeter, is half the perimeter; viz.,
If you want to eliminate the semiperimeter from the formula, the formula can be written in terms of the sides, only, as
It's easy to verify this using a 3-4-5 right triangle, which will have an area of (1/2)(base)(height) = (1/2)(4)(3) = 6; viz, Eugen J. Ionascu of the Department of Mathematics, Columbus State University (Columbus, Georgia), has recently published his solution of the interesting problem of how often a fixed point will be interior to a random triangle when these are constrained to be drawn inside a variety of planar regions such as circles and regular polygons.[1] While the equations are dense for most of these planar regions, there's a simple case of triangles drawn inside a unit square in which numerical estimates are given for certain points. I became interested in this problem as a means to practice my computer simulation skills. The primary problem of such a simulation is the method of determining whether the point is inside or outside of the random triangle. An intuitive method is to draw vectors from the point to each vertex of the triangle and sum the angles between them. If these add to 360°, then the point is inside the triangle. This method is computationally intensive, so it's not ideal for a simulation. Another method is to define the location of the point in terms of vectors drawn between two of the vertices using what's called a barycentric coordinate system (see figure). A moment's reflection will reveal that defining the location of the point as a linear combination of these two vectors gives an easy way to determine whether or not the point is interior to the triangle. In reference to the figure, this will involve limits on the parameters, u and v and their sum.[2]
The location of a point in the interior of a triangle referenced as a linear combination of vectors between vertices. This barycentric coordinate system is nicely explicated in ref. 2.[2] (Drawn using Inkscape.) |
Point x and y | Probability | |
0.025 | 0.00065 | |
0.04 | 0.00174 | |
0.075 | 0.00662 | |
0.15 | 0.03038 | |
0.25 | 0.09264 | |
0.333... | 0.16194 | |
0.4 | 0.21360 | |
0.5 | 0.25000 |
The probability that fixed points of the same x and y values will be in the interior of a random triangle drawn in a unit square. Interestingly, a point placed in the center has a 25% probability of being inside a random triangle. (Graphed using Gnumeric.) |
Histogram of simulated values of the probability when the point is placed at random locations on the unit square. The mean probability is 7.64%. (Graphed using Gnumeric.) |