mupdf
Loading...
Searching...
No Matches
geometry.h File Reference
#include "mupdf/fitz/system.h"
#include <math.h>
#include <assert.h>
Include dependency graph for geometry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fz_point
struct  fz_rect
struct  fz_irect
struct  fz_matrix
struct  fz_quad

Macros

#define M_PI   3.14159265358979323846
#define FZ_EXPAND(A)
#define FZ_COMBINE(A, B)
#define FZ_COMBINE2(A, B, C, D)
#define FZ_BLEND(SRC, DST, AMOUNT)
#define DIV_BY_ZERO(a, b, min, max)
#define FZ_MIN_INF_RECT   ((int)0x80000000)
#define FZ_MAX_INF_RECT   ((int)0x7fffff80)
#define fz_bytes_from_bits(A)

Functions

float fz_atof (const char *s)
int fz_atoi (const char *s)
int64_t fz_atoi64 (const char *s)
size_t fz_atoz (const char *s)
fz_matrix fz_concat (fz_matrix left, fz_matrix right)
fz_matrix fz_scale (float sx, float sy)
fz_matrix fz_pre_scale (fz_matrix m, float sx, float sy)
fz_matrix fz_post_scale (fz_matrix m, float sx, float sy)
fz_matrix fz_shear (float sx, float sy)
fz_matrix fz_pre_shear (fz_matrix m, float sx, float sy)
fz_matrix fz_rotate (float degrees)
fz_matrix fz_pre_rotate (fz_matrix m, float degrees)
fz_matrix fz_translate (float tx, float ty)
fz_matrix fz_pre_translate (fz_matrix m, float tx, float ty)
fz_matrix fz_transform_page (fz_rect mediabox, float resolution, float rotate)
fz_matrix fz_invert_matrix (fz_matrix matrix)
int fz_try_invert_matrix (fz_matrix *inv, fz_matrix src)
int fz_is_rectilinear (fz_matrix m)
float fz_matrix_expansion (fz_matrix m)
fz_rect fz_intersect_rect (fz_rect a, fz_rect b)
fz_irect fz_intersect_irect (fz_irect a, fz_irect b)
fz_rect fz_union_rect (fz_rect a, fz_rect b)
fz_irect fz_irect_from_rect (fz_rect rect)
fz_irect fz_round_rect (fz_rect rect)
fz_rect fz_rect_from_irect (fz_irect bbox)
fz_rect fz_expand_rect (fz_rect b, float expand)
fz_irect fz_expand_irect (fz_irect a, int expand)
float fz_rect_area (fz_rect r)
fz_rect fz_include_point_in_rect (fz_rect r, fz_point p)
fz_rect fz_translate_rect (fz_rect a, float xoff, float yoff)
fz_irect fz_translate_irect (fz_irect a, int xoff, int yoff)
int fz_contains_rect (fz_rect a, fz_rect b)
int fz_overlaps_rect (fz_rect a, fz_rect b)
fz_point fz_transform_point (fz_point point, fz_matrix m)
fz_point fz_transform_point_xy (float x, float y, fz_matrix m)
fz_point fz_transform_vector (fz_point vector, fz_matrix m)
fz_rect fz_transform_rect (fz_rect rect, fz_matrix m)
fz_point fz_normalize_vector (fz_point p)
fz_matrix fz_gridfit_matrix (int as_tiled, fz_matrix m)
float fz_matrix_max_expansion (fz_matrix m)
int fz_is_valid_quad (fz_quad q)
int fz_is_empty_quad (fz_quad q)
int fz_is_infinite_quad (fz_quad q)
fz_quad fz_quad_from_rect (fz_rect r)
fz_rect fz_rect_from_quad (fz_quad q)
fz_quad fz_transform_quad (fz_quad q, fz_matrix m)
int fz_is_point_inside_quad (fz_point p, fz_quad q)
int fz_is_point_inside_rect (fz_point p, fz_rect r)
int fz_is_point_inside_irect (int x, int y, fz_irect r)
int fz_is_rect_inside_rect (fz_rect inner, fz_rect outer)
int fz_is_irect_inside_irect (fz_irect inner, fz_irect outer)
int fz_is_quad_inside_quad (fz_quad needle, fz_quad haystack)
int fz_is_quad_intersecting_quad (fz_quad a, fz_quad b)
int fz_ckd_mul_i32 (int32_t *out, int32_t a, int32_t b)
int fz_ckd_add_i32 (int32_t *out, int32_t a, int32_t b)
int fz_ckd_sub_i32 (int32_t *out, int32_t a, int32_t b)
int fz_ckd_mul_u32 (uint32_t *out, uint32_t a, uint32_t b)
int fz_ckd_add_u32 (uint32_t *out, uint32_t a, uint32_t b)
int fz_ckd_sub_u32 (uint32_t *out, uint32_t a, uint32_t b)
int fz_ckd_mul_int (int *out, int a, int b)
int fz_ckd_add_int (int *out, int a, int b)
int fz_ckd_sub_int (int *out, int a, int b)
int fz_ckd_mul_uint (unsigned int *out, unsigned int a, unsigned int b)
int fz_ckd_add_uint (unsigned int *out, unsigned int a, unsigned int b)
int fz_ckd_sub_uint (unsigned int *out, unsigned int a, unsigned int b)
int fz_ckd_mul_size (size_t *out, size_t a, size_t b)
int fz_ckd_add_size (size_t *out, size_t a, size_t b)
int fz_ckd_sub_size (size_t *out, size_t a, size_t b)
int fz_ckd_mul_i64 (int64_t *out, int64_t a, int64_t b)
int fz_ckd_add_i64 (int64_t *out, int64_t a, int64_t b)
int fz_ckd_sub_i64 (int64_t *out, int64_t a, int64_t b)
int fz_ckd_mul_u64 (uint64_t *out, uint64_t a, uint64_t b)
int fz_ckd_add_u64 (uint64_t *out, uint64_t a, uint64_t b)
int fz_ckd_sub_u64 (uint64_t *out, uint64_t a, uint64_t b)
int fz_ckd_size_from_i64 (size_t *out, int64_t in)
int fz_ckd_int_from_i64 (int *out, int64_t in)

Variables

FZ_DATA const fz_rect fz_unit_rect
FZ_DATA const fz_rect fz_empty_rect
FZ_DATA const fz_irect fz_empty_irect
FZ_DATA const fz_rect fz_infinite_rect
FZ_DATA const fz_irect fz_infinite_irect
FZ_DATA const fz_rect fz_invalid_rect
FZ_DATA const fz_irect fz_invalid_irect
FZ_DATA const fz_matrix fz_identity
FZ_DATA const fz_quad fz_invalid_quad
FZ_DATA const fz_quad fz_infinite_quad

Macro Definition Documentation

◆ DIV_BY_ZERO

#define DIV_BY_ZERO ( a,
b,
min,
max )
Value:
(((a) < 0) ^ ((b) < 0) ? (min) : (max))

◆ FZ_BLEND

#define FZ_BLEND ( SRC,
DST,
AMOUNT )
Value:
((((SRC)-(DST))*(AMOUNT) + ((DST)<<8))>>8)

Blend SRC and DST (in the same range) together according to AMOUNT (in the 0...256 range).

◆ fz_bytes_from_bits

#define fz_bytes_from_bits ( A)
Value:
(((A)>>3) + !!((A) & 7))

◆ FZ_COMBINE

#define FZ_COMBINE ( A,
B )
Value:
(((A)*(B))>>8)

Combine values A (in any range) and B (in the 0..256 range), to give a single value in the same range as A was.

◆ FZ_COMBINE2

#define FZ_COMBINE2 ( A,
B,
C,
D )
Value:
(((A) * (B) + (C) * (D))>>8)

