Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
M_TRIANGLE(3)		     Library Functions Manual		   M_TRIANGLE(3)

NAME
     M_Triangle -- Agar-Math triangle structure

SYNOPSIS
     #include <agar/core.h>
     #include <agar/gui.h>
     #include <agar/math/m.h>

DESCRIPTION
     The  M_Triangle2  structure  describes  a triangle in R^2 in terms of three
     lines:

     typedef struct m_triangle2 {
	     M_Line2 a, b, c;
     } M_Triangle2;

     Similarly, M_Triangle3 describes a triangle in R^3:

     typedef struct m_triangle3 {
	     M_Line3 a, b, c;
     } M_Triangle3;

INITIALIZATION
     M_Triangle2 M_TriangleFromLines2(M_Line2 L1, M_Line2 L2, M_Line2 L3)

     M_Triangle3 M_TriangleFromLines3(M_Line3 L1, M_Line3 L2, M_Line3 L3)

     M_Triangle2 M_TriangleFromPts2(M_Vector2 a, M_Vector2 b, M_Vector2 c)

     M_Triangle3 M_TriangleFromPts3(M_Vector3 a, M_Vector3 b, M_Vector3 c)

     M_Triangle2 M_TriangleRead2(AG_DataSource *ds)

     M_Triangle3 M_TriangleRead3(AG_DataSource *ds)

     void M_TriangleWrite2(AG_DataSource *ds, M_Triangle2 *T)

     void M_TriangleWrite3(AG_DataSource *ds, M_Triangle3 *T)

     M_Triangle2 M_TRIANGLE2_INITIALIZER(M_Vector2 a, M_Vector2 b, M_Vector2 c)

     M_Triangle3 M_TRIANGLE3_INITIALIZER(M_Vector3 a, M_Vector3 b, M_Vector3 c)

     The functions M_TriangleFromLines2() and M_TriangleFromLines3()  return  an
     M_Triangle2  or  M_Triangle3  describing a triangle in terms of three lines
     L1, L2 and L3.  The three lines must be non-colinear  and	their  endpoints
     must coincide.

     M_TriangleFromPts2() and M_TriangleFromPts3() return a triangle in terms of
     three (non-colinear) points a, b, c.

     The  M_TriangleRead[23]() and M_TriangleWrite[23]() functions read or write
     a triangle structure from/to an AG_DataSource(3).

     The macros M_TRIANGLE2_INITIALIZER() and  M_TRIANGLE3_INITIALIZER()  expand
     to static initializers for M_Triangle2 and M_Triangle3, respectively.

COMPUTATIONS
     int M_PointInTriangle2(M_Triangle2 T, M_Vector2 p)

     The  M_PointInTriangle2()	routine  tests	(using	barycentric coordinates)
     whether point p lies within the triangle T and returns 1 if it does, other-
     wise 0.

SEE ALSO
     AG_DataSource(3),	AG_Intro(3),  M_Circle(3),  M_Geometry(3),   M_Plane(3),
     M_Polygon(3), M_Rectangle(3), M_Sphere(3), M_Triangle(3), M_Vector(3)

HISTORY
     The M_Triangle structure first appeared in Agar 1.3.4.

Agar 1.7			December 21, 2022		   M_TRIANGLE(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=M_Triangle&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help