24 static void unit_m4(
float m[4][4]);
105 if (y < rect->ymin) {
108 if (
y > rect->
ymax) {
116 if (x < rect->xmin) {
119 if (
x > rect->
xmax) {
122 if (y < rect->ymin) {
125 if (
y > rect->
ymax) {
150 if (x < rect->xmin) {
151 return rect->
xmin -
x;
153 if (
x > rect->
xmax) {
154 return x - rect->
xmax;
161 if (y < rect->ymin) {
162 return rect->
ymin -
y;
164 if (
y > rect->
ymax) {
165 return y - rect->
ymax;
172 if (x < rect->xmin) {
173 return rect->
xmin -
x;
175 if (
x > rect->
xmax) {
176 return x - rect->
xmax;
183 if (y < rect->ymin) {
184 return rect->
ymin -
y;
186 if (
y > rect->
ymax) {
187 return y - rect->
ymax;
207 const double div = (
double)((
v2[0] -
v1[0]) * (v4[1] - v3[1]) -
208 (
v2[1] -
v1[1]) * (v4[0] - v3[0]));
213 const double lambda = (
double)((
v1[1] - v3[1]) * (v4[0] - v3[0]) -
214 (
v1[0] - v3[0]) * (v4[1] - v3[1])) /
216 const double mu = (
double)((
v1[1] - v3[1]) * (
v2[0] -
v1[0]) -
217 (
v1[0] - v3[0]) * (
v2[1] -
v1[1])) /
219 return (lambda >= 0.0 && lambda <= 1.0 && mu >= 0.0 && mu <= 1.0);
226 const double div = (
double)((
v2[0] -
v1[0]) * (v4[1] - v3[1]) -
227 (
v2[1] -
v1[1]) * (v4[0] - v3[0]));
232 const double lambda = (
double)((
v1[1] - v3[1]) * (v4[0] - v3[0]) -
233 (
v1[0] - v3[0]) * (v4[1] - v3[1])) /
235 const double mu = (
double)((
v1[1] - v3[1]) * (
v2[0] -
v1[0]) -
236 (
v1[0] - v3[0]) * (
v2[1] -
v1[1])) /
238 return (lambda >= 0.0 && lambda <= 1.0 && mu >= 0.0 && mu <= 1.0);
244 if (s1[0] < rect->
xmin && s2[0] < rect->
xmin) {
247 if (s1[0] > rect->
xmax && s2[0] > rect->
xmax) {
250 if (s1[1] < rect->
ymin && s2[1] < rect->
ymin) {
253 if (s1[1] > rect->
ymax && s2[1] > rect->
ymax) {
266 tvec1[0] = rect->
xmin;
267 tvec1[1] = rect->
ymin;
268 tvec2[0] = rect->
xmax;
269 tvec2[1] = rect->
ymax;
275 tvec1[0] = rect->
xmin;
276 tvec1[1] = rect->
ymax;
277 tvec2[0] = rect->
xmax;
278 tvec2[1] = rect->
ymin;
290 if (s1[0] < rect->
xmin && s2[0] < rect->
xmin) {
293 if (s1[0] > rect->
xmax && s2[0] > rect->
xmax) {
296 if (s1[1] < rect->
ymin && s2[1] < rect->
ymin) {
299 if (s1[1] > rect->
ymax && s2[1] > rect->
ymax) {
312 tvec1[0] = rect->
xmin;
313 tvec1[1] = rect->
ymin;
314 tvec2[0] = rect->
xmax;
315 tvec2[1] = rect->
ymax;
321 tvec1[0] = rect->
xmin;
322 tvec1[1] = rect->
ymax;
323 tvec2[0] = rect->
xmax;
324 tvec2[1] = rect->
ymin;
351 return dx * dx + dy * dy <= radius * radius;
372 return dx * dx + dy * dy <= radius * radius;
532 const float xy_src[2])
534 xy_dst[0] = ((xy_src[0] -
src->xmin) / (
src->xmax -
src->xmin));
535 xy_dst[0] = dst->
xmin + ((dst->
xmax - dst->
xmin) * xy_dst[0]);
537 xy_dst[1] = ((xy_src[1] -
src->ymin) / (
src->ymax -
src->ymin));
538 xy_dst[1] = dst->
ymin + ((dst->
ymax - dst->
ymin) * xy_dst[1]);
550 matrix[3][
x] = (
src->xmin - dst->
xmin) * matrix[
x][
x];
551 matrix[3][
y] = (
src->ymin - dst->
ymin) * matrix[
y][
y];
649 rect->
xmin = cent_x - size_x_half;
650 rect->
ymin = cent_y - size_y_half;
651 rect->
xmax = cent_x + size_x_half;
652 rect->
ymax = cent_y + size_y_half;
661 rect->
xmin = cent_x - size_x_half;
662 rect->
ymin = cent_y - size_y_half;
663 rect->
xmax = cent_x + size_x_half;
664 rect->
ymax = cent_y + size_y_half;
668 const float boundary_size,
676 float total_pad = pad_max + pad_min;
677 if (total_pad == 0.0f) {
681 float total_extend =
BLI_rctf_size_y(rect) * total_pad / (boundary_size - total_pad);
682 rect->
ymax += total_extend * (pad_max / total_pad);
683 rect->
ymin -= total_extend * (pad_min / total_pad);
688 const float ifac = 1.0f - fac;
689 rect->
xmin = (rect_a->
xmin * ifac) + (rect_b->
xmin * fac);
690 rect->
xmax = (rect_a->
xmax * ifac) + (rect_b->
xmax * fac);
691 rect->
ymin = (rect_a->
ymin * ifac) + (rect_b->
ymin * fac);
692 rect->
ymax = (rect_a->
ymax * ifac) + (rect_b->
ymax * fac);
699 bool changed =
false;
721 bool changed =
false;
743 bool changed =
false;
748 if (rect->
xmax > rect_bounds->
xmax) {
749 float ofs = rect_bounds->
xmax - rect->
xmax;
756 if (rect->
xmin < rect_bounds->
xmin) {
757 float ofs = rect_bounds->
xmin - rect->
xmin;
764 if (rect->
ymin < rect_bounds->
ymin) {
765 float ofs = rect_bounds->
ymin - rect->
ymin;
772 if (rect->
ymax > rect_bounds->
ymax) {
773 float ofs = rect_bounds->
ymax - rect->
ymax;
785 bool changed =
false;
790 if (rect->
xmax > rect_bounds->
xmax) {
791 int ofs = rect_bounds->
xmax - rect->
xmax;
798 if (rect->
xmin < rect_bounds->
xmin) {
799 int ofs = rect_bounds->
xmin - rect->
xmin;
806 if (rect->
ymin < rect_bounds->
ymin) {
807 int ofs = rect_bounds->
ymin - rect->
ymin;
814 if (rect->
ymax > rect_bounds->
ymax) {
815 int ofs = rect_bounds->
ymax - rect->
ymax;
865 if (xmax >= xmin && ymax >= ymin) {
894 if (xmax >= xmin && ymax >= ymin) {
915 const float xmin = (src1->
xmin) > (src2->
xmin) ? (src1->
xmin) : (src2->
xmin);
916 const float xmax = (src1->
xmax) < (src2->
xmax) ? (src1->
xmax) : (src2->
xmax);
935 const float ymin = (src1->
ymin) > (src2->
ymin) ? (src1->
ymin) : (src2->
ymin);
936 const float ymax = (src1->
ymax) < (src2->
ymax) ? (src1->
ymax) : (src2->
ymax);
1027 printf(
"%s: xmin %.8f, xmax %.8f, ymin %.8f, ymax %.8f (%.12fx%.12f)\n",
1039 printf(
"%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n",
1055 #define ROTATE_SINCOS(r_vec, mat2, vec) \
1057 (r_vec)[0] = (mat2)[1] * (vec)[0] + (+(mat2)[0]) * (vec)[1]; \
1058 (r_vec)[1] = (mat2)[0] * (vec)[0] + (-(mat2)[1]) * (vec)[1]; \
1066 float corner[2], corner_rot[2], corder_max[2];
1072 corder_max[0] =
fabsf(corner_rot[0]);
1073 corder_max[1] =
fabsf(corner_rot[1]);
1077 corder_max[0] =
MAX2(corder_max[0],
fabsf(corner_rot[0]));
1078 corder_max[1] =
MAX2(corder_max[1],
fabsf(corner_rot[1]));
1080 dst->
xmin = cent[0] - corder_max[0];
1081 dst->
xmax = cent[0] + corder_max[0];
1082 dst->
ymin = cent[1] - corder_max[1];
1083 dst->
ymax = cent[1] + corder_max[1];
1086 #undef ROTATE_SINCOS
1092 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0f;
1093 m[0][1] = m[0][2] = m[0][3] = 0.0f;
1094 m[1][0] = m[1][2] = m[1][3] = 0.0f;
1095 m[2][0] = m[2][1] = m[2][3] = 0.0f;
1096 m[3][0] = m[3][1] = m[3][2] = 0.0f;
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
typedef double(DMatrix)[4][4]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
ATTR_WARN_UNUSED_RESULT const BMVert * v2
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
SyclQueue void void * src
#define ROTATE_SINCOS(r_vec, mat2, vec)
bool BLI_rcti_compare(const rcti *rect_a, const rcti *rect_b)
void BLI_rctf_init(rctf *rect, float xmin, float xmax, float ymin, float ymax)
bool BLI_rcti_isect_circle(const rcti *rect, const float xy[2], const float radius)
void BLI_rctf_rcti_copy(rctf *dst, const rcti *src)
void BLI_rcti_init(rcti *rect, int xmin, int xmax, int ymin, int ymax)
void BLI_rctf_init_pt_radius(rctf *rect, const float xy[2], float size)
void BLI_rcti_rctf_copy(rcti *dst, const rctf *src)
bool BLI_rctf_isect_x(const rctf *rect, const float x)
bool BLI_rcti_isect_y(const rcti *rect, const int y)
bool BLI_rctf_isect_y(const rctf *rect, const float y)
bool BLI_rcti_is_empty(const rcti *rect)
bool BLI_rctf_is_valid(const rctf *rect)
bool BLI_rcti_is_valid(const rcti *rect)
void BLI_rctf_resize(rctf *rect, float x, float y)
void BLI_rcti_do_minmax_v(rcti *rect, const int xy[2])
bool BLI_rcti_isect_rect_y(const rcti *src1, const rcti *src2, int range_y[2])
bool BLI_rctf_is_empty(const rctf *rect)
void print_rctf(const char *str, const rctf *rect)
void BLI_rctf_interp(rctf *rect, const rctf *rect_a, const rctf *rect_b, const float fac)
void BLI_rctf_transform_pt_v(const rctf *dst, const rctf *src, float xy_dst[2], const float xy_src[2])
void BLI_rcti_recenter(rcti *rect, int x, int y)
float BLI_rctf_length_y(const rctf *rect, const float y)
void BLI_rcti_init_minmax(rcti *rect)
void BLI_rcti_init_pt_radius(rcti *rect, const int xy[2], int size)
void BLI_rcti_do_minmax_rcti(rcti *rect, const rcti *other)
bool BLI_rctf_compare(const rctf *rect_a, const rctf *rect_b, const float limit)
void BLI_rctf_rotate_expand(rctf *dst, const rctf *src, const float angle)
bool BLI_rctf_clamp_pt_v(const rctf *rect, float xy[2])
bool BLI_rctf_isect_rect_x(const rctf *src1, const rctf *src2, float range_x[2])
bool BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest)
static void unit_m4(float m[4][4])
void BLI_rcti_rctf_copy_floor(rcti *dst, const rctf *src)
int BLI_rcti_length_x(const rcti *rect, const int x)
bool BLI_rctf_isect_rect_y(const rctf *src1, const rctf *src2, float range_y[2])
void BLI_rcti_union(rcti *rct_a, const rcti *rct_b)
bool BLI_rcti_clamp(rcti *rect, const rcti *rect_bounds, int r_xy[2])
void BLI_rcti_resize_x(rcti *rect, int x)
void BLI_rctf_transform_calc_m4_pivot_min(const rctf *dst, const rctf *src, float matrix[4][4])
void BLI_rctf_init_minmax(rctf *rect)
int BLI_rcti_length_y(const rcti *rect, const int y)
bool BLI_rcti_isect_x(const rcti *rect, const int x)
void BLI_rctf_transform_calc_m4_pivot_min_ex(const rctf *dst, const rctf *src, float matrix[4][4], uint x, uint y)
void BLI_rctf_union(rctf *rct_a, const rctf *rct_b)
void BLI_rcti_scale(rcti *rect, const float scale)
static int isect_segments_i(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
void BLI_rctf_pad(rctf *rect, float pad_x, float pad_y)
void BLI_rctf_do_minmax_v(rctf *rect, const float xy[2])
bool BLI_rctf_isect_segment(const rctf *rect, const float s1[2], const float s2[2])
bool BLI_rcti_isect_rect_x(const rcti *src1, const rcti *src2, int range_x[2])
void BLI_rctf_pad_y(rctf *rect, const float boundary_size, const float pad_min, const float pad_max)
void BLI_rctf_recenter(rctf *rect, float x, float y)
void BLI_rcti_resize_y(rcti *rect, int y)
void BLI_rctf_translate(rctf *rect, float x, float y)
float BLI_rctf_length_x(const rctf *rect, const float x)
bool BLI_rcti_clamp_pt_v(const rcti *rect, int xy[2])
void BLI_rctf_resize_x(rctf *rect, float x)
bool BLI_rctf_clamp(rctf *rect, const rctf *rect_bounds, float r_xy[2])
bool BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2])
void BLI_rctf_scale(rctf *rect, const float scale)
void BLI_rctf_sanitize(rctf *rect)
bool BLI_rcti_isect_pt_v(const rcti *rect, const int xy[2])
void BLI_rcti_pad(rcti *rect, int pad_x, int pad_y)
void BLI_rcti_rctf_copy_round(rcti *dst, const rctf *src)
bool BLI_rcti_isect_pt(const rcti *rect, const int x, const int y)
bool BLI_rctf_inside_rctf(const rctf *rct_a, const rctf *rct_b)
void print_rcti(const char *str, const rcti *rect)
void BLI_rctf_resize_y(rctf *rect, float y)
static int isect_segments_fl(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
bool BLI_rcti_inside_rcti(const rcti *rct_a, const rcti *rct_b)
bool BLI_rctf_isect_circle(const rctf *rect, const float xy[2], const float radius)
void BLI_rcti_resize(rcti *rect, int x, int y)
bool BLI_rctf_isect_pt(const rctf *rect, const float x, const float y)
void BLI_rcti_translate(rcti *rect, int x, int y)
bool BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2])
bool BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest)
void BLI_rcti_sanitize(rcti *rect)