Combine values A and C (in the same (any) range) and B and D (in the 0..256 range), to give a single value in the same range as A and C were.

◆ FZ_EXPAND

#define FZ_EXPAND ( A)
Value:
((A)+((A)>>7))

Expand a value A from the 0...255 range to the 0..256 range

◆ FZ_MAX_INF_RECT

#define FZ_MAX_INF_RECT   ((int)0x7fffff80)

◆ FZ_MIN_INF_RECT

#define FZ_MIN_INF_RECT   ((int)0x80000000)

fz_rect is a rectangle represented by two diagonally opposite corners at arbitrary coordinates.

Rectangles are always axis-aligned with the X- and Y- axes. We wish to distinguish rectangles in 3 categories; infinite, finite, and invalid. Zero area rectangles are a sub-category of finite ones.

For all valid rectangles, x0 <= x1 and y0 <= y1 in all cases. Infinite rectangles have x0 = y0 = FZ_MIN_INF_RECT, x1 = y1 = FZ_MAX_INF_RECT. For any non infinite valid rectangle, the area is defined as (x1 - x0) * (y1 - y0).

To check for empty or infinite rectangles use fz_is_empty_rect and fz_is_infinite_rect. To check for valid rectangles use fz_is_valid_rect.

We choose this representation, so that we can easily distinguish the difference between intersecting 2 valid rectangles and getting an invalid one, as opposed to getting a zero area one (which nonetheless has valid bounds within the plane).

x0, y0: The top left corner.

x1, y1: The bottom right corner.

We choose FZ_{MIN,MAX}_INF_RECT to be the largest 32bit signed integer values that survive roundtripping to floats.

◆ M_PI

#define M_PI   3.14159265358979323846

Function Documentation

◆ fz_atof()

float fz_atof ( const char * s)

Range checking atof

◆ fz_atoi()

int fz_atoi ( const char * s)

atoi that copes with NULL

◆ fz_atoi64()

int64_t fz_atoi64 ( const char * s)

64bit atoi that copes with NULL

◆ fz_atoz()

size_t fz_atoz ( const char * s)

size_t atoi that copes with NULL.

NOTE: limited to 63bits. Negative numbers are returned as 0.

◆ fz_ckd_add_i32()

int fz_ckd_add_i32 ( int32_t * out,
int32_t a,
int32_t b )

◆ fz_ckd_add_i64()

int fz_ckd_add_i64 ( int64_t * out,
int64_t a,
int64_t b )

◆ fz_ckd_add_int()

int fz_ckd_add_int ( int * out,
int a,
int b )

◆ fz_ckd_add_size()

int fz_ckd_add_size ( size_t * out,
size_t a,
size_t b )

◆ fz_ckd_add_u32()

int fz_ckd_add_u32 ( uint32_t * out,
uint32_t a,
uint32_t b )

◆ fz_ckd_add_u64()

int fz_ckd_add_u64 ( uint64_t * out,
uint64_t a,
uint64_t b )

◆ fz_ckd_add_uint()

int fz_ckd_add_uint ( unsigned int * out,
unsigned int a,
unsigned int b )

◆ fz_ckd_int_from_i64()

int fz_ckd_int_from_i64 ( int * out,
int64_t in )

◆ fz_ckd_mul_i32()

int fz_ckd_mul_i32 ( int32_t * out,
int32_t a,
int32_t b )

◆ fz_ckd_mul_i64()

int fz_ckd_mul_i64 ( int64_t * out,
int64_t a,
int64_t b )

◆ fz_ckd_mul_int()

int fz_ckd_mul_int ( int * out,
int a,
int b )

◆ fz_ckd_mul_size()

int fz_ckd_mul_size ( size_t * out,
size_t a,
size_t b )

◆ fz_ckd_mul_u32()

int fz_ckd_mul_u32 ( uint32_t * out,
uint32_t a,
uint32_t b )

