libgeda

m_polygon.c File Reference

#include <config.h>
#include <math.h>
#include <string.h>
#include <libgeda_priv.h>
Include dependency graph for m_polygon.c:

Go to the source code of this file.

Functions

void m_polygon_append_bezier (GArray *points, BEZIER *bezier, int segments)
 Appends a bezier curve to the polygon.
void m_polygon_append_point (GArray *points, int x, int y)
 Appends a point to the list of vertices in a polygon.
gboolean m_polygon_interior_point (GArray *points, int x, int y)
 Determines if a point lies inside a polygon.
double m_polygon_shortest_distance (GArray *points, int x, int y, gboolean closed)
 Calculates the distance between the given point and the closest point on the perimeter of the polygon.

Function Documentation

void m_polygon_append_bezier ( GArray *  points,
BEZIER bezier,
int  segments 
)
Parameters:
points[inout] The vertices of the polygon. This parameter must not be NULL.
bezier[in] The bezier curve to append.
segments[in] The number of segments to subdivide the bezier curve into.

Definition at line 32 of file m_polygon.c.

Here is the call graph for this function:

void m_polygon_append_point ( GArray *  points,
int  x,
int  y 
)
Parameters:
points[inout] The vertices of the polygon. This parameter must not be NULL.
x[in] The x coordinate of the point to append.
y[in] The y coordinate of the point to append.

Definition at line 86 of file m_polygon.c.

gboolean m_polygon_interior_point ( GArray *  points,
int  x,
int  y 
)

TODO Untested

Parameters:
points[in] The vertices of the polygon. This function assumes the list of points represents a closed polygon. If the first and last point do not match, the line segment between them is implied. This parameter must not be NULL.
x[in] The x coordinate of the given point.
y[in] The y coordinate of the given point.
Returns:
TRUE if the point lies inside the polygon, FALSE if the point lies outside the polygon.

Definition at line 113 of file m_polygon.c.

double m_polygon_shortest_distance ( GArray *  points,
int  x,
int  y,
gboolean  closed 
)
Parameters:
[in]pointsThe polygon, where polygon != NULL.
[in]xThe x coordinate of the given point.
[in]yThe y coordinate of the given point.
[in]closedIf TRUE, the function treats the polygon as a closed shape, creating a line between the first and last points, if needed. If the first and last points are equal, or inherintly closed, this parameter does not matter.
Returns:
The shortest distance from the polygon to the point. With an invalid parameter, this function returns G_MAXDOUBLE.

Definition at line 155 of file m_polygon.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines