|  |  |  | Goffice Reference Manual |  | 
|---|---|---|---|---|
#include <goffice/graph/go-geometry.h> #define GO_GEOMETRY_ANGLE_TOLERANCE enum GOGeometrySide; enum GOGeometryRotationType; GOGeometryOBR; #define GOGeometryAABR void go_geometry_cartesian_to_polar (double x, double y, double *rho, double *theta); double go_geometry_point_to_segment (double xp, double yp, double xs, double ys, double w, double h); void go_geometry_AABR_add (GOGeometryAABR *aabr0, GOGeometryAABR const *aabr1); void go_geometry_OBR_to_AABR (GOGeometryOBR const *obr, GOGeometryAABR *aabr); gboolean go_geometry_test_OBR_overlap (GOGeometryOBR const *obr0, GOGeometryOBR const *obr1); GOGeometryRotationType go_geometry_get_rotation_type (double alpha); void go_geometry_calc_label_position (GOGeometryOBR *obr, double alpha, double offset, GOGeometrySide side);
typedef enum {
	GO_ROTATE_NONE = 0,
	GO_ROTATE_COUNTERCLOCKWISE = 1,
	GO_ROTATE_UPSIDEDOWN = 2,
	GO_ROTATE_CLOCKWISE = 3,	
	GO_ROTATE_FREE = 4
} GOGeometryRotationType;
typedef struct {
        double x,y;     /* Center */
        double w,h;     /* Edges */
        double alpha;   /* Angle from x axis to w edge, in radians */
} GOGeometryOBR;
void        go_geometry_cartesian_to_polar  (double x,
                                             double y,
                                             double *rho,
                                             double *theta);
Converts cartesion coordinates to polar coordinates.
| x: | cartesian coordinate | 
| y: | cartesian coordinate | 
| rho: | polar coordinate | 
| theta: | polar coordinate | 
double      go_geometry_point_to_segment    (double xp,
                                             double yp,
                                             double xs,
                                             double ys,
                                             double w,
                                             double h);
Computes the distance between a point and a segment.
| xp: | point coordinate | 
| yp: | point coordinate | 
| xs: | segment start coordinate | 
| ys: | segment start coordinate | 
| w: | extent of segment | 
| h: | extent of segment | 
| Returns : | 
void go_geometry_AABR_add (GOGeometryAABR *aabr0, GOGeometryAABR const *aabr1);
Computes the Axis Aligned Bounding Rectangle of aabr0 and aabr1, and stores result in aabr0.
| aabr0: | a GOGeometryAABR | 
| aabr1: | a GOGeometryAABR | 
void go_geometry_OBR_to_AABR (GOGeometryOBR const *obr, GOGeometryAABR *aabr);
Stores Axis Aligned Bouding Rectangle of obr in aabr.
| obr: | a GOGeometryOBR | 
| aabr: | a GOGeometryAABR | 
gboolean go_geometry_test_OBR_overlap (GOGeometryOBR const *obr0, GOGeometryOBR const *obr1);
Overlap test of Oriented Bounding Rectangles by the separating axis method.
| obr0: | a GOGeometryOBR | 
| obr1: | a GOGeometryOBR | 
| Returns : | TRUEif OOBRs overlap | 
GOGeometryRotationType go_geometry_get_rotation_type (double alpha);
Returns rotation type for handling of special angles (alpha = n * pi / 2)
| alpha: | angle in radians | 
| Returns : | a GOGeometryRotationType | 
void go_geometry_calc_label_position (GOGeometryOBR *obr, double alpha, double offset, GOGeometrySide side);
| obr: | |
| alpha: | |
| offset: | |
| side: |