◆ fz_ckd_mul_u64()

int fz_ckd_mul_u64 ( uint64_t * out,
uint64_t a,
uint64_t b )

◆ fz_ckd_mul_uint()

int fz_ckd_mul_uint ( unsigned int * out,
unsigned int a,
unsigned int b )

◆ fz_ckd_size_from_i64()

int fz_ckd_size_from_i64 ( size_t * out,
int64_t in )

◆ fz_ckd_sub_i32()

int fz_ckd_sub_i32 ( int32_t * out,
int32_t a,
int32_t b )

◆ fz_ckd_sub_i64()

int fz_ckd_sub_i64 ( int64_t * out,
int64_t a,
int64_t b )

◆ fz_ckd_sub_int()

int fz_ckd_sub_int ( int * out,
int a,
int b )

◆ fz_ckd_sub_size()

int fz_ckd_sub_size ( size_t * out,
size_t a,
size_t b )

◆ fz_ckd_sub_u32()

int fz_ckd_sub_u32 ( uint32_t * out,
uint32_t a,
uint32_t b )

◆ fz_ckd_sub_u64()

int fz_ckd_sub_u64 ( uint64_t * out,
uint64_t a,
uint64_t b )

◆ fz_ckd_sub_uint()

int fz_ckd_sub_uint ( unsigned int * out,
unsigned int a,
unsigned int b )

◆ fz_concat()

fz_matrix fz_concat ( fz_matrix left,
fz_matrix right )

Multiply two matrices.

The order of the two matrices are important since matrix multiplication is not commutative.

Returns result.

◆ fz_contains_rect()

int fz_contains_rect ( fz_rect a,
fz_rect b )

Test rectangle inclusion.

Return true if a entirely contains b.

◆ fz_expand_irect()

fz_irect fz_expand_irect ( fz_irect a,
int expand )

◆ fz_expand_rect()

fz_rect fz_expand_rect ( fz_rect b,
float expand )

Expand a bbox by a given amount in all directions.

◆ fz_gridfit_matrix()

fz_matrix fz_gridfit_matrix ( int as_tiled,
fz_matrix m )

Grid fit a matrix.

as_tiled = 0 => adjust the matrix so that the image of the unit square completely covers any pixel that was touched by the image of the unit square under the original matrix.

as_tiled = 1 => adjust the matrix so that the corners of the image of the unit square align with the closest integer corner of the image of the unit square under the original matrix.

◆ fz_include_point_in_rect()

fz_rect fz_include_point_in_rect ( fz_rect r,
fz_point p )

Expand a bbox to include a given point. To create a rectangle that encompasses a sequence of points, the rectangle must first be set to be the empty rectangle at one of the points before including the others.

◆ fz_intersect_irect()

fz_irect fz_intersect_irect ( fz_irect a,
fz_irect b )

Compute intersection of two bounding boxes.

Similar to fz_intersect_rect but operates on two bounding boxes instead of two rectangles.

◆ fz_intersect_rect()

fz_rect fz_intersect_rect ( fz_rect a,
fz_rect b )

Compute intersection of two rectangles.

Given two rectangles, update the first to be the smallest axis-aligned rectangle that covers the area covered by both given rectangles. If either rectangle is empty then the intersection is also empty. If either rectangle is infinite then the intersection is simply the non-infinite rectangle. Should both rectangles be infinite, then the intersection is also infinite.

◆ fz_invert_matrix()

fz_matrix fz_invert_matrix ( fz_matrix matrix)

Create an inverse matrix.

matrix: Matrix to invert. A degenerate matrix, where the determinant is equal to zero, can not be inverted and the original matrix is returned instead.

Returns inverse.

◆ fz_irect_from_rect()

fz_irect fz_irect_from_rect ( fz_rect rect)

Convert a rect into the minimal bounding box that covers the rectangle.

Coordinates in a bounding box are integers, so rounding of the rects coordinates takes place. The top left corner is rounded upwards and left while the bottom right corner is rounded downwards and to the right.

