CompGeoJS Triangle Class


Well, I agree that a triangle does not sound very interesting, but it is an important geometric shape. A triangle in CompGeoJS may be created with a bounding rectangle and a small set of parameters. A PolygonalShape is returned from the creation so that the triangle may be manipulated as any other polygonal shape in the library. Equilateral, isosceles, right, and arbitrary triangles may be quickly created with a type parameter and two auxiliary parameters in (0, .5] (for the case of arbitrary triangles).

A few of these options are illustrated in the CompGeoJS Triangle Demo, which you can view on pretty much any late-model Safari/Firefox/Chrome and IE 9+.

As always, the JS code illustrating the use of CompGeoJS is documented and written for readability. There is no minification of obfuscation anywhere in the library as this is an open-source project.


Comments are closed.