GDS-Render v1.2.1
|
Data Structures | |
union | bounding_box |
Union describing a bounding box. More... | |
struct | vector_2d |
Macros | |
#define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
Return smaller number. More... | |
#define | MAX(a, b) (((a) > (b)) ? (a) : (b)) |
Return bigger number. More... | |
#define | ABS_DBL(a) ((a) < 0 ? -(a) : (a)) |
#define | ABS_DBL(a) ((a) < 0.0 ? -(a) : (a)) |
#define | DEG2RAD(a) ((a)*M_PI/180.0) |
Typedefs | |
typedef void(* | conv_generic_to_vector_2d_t) (void *, struct vector_2d *) |
Functions | |
void | bounding_box_calculate_from_polygon (GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box) |
Calculate bounding box of polygon. More... | |
void | bounding_box_update_with_box (union bounding_box *destination, union bounding_box *update) |
Update an exisitng bounding box with another one. More... | |
void | bounding_box_prepare_empty (union bounding_box *box) |
Prepare an empty bounding box. More... | |
static void | calculate_path_miter_points (struct vector_2d *a, struct vector_2d *b, struct vector_2d *c, struct vector_2d *m1, struct vector_2d *m2, double width) |
Calculate path miter points for a pathwith a width and the anchors a b c . More... | |
void | bounding_box_update_with_path (GList *vertices, double thickness, conv_generic_to_vector_2d_t conv_func, union bounding_box *box) |
Calculate the bounding box of a path and update the given bounding box. More... | |
void | bounding_box_update_with_point (union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt) |
Update bounding box with a point. More... | |
void | bounding_box_get_all_points (struct vector_2d *points, union bounding_box *box) |
Return all four corner points of a bounding box. More... | |
void | bounding_box_apply_transform (double scale, double rotation_deg, bool flip_at_x, union bounding_box *box) |
Apply transformations onto bounding box. More... | |
static void | convert_gds_point_to_2d_vector (struct gds_point *pt, struct vector_2d *vector) |
static void | update_box_with_gfx (union bounding_box *box, struct gds_graphics *gfx) |
Update the given bounding box with the bounding box of a graphics element. More... | |
void | calculate_cell_bounding_box (union bounding_box *box, struct gds_cell *cell) |
Calculate bounding box of a gds cell. More... | |
double | vector_2d_scalar_multipy (struct vector_2d *a, struct vector_2d *b) |
void | vector_2d_normalize (struct vector_2d *vec) |
void | vector_2d_rotate (struct vector_2d *vec, double angle) |
struct vector_2d * | vector_2d_copy (struct vector_2d *opt_res, struct vector_2d *vec) |
struct vector_2d * | vector_2d_alloc (void) |
void | vector_2d_free (struct vector_2d *vec) |
void | vector_2d_scale (struct vector_2d *vec, double scale) |
double | vector_2d_abs (struct vector_2d *vec) |
double | vector_2d_calculate_angle_between (struct vector_2d *a, struct vector_2d *b) |
void | vector_2d_subtract (struct vector_2d *res, struct vector_2d *a, struct vector_2d *b) |
void | vector_2d_add (struct vector_2d *res, struct vector_2d *a, struct vector_2d *b) |
The geometric helper function are used to calculate bounding boxes
#define ABS_DBL | ( | a | ) | ((a) < 0 ? -(a) : (a)) |
Definition at line 38 of file bounding-box.c.
#define ABS_DBL | ( | a | ) | ((a) < 0.0 ? -(a) : (a)) |
Definition at line 36 of file vector-operations.c.
#define DEG2RAD | ( | a | ) | ((a)*M_PI/180.0) |
Definition at line 42 of file vector-operations.h.
#define MAX | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Return bigger number.
Definition at line 37 of file bounding-box.c.
#define MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Return smaller number.
Definition at line 36 of file bounding-box.c.
typedef void(* conv_generic_to_vector_2d_t) (void *, struct vector_2d *) |
Definition at line 76 of file bounding-box.h.
void bounding_box_apply_transform | ( | double | scale, |
double | rotation_deg, | ||
bool | flip_at_x, | ||
union bounding_box * | box | ||
) |
Apply transformations onto bounding box.
All corner points \( \vec{P_i} \) of the bounding box are transformed to output points \( \vec{P_o} \) by:
\( \vec{P_o} = s \cdot \begin{pmatrix}\cos\left(\phi\right) & -\sin\left(\phi\right)\\ \sin\left(\phi\right) & \cos\left(\phi\right)\end{pmatrix} \cdot \begin{pmatrix} 1 & 0 \\ 0 & -1^{m} \end{pmatrix} \cdot \vec{P_i} \), with:
The result is the bounding box generated around all output points
scale | Scaling factor |
rotation_deg | Rotation of bounding box around the origin in degrees (counterclockwise) |
flip_at_x | Flip the boundig box on the x axis before rotating. |
box | Bounding box the operations should be applied to. |
Definition at line 207 of file bounding-box.c.
void bounding_box_calculate_from_polygon | ( | GList * | vertices, |
conv_generic_to_vector_2d_t | conv_func, | ||
union bounding_box * | box | ||
) |
Calculate bounding box of polygon.
vertices | List of vertices that describe the polygon |
conv_func | Conversion function to convert vertices to vector_2d structs. |
box | Box to write to. This box is not updated! All previous data is discarded |
Definition at line 40 of file bounding-box.c.
void bounding_box_get_all_points | ( | struct vector_2d * | points, |
union bounding_box * | box | ||
) |
Return all four corner points of a bounding box.
[out] | points | Array of 4 vector_2d structs that has to be allocated by the caller |
box | Bounding box |
Definition at line 192 of file bounding-box.c.
void bounding_box_prepare_empty | ( | union bounding_box * | box | ) |
Prepare an empty bounding box.
Updating this specially prepared box, results in a bounding box that is the same size as the update
box | Box to preapre |
Definition at line 86 of file bounding-box.c.
void bounding_box_update_with_box | ( | union bounding_box * | destination, |
union bounding_box * | update | ||
) |
Update an exisitng bounding box with another one.
destination | Target box to update |
update | Box to update the target with |
Definition at line 71 of file bounding-box.c.
void bounding_box_update_with_path | ( | GList * | vertices, |
double | thickness, | ||
conv_generic_to_vector_2d_t | conv_func, | ||
union bounding_box * | box | ||
) |
Calculate the bounding box of a path and update the given bounding box.
vertices | Vertices the path is made up of |
thickness | Thisckness of the path |
conv_func | Conversion function for vertices to vector_2d structs |
box | Bounding box to write results in. |
Definition at line 148 of file bounding-box.c.
void bounding_box_update_with_point | ( | union bounding_box * | destination, |
conv_generic_to_vector_2d_t | conv_func, | ||
void * | pt | ||
) |
Update bounding box with a point.
destination | Bounding box to update |
conv_func | Conversion function to convert pt to a vector_2d. May be NULL |
pt | Point to update bounding box with |
Definition at line 174 of file bounding-box.c.
void calculate_cell_bounding_box | ( | union bounding_box * | box, |
struct gds_cell * | cell | ||
) |
Calculate bounding box of a gds cell.
This function updates a given bounding box with the dimensions of a gds_cell. Please note that the handling of path miter points is not complete yet. If a path object is the outmost object of your cell at any edge, the resulting bounding box might be the wrong size. The devistion from the real size is guaranteed to be within the width of the path object.
box | Resulting boundig box. Will be updated and not overwritten |
cell | Toplevel cell |
Definition at line 80 of file cell-geometrics.c.
|
static |
Calculate path miter points for a pathwith a width
and the anchors a
b
c
.
[in] | a | |
[in] | b | |
[in] | c | |
[out] | m1 | |
[out] | m2 | |
[in] | width |
m1
and m2
Definition at line 105 of file bounding-box.c.
|
static |
Update the given bounding box with the bounding box of a graphics element.
box | box to update |
gfx | Graphics element |
Definition at line 46 of file cell-geometrics.c.
double vector_2d_abs | ( | struct vector_2d * | vec | ) |
struct vector_2d * vector_2d_alloc | ( | void | ) |
Definition at line 123 of file vector-operations.c.
Definition at line 75 of file vector-operations.c.
void vector_2d_free | ( | struct vector_2d * | vec | ) |
Definition at line 99 of file vector-operations.c.
void vector_2d_normalize | ( | struct vector_2d * | vec | ) |
void vector_2d_rotate | ( | struct vector_2d * | vec, |
double | angle | ||
) |
Definition at line 57 of file vector-operations.c.
void vector_2d_scale | ( | struct vector_2d * | vec, |
double | scale | ||
) |