◆ fz_is_empty_quad()

int fz_is_empty_quad ( fz_quad q)

Is a quad empty?

◆ fz_is_infinite_quad()

int fz_is_infinite_quad ( fz_quad q)

Is a quad infinite?

◆ fz_is_irect_inside_irect()

int fz_is_irect_inside_irect ( fz_irect inner,
fz_irect outer )

Inclusion test for irects.

rects are assumed to be both open or both closed.

No invalid rect can include any other rect. No invalid rect can be included by any rect. Empty (point) rects can include themselves. Empty (line) rects can include many (subline) rects.

◆ fz_is_point_inside_irect()

int fz_is_point_inside_irect ( int x,
int y,
fz_irect r )

Inclusion test for irects. (Rect is assumed to be open, i.e. top right corner is not included).

◆ fz_is_point_inside_quad()

int fz_is_point_inside_quad ( fz_point p,
fz_quad q )

Inclusion test for quads.

◆ fz_is_point_inside_rect()

int fz_is_point_inside_rect ( fz_point p,
fz_rect r )

Inclusion test for rects. (Rect is assumed to be open, i.e. top right corner is not included).

◆ fz_is_quad_inside_quad()

int fz_is_quad_inside_quad ( fz_quad needle,
fz_quad haystack )

Inclusion test for quad in quad.

This may break down if quads are not 'well formed'.

◆ fz_is_quad_intersecting_quad()

int fz_is_quad_intersecting_quad ( fz_quad a,
fz_quad b )

Intersection test for quads.

This may break down if quads are not 'well formed'.

◆ fz_is_rect_inside_rect()

int fz_is_rect_inside_rect ( fz_rect inner,
fz_rect outer )

Inclusion test for rects.

rects are assumed to be both open or both closed.

No invalid rect can include any other rect. No invalid rect can be included by any rect. Empty (point) rects can include themselves. Empty (line) rects can include many (subline) rects.

◆ fz_is_rectilinear()

int fz_is_rectilinear ( fz_matrix m)

Check if a transformation is rectilinear.

Rectilinear means that no shearing is present and that any rotations present are a multiple of 90 degrees. Usually this is used to make sure that axis-aligned rectangles before the transformation are still axis-aligned rectangles afterwards.

◆ fz_is_valid_quad()

int fz_is_valid_quad ( fz_quad q)

Is a quad valid?

◆ fz_matrix_expansion()

float fz_matrix_expansion ( fz_matrix m)

Calculate average scaling factor of matrix.

◆ fz_matrix_max_expansion()

float fz_matrix_max_expansion ( fz_matrix m)

