/* Copyright (C) 2017-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4bb.ctr */ #ifndef DK4BB_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4BB_H_INCLUDED 1 #line 9 "dk4bb.ctr" /** @file dk4bb.h Bounding box for drawing operations. */ #ifndef DK4CONF_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4conf.h" #else #include #endif #endif #ifndef DK4TYPES_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4types.h" #else #include #endif #endif /** Bounding box. */ typedef struct { double xmin; /**< Minimum x value. */ double xmax; /**< Maximum x value. */ double ymin; /**< Minimum y value. */ double ymax; /**< Maximum y value. */ unsigned char fl; /**< Flags: Have x (bit 0), have y (bit 1). */ } dk4_bb_t; #ifdef __cplusplus extern "C" { #endif /** Initialize bounding box. @param bbptr Bounding box to initialize. */ void dk4bb_init( dk4_bb_t *bbptr ); /** Add x coordinate to bounding box. @param bbptr Bounding box to modify. @param x Coordinate value to add. */ void dk4bb_add_x( dk4_bb_t *bbptr, double x ); /** Add y coordinate to bounding box. @param bbptr Bounding box to modify. @param y Coordinate value to add. */ void dk4bb_add_y( dk4_bb_t *bbptr, double y ); /** Add point to bounding box. @param bbptr Bounding box to modify. @param x X coordinate of point. @param y Y coordinate of point. */ void dk4bb_add_point( dk4_bb_t *bbptr, double x, double y ); /** Add Bezier spline segment to bounding box. @param bbptr Bounding box to modify. @param x0 Start point, x coordinate. @param y0 Start point, y coordinate. @param c0x Control point next to start point, x coordinate. @param c0y Control point next to start point, y coordinate. @param c1x Control point next to end point, x coordinate. @param c1y Control point next to end point, y coordinate. @param x1 End point, x coordinate. @param y1 End point, y coordinate. */ void dk4bb_add_bezier( dk4_bb_t *bbptr, double x0, double y0, double c0x, double c0y, double c1x, double c1y, double x1, double y1 ); /** Add bounding box for a rotated ellipse. @param bbptr Bounding box to modify. @param xc Center point x coordinate. @param yc Center point y coordinate. @param rx X radius. @param ry Y radius. @param rot Rotation counterclockwise in radians. */ void dk4bb_add_rotated_ellipse( dk4_bb_t *bbptr, double xc, double yc, double rx, double ry, double rot ); /** Add one bounding box to another one. @param pdest Destination bounding box. @param psrc Source bounding box. */ void dk4bb_add_bb( dk4_bb_t *pdest, dk4_bb_t const *psrc ); /** Check whether an x value is saved in the bounding box. @param bbptr Bounding box to query. @return 1 if x value available, 0 otherwise. */ int dk4bb_have_x( const dk4_bb_t *bbptr ); /** Check whether an y value is saved in the bounding box. @param bbptr Bounding box to query. @return 1 if y value available, 0 otherwise. */ int dk4bb_have_y( const dk4_bb_t *bbptr ); /** Retrieve minimum x value. @param bbptr Bounding box to query. @return Minimum x value saved in the bounding box. */ double dk4bb_get_xmin( const dk4_bb_t *bbptr ); /** Retrieve maximum x value. @param bbptr Bounding box to query. @return Maximum x value saved in the bounding box. */ double dk4bb_get_xmax( const dk4_bb_t *bbptr ); /** Retrieve minimum y value. @param bbptr Bounding box to query. @return Minimum y value saved in the bounding box. */ double dk4bb_get_ymin( const dk4_bb_t *bbptr ); /** Retrieve maximum y value. @param bbptr Bounding box to query. @return Maximum y value saved in the bounding box. */ double dk4bb_get_ymax( const dk4_bb_t *bbptr ); /** Check whether an outer box contains an inner box candidate. Both boxes must have both x and y information. @param pouter Outer box. @param pinner Inner box candidate. @param aborder Flag: Allow overlapping borders. @return 1 if pouter contains pinner, 0 otherwise. */ int dk4bb_contains_bb( const dk4_bb_t *pouter, const dk4_bb_t *pinner, int aborder ); #ifdef __cplusplus } #endif /* vim: set ai sw=4 ts=4 : */ #endif