|  |  |  | Goffice Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
#include <goffice/graph/go-geometry.h> #define GO_GEOMETRY_ANGLE_TOLERANCE enum GOGeometrySide; enum GOGeometryRotationType; GOGeometryOBR; typedef 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); GOGeometrySide go_geometry_calc_label_position (GOGeometryOBR *obr,double alpha,double offset,GOGeometrySide side,GOGeometrySide anchor); GOGeometrySide go_geometry_calc_label_anchor (GOGeometryOBR *obr,double alpha); enum GODirection; GType go_direction_get_type (void); gboolean go_direction_is_forward (GODirection d); gboolean go_direction_is_horizontal (GODirection d);
typedef enum {
	GO_SIDE_LEFT		= 1 << 0,
	GO_SIDE_RIGHT		= 1 << 1,
	GO_SIDE_LEFT_RIGHT = 3 << 0,
	GO_SIDE_TOP		= 1 << 2,
	GO_SIDE_BOTTOM		= 1 << 3,
	GO_SIDE_TOP_BOTTOM = 3 << 2,
	GO_SIDE_AUTO		= 15
} GOGeometrySide;
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.
| 
 | cartesian coordinate | 
| 
 | cartesian coordinate | 
| 
 | polar coordinate | 
| 
 | polar coordinate | 
double go_geometry_point_to_segment (double xp,double yp,double xs,double ys,double w,double h);
| 
 | point coordinate | 
| 
 | point coordinate | 
| 
 | segment start coordinate | 
| 
 | segment start coordinate | 
| 
 | extent of segment | 
| 
 | extent of segment | 
| Returns : | the distance between a point and a segment. | 
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.
| 
 | a GOGeometryAABR | 
| 
 | a GOGeometryAABR | 
void go_geometry_OBR_to_AABR (GOGeometryOBR const *obr,GOGeometryAABR *aabr);
Stores Axis Aligned Bouding Rectangle of obr in aabr.
| 
 | a GOGeometryOBR | 
| 
 | 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.
| 
 | a GOGeometryOBR | 
| 
 | a GOGeometryOBR | 
| Returns : | TRUEif OOBRs overlap | 
GOGeometryRotationType  go_geometry_get_rotation_type   (double alpha);
Calculates rotation type for handling of special angles (alpha = n * pi / 2)
| 
 | angle in radians | 
| Returns : | a GOGeometryRotationType | 
GOGeometrySide go_geometry_calc_label_position (GOGeometryOBR *obr,double alpha,double offset,GOGeometrySide side,GOGeometrySide anchor);
Convenience routine that computes position of a label relative to an axis.
| 
 | bounding rectangle of label | 
| 
 | angle of axis | 
| 
 | minimum distance between label and axis | 
| 
 | side of label with respect to axis | 
| 
 | where to anchor the label | 
| Returns : | the computed anchor if anchor== GO_SIDE_AUTO, oranchorvalue. | 
GOGeometrySide go_geometry_calc_label_anchor (GOGeometryOBR *obr,double alpha);
| 
 | bounding rectangle of label | 
| 
 | angle of axis | 
| Returns : | computed label anchor, to be used by go_geometry_calc_label_position. | 
typedef enum {
	GO_DIRECTION_UP    = 0,
	GO_DIRECTION_DOWN  = 1,
	GO_DIRECTION_LEFT  = 2,
	GO_DIRECTION_RIGHT = 3,
	GO_DIRECTION_NONE  = 4
} GODirection;
gboolean            go_direction_is_forward             (GODirection d);
| 
 | GODirection | 
| Returns : | TRUE for GO_DIRECTION_DOWN or GO_DIRECTION_RIGHT. | 
gboolean            go_direction_is_horizontal          (GODirection d);
| 
 | GODirection | 
| Returns : | TRUE for GO_DIRECTION_LEFT and GO_DIRECTION_RIGHT. |