Find the largest expansion performed by this matrix. (i.e. max(abs(m.a),abs(m.b),abs(m.c),abs(m.d))

◆ fz_normalize_vector()

fz_point fz_normalize_vector ( fz_point p)

Normalize a vector to length one.

◆ fz_overlaps_rect()

int fz_overlaps_rect ( fz_rect a,
fz_rect b )

Test rectangle overlap.

Returns true if the area of the overlap is non zero.

◆ fz_post_scale()

fz_matrix fz_post_scale ( fz_matrix m,
float sx,
float sy )

Scale a matrix by postmultiplication.

m: Pointer to the matrix to scale

sx, sy: Scaling factors along the X- and Y-axes. A scaling factor of 1.0 will not cause any scaling along the relevant axis.

Returns m (updated).

◆ fz_pre_rotate()

fz_matrix fz_pre_rotate ( fz_matrix m,
float degrees )

Rotate a transformation by premultiplying.

The premultiplied matrix is of the form [ cos(deg) sin(deg) -sin(deg) cos(deg) 0 0 ].

m: Pointer to matrix to premultiply.

degrees: Degrees of counter clockwise rotation. Values less than zero and greater than 360 are handled as expected.

Returns m (updated).

◆ fz_pre_scale()

fz_matrix fz_pre_scale ( fz_matrix m,
float sx,
float sy )

Scale a matrix by premultiplication.

m: Pointer to the matrix to scale

sx, sy: Scaling factors along the X- and Y-axes. A scaling factor of 1.0 will not cause any scaling along the relevant axis.

Returns m (updated).

◆ fz_pre_shear()

fz_matrix fz_pre_shear ( fz_matrix m,
float sx,
float sy )

Premultiply a matrix with a shearing matrix.

The shearing matrix is of the form [ 1 sy sx 1 0 0 ].

m: pointer to matrix to premultiply

sx, sy: Shearing factors. A shearing factor of 0.0 will not cause any shearing along the relevant axis.

Returns m (updated).

◆ fz_pre_translate()

fz_matrix fz_pre_translate ( fz_matrix m,
float tx,
float ty )

Translate a matrix by premultiplication.

m: The matrix to translate

tx, ty: Translation distances along the X- and Y-axes. A translation of 0 will not cause any translation along the relevant axis.

Returns m.

◆ fz_quad_from_rect()

fz_quad fz_quad_from_rect ( fz_rect r)

Convert a rect to a quad (losslessly).

◆ fz_rect_area()

float fz_rect_area ( fz_rect r)

Calculate the area of a rectangle.

Always non-negative. All invalid or empty rects return 0.

◆ fz_rect_from_irect()

fz_rect fz_rect_from_irect ( fz_irect bbox)

Convert a bbox into a rect.

For our purposes, a rect can represent all the values we meet in a bbox, so nothing can go wrong.

rect: A place to store the generated rectangle.

bbox: The bbox to convert.

Returns rect (updated).

◆ fz_rect_from_quad()

fz_rect fz_rect_from_quad ( fz_quad q)

Convert a quad to the smallest rect that covers it.

◆ fz_rotate()

fz_matrix fz_rotate ( float degrees)

Create a rotation matrix.

The returned matrix is of the form [ cos(deg) sin(deg) -sin(deg) cos(deg) 0 0 ].

m: Pointer to place to store matrix

degrees: Degrees of counter clockwise rotation. Values less than zero and greater than 360 are handled as expected.

Returns m.

◆ fz_round_rect()

fz_irect fz_round_rect ( fz_rect rect)

Round rectangle coordinates.

Coordinates in a bounding box are integers, so rounding of the rects coordinates takes place. The top left corner is rounded upwards and left while the bottom right corner is rounded downwards and to the right.

This differs from fz_irect_from_rect, in that fz_irect_from_rect slavishly follows the numbers (i.e any slight over/under calculations can cause whole extra pixels to be added). fz_round_rect allows for a small amount of rounding error when calculating the bbox.

◆ fz_scale()

fz_matrix fz_scale ( float sx,
float sy )

Create a scaling matrix.

The returned matrix is of the form [ sx 0 0 sy 0 0 ].

m: Pointer to the matrix to populate

sx, sy: Scaling factors along the X- and Y-axes. A scaling factor of 1.0 will not cause any scaling along the relevant axis.

Returns m.

◆ fz_shear()

fz_matrix fz_shear ( float sx,
float sy )

Create a shearing matrix.

The returned matrix is of the form [ 1 sy sx 1 0 0 ].

m: pointer to place to store returned matrix

sx, sy: Shearing factors. A shearing factor of 0.0 will not cause any shearing along the relevant axis.

Returns m.

◆ fz_transform_page()

fz_matrix fz_transform_page ( fz_rect mediabox,
float resolution,
float rotate )

Create transform matrix to draw page at a given resolution and rotation. Adjusts the scaling factors so that the page covers whole number of pixels and adjust the page origin to be at 0,0.

◆ fz_transform_point()

fz_point fz_transform_point ( fz_point point,
fz_matrix m )

Apply a transformation to a point.

transform: Transformation matrix to apply. See fz_concat, fz_scale, fz_rotate and fz_translate for how to create a matrix.

point: Pointer to point to update.

Returns transform (unchanged).

◆ fz_transform_point_xy()

fz_point fz_transform_point_xy ( float x,
float y,
fz_matrix m )

◆ fz_transform_quad()

fz_quad fz_transform_quad ( fz_quad q,
fz_matrix m )

Transform a quad by a matrix.

◆ fz_transform_rect()

fz_rect fz_transform_rect ( fz_rect rect,
fz_matrix m )

Apply a transform to a rectangle.

After the four corner points of the axis-aligned rectangle have been transformed it may not longer be axis-aligned. So a new axis-aligned rectangle is created covering at least the area of the transformed rectangle.

transform: Transformation matrix to apply. See fz_concat, fz_scale and fz_rotate for how to create a matrix.

rect: Rectangle to be transformed. The two special cases fz_empty_rect and fz_infinite_rect, may be used but are returned unchanged as expected.

◆ fz_transform_vector()

fz_point fz_transform_vector ( fz_point vector,
fz_matrix m )

Apply a transformation to a vector.

transform: Transformation matrix to apply. See fz_concat, fz_scale and fz_rotate for how to create a matrix. Any translation will be ignored.

vector: Pointer to vector to update.

◆ fz_translate()

fz_matrix fz_translate ( float tx,
float ty )

Create a translation matrix.

The returned matrix is of the form [ 1 0 0 1 tx ty ].

m: A place to store the created matrix.

tx, ty: Translation distances along the X- and Y-axes. A translation of 0 will not cause any translation along the relevant axis.

Returns m.

◆ fz_translate_irect()

fz_irect fz_translate_irect ( fz_irect a,
int xoff,
int yoff )

◆ fz_translate_rect()

fz_rect fz_translate_rect ( fz_rect a,
float xoff,
float yoff )

Translate bounding box.

Translate a bbox by a given x and y offset. Allows for overflow.

◆ fz_try_invert_matrix()

int fz_try_invert_matrix ( fz_matrix * inv,
fz_matrix src )

Attempt to create an inverse matrix.

inv: Place to store inverse matrix.

src: Matrix to invert. A degenerate matrix, where the determinant is equal to zero, can not be inverted.

Returns 1 if matrix is degenerate (singular), or 0 otherwise.

◆ fz_union_rect()

fz_rect fz_union_rect ( fz_rect a,
fz_rect b )

Compute union of two rectangles.

Given two rectangles, update the first to be the smallest axis-aligned rectangle that encompasses both given rectangles. If either rectangle is infinite then the union is also infinite. If either rectangle is empty then the union is simply the non-empty rectangle. Should both rectangles be empty, then the union is also empty.

Variable Documentation

◆ fz_empty_irect

FZ_DATA const fz_irect fz_empty_irect
extern

◆ fz_empty_rect

FZ_DATA const fz_rect fz_empty_rect
extern

An empty rectangle with an area equal to zero.

◆ fz_identity

FZ_DATA const fz_matrix fz_identity
extern

Identity transform matrix.

◆ fz_infinite_irect

FZ_DATA const fz_irect fz_infinite_irect
extern

◆ fz_infinite_quad

FZ_DATA const fz_quad fz_infinite_quad
extern

◆ fz_infinite_rect

FZ_DATA const fz_rect fz_infinite_rect
extern

An infinite rectangle.

◆ fz_invalid_irect

FZ_DATA const fz_irect fz_invalid_irect
extern

◆ fz_invalid_quad

FZ_DATA const fz_quad fz_invalid_quad
extern

◆ fz_invalid_rect

FZ_DATA const fz_rect fz_invalid_rect
extern

An invalid rectangle.

◆ fz_unit_rect

FZ_DATA const fz_rect fz_unit_rect
extern

A rectangle with sides of length one.

The bottom left corner is at (0, 0) and the top right corner is at (1, 1).