39 static void unit_m4(
float m[4][4]);
99 if (xy[0] < rect->
xmin) {
102 if (xy[0] > rect->
xmax) {
105 if (xy[1] < rect->
ymin) {
108 if (xy[1] > rect->
ymax) {
116 if (x < rect->xmin) {
119 if (
x > rect->
xmax) {
127 if (y < rect->ymin) {
130 if (
y > rect->
ymax) {
138 if (x < rect->xmin) {
141 if (
x > rect->
xmax) {
144 if (y < rect->ymin) {
147 if (
y > rect->
ymax) {
155 if (xy[0] < rect->
xmin) {
158 if (xy[0] > rect->
xmax) {
161 if (xy[1] < rect->
ymin) {
164 if (xy[1] > rect->
ymax) {
176 if (x < rect->xmin) {
177 return rect->
xmin -
x;
179 if (
x > rect->
xmax) {
180 return x - rect->
xmax;
187 if (y < rect->ymin) {
188 return rect->
ymin -
y;
190 if (
y > rect->
ymax) {
191 return y - rect->
ymax;
198 if (x < rect->xmin) {
199 return rect->
xmin -
x;
201 if (
x > rect->
xmax) {
202 return x - rect->
xmax;
209 if (y < rect->ymin) {
210 return rect->
ymin -
y;
212 if (
y > rect->
ymax) {
213 return y - rect->
ymax;
236 const double div = (
double)((
v2[0] -
v1[0]) * (v4[1] - v3[1]) -
237 (
v2[1] -
v1[1]) * (v4[0] - v3[0]));
242 const double lambda = (
double)((
v1[1] - v3[1]) * (v4[0] - v3[0]) -
243 (
v1[0] - v3[0]) * (v4[1] - v3[1])) /
245 const double mu = (
double)((
v1[1] - v3[1]) * (
v2[0] -
v1[0]) -
246 (
v1[0] - v3[0]) * (
v2[1] -
v1[1])) /
248 return (lambda >= 0.0 && lambda <= 1.0 && mu >= 0.0 && mu <= 1.0);
255 const double div = (
double)((
v2[0] -
v1[0]) * (v4[1] - v3[1]) -
256 (
v2[1] -
v1[1]) * (v4[0] - v3[0]));
261 const double lambda = (
double)((
v1[1] - v3[1]) * (v4[0] - v3[0]) -
262 (
v1[0] - v3[0]) * (v4[1] - v3[1])) /
264 const double mu = (
double)((
v1[1] - v3[1]) * (
v2[0] -
v1[0]) -
265 (
v1[0] - v3[0]) * (
v2[1] -
v1[1])) /
267 return (lambda >= 0.0 && lambda <= 1.0 && mu >= 0.0 && mu <= 1.0);
273 if (s1[0] < rect->
xmin && s2[0] < rect->
xmin) {
276 if (s1[0] > rect->
xmax && s2[0] > rect->
xmax) {
279 if (s1[1] < rect->
ymin && s2[1] < rect->
ymin) {
282 if (s1[1] > rect->
ymax && s2[1] > rect->
ymax) {
295 tvec1[0] = rect->
xmin;
296 tvec1[1] = rect->
ymin;
297 tvec2[0] = rect->
xmax;
298 tvec2[1] = rect->
ymax;
304 tvec1[0] = rect->
xmin;
305 tvec1[1] = rect->
ymax;
306 tvec2[0] = rect->
xmax;
307 tvec2[1] = rect->
ymin;
319 if (s1[0] < rect->
xmin && s2[0] < rect->
xmin) {
322 if (s1[0] > rect->
xmax && s2[0] > rect->
xmax) {
325 if (s1[1] < rect->
ymin && s2[1] < rect->
ymin) {
328 if (s1[1] > rect->
ymax && s2[1] > rect->
ymax) {
341 tvec1[0] = rect->
xmin;
342 tvec1[1] = rect->
ymin;
343 tvec2[0] = rect->
xmax;
344 tvec2[1] = rect->
ymax;
350 tvec1[0] = rect->
xmin;
351 tvec1[1] = rect->
ymax;
352 tvec2[0] = rect->
xmax;
353 tvec2[1] = rect->
ymin;
366 if (xy[0] >= rect->
xmin && xy[0] <= rect->
xmax) {
370 dx = (xy[0] < rect->
xmin) ? (rect->
xmin - xy[0]) : (xy[0] - rect->
xmax);
373 if (xy[1] >= rect->
ymin && xy[1] <= rect->
ymax) {
377 dy = (xy[1] < rect->
ymin) ? (rect->
ymin - xy[1]) : (xy[1] - rect->
ymax);
380 return dx * dx + dy * dy <= radius * radius;
387 if (xy[0] >= rect->
xmin && xy[0] <= rect->
xmax) {
391 dx = (xy[0] < rect->
xmin) ? (rect->
xmin - xy[0]) : (xy[0] - rect->
xmax);
394 if (xy[1] >= rect->
ymin && xy[1] <= rect->
ymax) {
398 dy = (xy[1] < rect->
ymin) ? (rect->
ymin - xy[1]) : (xy[1] - rect->
ymax);
401 return dx * dx + dy * dy <= radius * radius;
530 if (xy[0] < rect->
xmin) {
533 if (xy[0] > rect->
xmax) {
536 if (xy[1] < rect->
ymin) {
539 if (xy[1] > rect->
ymax) {
546 if (xy[0] < rect->
xmin) {
549 if (xy[0] > rect->
xmax) {
552 if (xy[1] < rect->
ymin) {
555 if (xy[1] > rect->
ymax) {
564 const float xy_src[2])
566 xy_dst[0] = ((xy_src[0] - src->
xmin) / (src->
xmax - src->
xmin));
567 xy_dst[0] = dst->
xmin + ((dst->
xmax - dst->
xmin) * xy_dst[0]);
569 xy_dst[1] = ((xy_src[1] - src->
ymin) / (src->
ymax - src->
ymin));
570 xy_dst[1] = dst->
ymin + ((dst->
ymax - dst->
ymin) * xy_dst[1]);
588 matrix[3][
x] = (src->
xmin - dst->
xmin) * matrix[
x][
x];
589 matrix[3][
y] = (src->
ymin - dst->
ymin) * matrix[
y][
y];
688 rect->
xmin = cent_x - size_x_half;
689 rect->
ymin = cent_y - size_y_half;
690 rect->
xmax = cent_x + size_x_half;
691 rect->
ymax = cent_y + size_y_half;
700 rect->
xmin = cent_x - size_x_half;
701 rect->
ymin = cent_y - size_y_half;
702 rect->
xmax = cent_x + size_x_half;
703 rect->
ymax = cent_y + size_y_half;
707 const float boundary_size,
715 float total_pad = pad_max + pad_min;
716 if (total_pad == 0.0f) {
720 float total_extend =
BLI_rctf_size_y(rect) * total_pad / (boundary_size - total_pad);
721 rect->
ymax += total_extend * (pad_max / total_pad);
722 rect->
ymin -= total_extend * (pad_min / total_pad);
727 const float ifac = 1.0f - fac;
728 rect->
xmin = (rect_a->
xmin * ifac) + (rect_b->
xmin * fac);
729 rect->
xmax = (rect_a->
xmax * ifac) + (rect_b->
xmax * fac);
730 rect->
ymin = (rect_a->
ymin * ifac) + (rect_b->
ymin * fac);
731 rect->
ymax = (rect_a->
ymax * ifac) + (rect_b->
ymax * fac);
738 bool changed =
false;
739 if (xy[0] < rect->
xmin) {
743 if (xy[0] > rect->
xmax) {
747 if (xy[1] < rect->
ymin) {
751 if (xy[1] > rect->
ymax) {
760 bool changed =
false;
761 if (xy[0] < rect->
xmin) {
765 if (xy[0] > rect->
xmax) {
769 if (xy[1] < rect->
ymin) {
773 if (xy[1] > rect->
ymax) {
790 bool changed =
false;
795 if (rect->
xmax > rect_bounds->
xmax) {
796 float ofs = rect_bounds->
xmax - rect->
xmax;
803 if (rect->
xmin < rect_bounds->
xmin) {
804 float ofs = rect_bounds->
xmin - rect->
xmin;
811 if (rect->
ymin < rect_bounds->
ymin) {
812 float ofs = rect_bounds->
ymin - rect->
ymin;
819 if (rect->
ymax > rect_bounds->
ymax) {
820 float ofs = rect_bounds->
ymax - rect->
ymax;
832 bool changed =
false;
837 if (rect->
xmax > rect_bounds->
xmax) {
838 int ofs = rect_bounds->
xmax - rect->
xmax;
845 if (rect->
xmin < rect_bounds->
xmin) {
846 int ofs = rect_bounds->
xmin - rect->
xmin;
853 if (rect->
ymin < rect_bounds->
ymin) {
854 int ofs = rect_bounds->
ymin - rect->
ymin;
861 if (rect->
ymax > rect_bounds->
ymax) {
862 int ofs = rect_bounds->
ymax - rect->
ymax;
912 if (xmax >= xmin && ymax >= ymin) {
941 if (xmax >= xmin && ymax >= ymin) {
962 const float xmin = (src1->
xmin) > (src2->
xmin) ? (src1->
xmin) : (src2->
xmin);
963 const float xmax = (src1->
xmax) < (src2->
xmax) ? (src1->
xmax) : (src2->
xmax);
982 const float ymin = (src1->
ymin) > (src2->
ymin) ? (src1->
ymin) : (src2->
ymin);
983 const float ymax = (src1->
ymax) < (src2->
ymax) ? (src1->
ymax) : (src2->
ymax);
1002 const int xmin = (src1->
xmin) > (src2->
xmin) ? (src1->
xmin) : (src2->
xmin);
1003 const int xmax = (src1->
xmax) < (src2->
xmax) ? (src1->
xmax) : (src2->
xmax);
1022 const int ymin = (src1->
ymin) > (src2->
ymin) ? (src1->
ymin) : (src2->
ymin);
1023 const int ymax = (src1->
ymax) < (src2->
ymax) ? (src1->
ymax) : (src2->
ymax);
1074 printf(
"%s: xmin %.8f, xmax %.8f, ymin %.8f, ymax %.8f (%.12fx%.12f)\n",
1086 printf(
"%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n",
1102 #define ROTATE_SINCOS(r_vec, mat2, vec) \
1104 (r_vec)[0] = (mat2)[1] * (vec)[0] + (+(mat2)[0]) * (vec)[1]; \
1105 (r_vec)[1] = (mat2)[0] * (vec)[0] + (-(mat2)[1]) * (vec)[1]; \
1116 float corner[2], corner_rot[2], corder_max[2];
1122 corder_max[0] =
fabsf(corner_rot[0]);
1123 corder_max[1] =
fabsf(corner_rot[1]);
1127 corder_max[0] =
MAX2(corder_max[0],
fabsf(corner_rot[0]));
1128 corder_max[1] =
MAX2(corder_max[1],
fabsf(corner_rot[1]));
1130 dst->
xmin = cent[0] - corder_max[0];
1131 dst->
xmax = cent[0] + corder_max[0];
1132 dst->
ymin = cent[1] - corder_max[1];
1133 dst->
ymax = cent[1] + corder_max[1];
1136 #undef ROTATE_SINCOS
1142 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0f;
1143 m[0][1] = m[0][2] = m[0][3] = 0.0f;
1144 m[1][0] = m[1][2] = m[1][3] = 0.0f;
1145 m[2][0] = m[2][1] = m[2][3] = 0.0f;
1146 m[3][0] = m[3][1] = m[3][2] = 0.0f;
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.
#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)
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_rctf_union(rctf *rct1, const rctf *rct2)
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_rcti_union(rcti *rct1, const rcti *rct2)
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)