Blender
V3.3
|
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <limits.h>
#include "BLI_math_base.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "DNA_vec_types.h"
Go to the source code of this file.
Rect math functions | |
#define | ROTATE_SINCOS(r_vec, mat2, vec) |
void | BLI_rctf_rotate_expand (rctf *dst, const rctf *src, const float angle) |
A minimalist lib for functions doing stuff with rectangle structs.
Definition in file rct.c.
#define ROTATE_SINCOS | ( | r_vec, | |
mat2, | |||
vec | |||
) |
Definition at line 741 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 697 of file rct.c.
References rctf::xmax, rctf::xmin, xy, rctf::ymax, and rctf::ymin.
Definition at line 825 of file rct.c.
References fabsf, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 513 of file rct.c.
References rctf::xmax, rctf::xmin, xy, rctf::ymax, and rctf::ymin.
Referenced by BKE_maskrasterize_handle_init().
Definition at line 407 of file rct.c.
References BLI_rctf_sanitize(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BKE_curvemapping_set_defaults(), BKE_curveprofile_set_defaults(), clear_render_border_exec(), blender::ed::space_node::cursor_isect_multi_input_socket(), displayed_channel_range_get(), draw_channel_names(), draw_display_buffer(), draw_movieclip_buffer(), draw_nla_channel_list(), drawscredge_area_draw(), ED_region_image_metadata_draw(), gpencil_zoom_level_set(), graph_draw_channel_names(), image_main_region_draw(), label_rect_init(), layer_bucket_init_dummy(), outliner_draw_active_indicator(), outliner_draw_iconrow_number(), round_box__edges(), sequencer_create(), sequencer_draw_display_buffer(), sequencer_image_crop_init(), sequencer_main_clamp_view(), sequencer_preview_get_rect(), ui_popup_translate(), UI_view2d_edge_pan_init(), UI_view2d_edge_pan_set_limits(), blender::draw::image_engine::OneTextureMethod::update_screen_space_bounds(), blender::draw::image_engine::OneTextureMethod::update_screen_uv_bounds(), and widget_draw_submenu_tria().
Definition at line 483 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BKE_maskrasterize_handle_init(), blender::ed::space_node::node_draw_nodetree(), blender::ed::space_node::space_node_view_flag(), ui_block_bounds_calc(), ui_popup_block_position(), and blender::draw::image_engine::OneTextureMethod::update_screen_space_bounds().
Definition at line 461 of file rct.c.
References size(), rctf::xmax, rctf::xmin, xy, rctf::ymax, and rctf::ymin.
Referenced by ED_imbuf_sample_draw(), blender::ed::space_node::node_find_indicated_socket(), and blender::ed::space_node::socket_is_occluded().
is rct_b inside rct_a
Definition at line 192 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by blender::ed::space_node::do_lasso_select_node(), blender::ed::space_node::node_box_select_exec(), blender::ed::space_node::socket_is_occluded(), and ui_view2d_cur_ensure_rect_in_view().
Definition at line 686 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 31 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 427 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BLI_rctf_sanitize().
Definition at line 855 of file rct.c.
References dest, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 354 of file rct.c.
References rctf::xmax, rctf::xmin, xy, rctf::ymax, and rctf::ymin.
Definition at line 114 of file rct.c.
References x, rctf::xmax, y, and rctf::ymax.
Definition at line 131 of file rct.c.
References rctf::xmax, rctf::xmin, xy, rctf::ymax, and rctf::ymin.
Referenced by BLI_rctf_isect_segment().
Definition at line 913 of file rct.c.
References rctf::xmax, and rctf::xmin.
Definition at line 933 of file rct.c.
References rctf::ymax, and rctf::ymin.
Definition at line 287 of file rct.c.
References BLI_rctf_isect_pt_v(), isect_segments_fl(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 92 of file rct.c.
References x, and rctf::xmax.
Referenced by ed_marker_box_select_exec(), ED_region_overlap_isect_x(), and blender::ed::space_node::node_link_insert_offset_ntree().
Definition at line 103 of file rct.c.
References y, and rctf::ymax.
Referenced by ED_region_overlap_isect_y(), and blender::ed::space_node::node_link_insert_offset_ntree().
Definition at line 170 of file rct.c.
References x, rctf::xmax, and rctf::xmin.
Referenced by blender::ed::space_node::node_link_dim_factor().
Definition at line 181 of file rct.c.
References y, rctf::ymax, and rctf::ymin.
Referenced by blender::ed::space_node::node_link_dim_factor().
Definition at line 615 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by ED_uvedit_pack_islands_multi(), blender::ed::space_node::node_circleselect_exec(), blender::ed::space_node::node_frame_rect_inside(), seq_view_collection_rect_preview(), and UI_but_ensure_in_view().
void BLI_rctf_pad_y | ( | rctf * | rect, |
const float | boundary_size, | ||
const float | pad_min, | ||
const float | pad_max | ||
) |
Definition at line 667 of file rct.c.
References BLI_assert, BLI_rctf_size_y(), rctf::ymax, and rctf::ymin.
Referenced by graphkeys_viewall().
Definition at line 1017 of file rct.c.
References src, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 580 of file rct.c.
References BLI_rctf_cent_x(), BLI_rctf_cent_y(), BLI_rctf_translate(), x, and y.
Referenced by blender::ed::space_node::gizmo_node_crop_prop_matrix_set(), gizmo_render_border_prop_matrix_set(), ui_pie_handler(), ui_popup_block_refresh(), and UI_view2d_center_set().
Definition at line 635 of file rct.c.
References BLI_rctf_cent_x(), BLI_rctf_cent_y(), x, rctf::xmax, rctf::xmin, y, rctf::ymax, and rctf::ymin.
Referenced by blender::ed::space_node::gizmo_node_crop_prop_matrix_set(), gizmo_render_border_prop_matrix_set(), sequencer_view_zoom_ratio_exec(), and blender::ed::space_node::space_node_view_flag().
Definition at line 623 of file rct.c.
References BLI_rctf_cent_x(), x, rctf::xmax, and rctf::xmin.
Definition at line 629 of file rct.c.
References BLI_rctf_cent_y(), y, rctf::ymax, and rctf::ymin.
Expand the rectangle to fit a rotated src.
Definition at line 1062 of file rct.c.
References angle(), BLI_rctf_cent_x(), BLI_rctf_cent_y(), cosf, fabsf, MAX2, ROTATE_SINCOS, sinf, src, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Ensure X-min and Y-min are less than or equal to X-max and Y-max, respectively.
Definition at line 437 of file rct.c.
References BLI_assert, BLI_rctf_is_valid(), SWAP, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BLI_rctf_init().
Definition at line 655 of file rct.c.
References BLI_rctf_cent_x(), BLI_rctf_cent_y(), BLI_rctf_size_x(), BLI_rctf_size_y(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by graphkeys_viewall(), image_view_selected_exec(), seq_view_collection_rect_preview(), blender::ed::space_node::space_node_view_flag(), and widget_draw_submenu_tria().
void BLI_rctf_transform_calc_m4_pivot_min | ( | const rctf * | dst, |
const rctf * | src, | ||
float | matrix[4][4] | ||
) |
Definition at line 554 of file rct.c.
References BLI_rctf_transform_calc_m4_pivot_min_ex(), and src.
Referenced by drw_manager_init(), DRW_text_cache_draw(), and UI_view2d_view_to_region_m4().
void BLI_rctf_transform_calc_m4_pivot_min_ex | ( | const rctf * | dst, |
const rctf * | src, | ||
float | matrix[4][4], | ||
uint | x, | ||
uint | y | ||
) |
Calculate a 4x4 matrix representing the transformation between two rectangles.
Definition at line 541 of file rct.c.
References BLI_assert, BLI_rctf_size_x(), BLI_rctf_size_y(), src, unit_m4(), x, rctf::xmin, y, and rctf::ymin.
Referenced by BLI_rctf_transform_calc_m4_pivot_min().
void BLI_rctf_transform_pt_v | ( | const rctf * | dst, |
const rctf * | src, | ||
float | xy_dst[2], | ||
const float | xy_src[2] | ||
) |
Given 2 rectangles, transform a point from one to another.
Definition at line 529 of file rct.c.
References src, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by flushTransNodes(), keyframe_region_circle_test(), keyframe_region_lasso_test(), ui_do_but_CURVE(), ui_do_but_CURVEPROFILE(), view2d_edge_pan_loc_compensate(), and view_zoom_to_window_xy_camera().
Definition at line 566 of file rct.c.
References x, rctf::xmax, rctf::xmin, y, rctf::ymax, and rctf::ymin.
Referenced by BLI_rctf_recenter(), outliner_restore_scrolling_position(), UI_block_translate(), ui_popup_block_position(), ui_popup_translate(), ui_searchbox_create_generic_ex(), ui_update_flexible_spacing(), UI_view2d_view_ortho(), and view_zoom_to_window_xy_camera().
Definition at line 375 of file rct.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 783 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 719 of file rct.c.
References rcti::xmax, rcti::xmin, xy, rcti::ymax, and rcti::ymin.
Definition at line 840 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 505 of file rct.c.
References max_ii(), min_ii(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 489 of file rct.c.
References rcti::xmax, rcti::xmin, xy, rcti::ymax, and rcti::ymin.
Referenced by blender::compositor::calc_ray_shift(), ED_screen_draw_edges(), blender::bke::pbvh::pixels::UDIMTilePixels::mark_dirty(), paint_convert_bb_to_rect(), and blender::bke::pbvh::pixels::NodeData::rebuild_undo_regions().
Definition at line 417 of file rct.c.
References BLI_rcti_sanitize(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blender::compositor::BuffersIteratorBuilder< T >::add_input(), area_azone_init(), blender::bke::image::partial_update::BKE_image_partial_update_collect_changes(), BKE_image_update_gputexture_delayed(), blender::compositor::BufferArea< T >::BufferArea(), blender::compositor::ViewerOperation::clear_display_buffer(), blender::compositor::ConstantFolder::ConstantFolder(), blender::compositor::DenoisePrefilterOperation::create_memory_buffer(), blender::compositor::create_rect(), blender::compositor::tests::create_rect(), blender::compositor::BokehImageOperation::determine_canvas(), blender::compositor::CompositorOperation::determine_canvas(), blender::compositor::BaseImageOperation::determine_canvas(), blender::compositor::MovieClipBaseOperation::determine_canvas(), blender::compositor::PreviewOperation::determine_canvas(), blender::compositor::RenderLayersProg::determine_canvas(), blender::compositor::NodeOperation::determine_depending_area_of_interest(), blender::compositor::ProjectorLensDistortionOperation::determine_depending_area_of_interest(), blender::compositor::ReadBufferOperation::determine_depending_area_of_interest(), blender::compositor::ExecutionGroup::determine_resolution(), blender::ed::space_node::draw_nodespace_back_pix(), draw_seq_strip_thumbnail(), blender::ed::spreadsheet::draw_spreadsheet_in_region(), DRW_render_gpencil(), DRW_render_to_image(), ED_image_draw_info(), ED_imapaint_dirty_region(), eevee_engine_init(), blender::compositor::ExecutionSystem::execute_work(), blender::compositor::ExecutionGroup::ExecutionGroup(), file_tile_boundbox(), find_file_mouse_rect(), fullscreen_azone_init(), fullscreen_click_rcti_init(), blender::compositor::GlareFogGlowOperation::generate_glare(), graph_main_region_draw_overlay(), graph_region_draw(), hud_region_hide(), image_gpu_texture_partial_update_changes_available(), image_paint_partial_redraw_expand(), IMB_display_buffer_acquire(), IMB_float_from_rect(), IMB_partial_display_buffer_update_delayed(), blender::eevee::Film::init(), RE_engine_tile_highlight_set(), RE_GetViewPlane(), region_azone_edge(), region_azone_scrollbar_init(), region_azone_tab_plus(), region_draw_azones(), region_rect_recursive(), region_update_rect(), screen_global_statusbar_area_refresh(), screen_global_topbar_area_refresh(), blender::compositor::ExecutionGroup::set_render_border(), blender::compositor::ExecutionGroup::set_viewer_border(), blender::compositor::tests::BuffersIteratorTest::SetUpTestCase(), blender::compositor::step_update_memory_buffer(), blender::bke::image::partial_update::TEST_F(), blender::compositor::PreviewOperation::update_memory_buffer_partial(), blender::compositor::ViewerOperation::update_memory_buffer_partial(), and WM_window_rect_calc().
Definition at line 477 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blender::bke::pbvh::pixels::UDIMTilePixels::clear_dirty(), blender::compositor::ScreenLensDistortionOperation::determine_depending_area_of_interest(), ED_imapaint_clear_partial_redraw(), ED_screen_draw_edges(), blender::compositor::ScreenLensDistortionOperation::get_area_of_interest(), paint_convert_bb_to_rect(), partial_redraw_single_init(), blender::bke::pbvh::pixels::NodeData::rebuild_undo_regions(), and blender::bke::pbvh::pixels::UDIMTilePixels::UDIMTilePixels().
Definition at line 469 of file rct.c.
References size(), rcti::xmax, rcti::xmin, xy, rcti::ymax, and rcti::ymin.
Referenced by DRW_select_buffer_find_nearest_to_point(), ed_armature_pick_bone_impl(), ed_mball_findnearest_metaelem(), ED_region_contains_xy(), get_nearest_editbonepoint(), gizmo_find_intersected_3d_intern(), mixed_bones_object_selectbuffer(), view3d_opengl_select_ex(), and view_autodist_depth_margin().
Definition at line 197 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blender::compositor::BuffersIteratorBuilder< T >::add_input(), blf_glyph_draw(), blender::compositor::BuffersIteratorBuilder< T >::BuffersIteratorBuilder(), blender::compositor::SharedOperationBuffers::is_area_registered(), blender::bke::image::partial_update::TEST_F(), and ui_tooltip_create_with_data().
Definition at line 26 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 432 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by BLI_rcti_sanitize().
Definition at line 884 of file rct.c.
References dest, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 333 of file rct.c.
References rcti::xmax, rcti::xmin, xy, rcti::ymax, and rcti::ymin.
Definition at line 58 of file rct.c.
References x, rcti::xmax, y, and rcti::ymax.
Definition at line 75 of file rct.c.
References rcti::xmax, rcti::xmin, xy, rcti::ymax, and rcti::ymin.
Referenced by BLI_rcti_isect_segment().
Definition at line 953 of file rct.c.
References rcti::xmax, and rcti::xmin.
Definition at line 973 of file rct.c.
References rcti::ymax, and rcti::ymin.
Definition at line 241 of file rct.c.
References BLI_rcti_isect_pt_v(), isect_segments_i(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 36 of file rct.c.
References x, and rcti::xmax.
Definition at line 47 of file rct.c.
References y, and rcti::ymax.
int BLI_rcti_length_x | ( | const rcti * | rect, |
int | x | ||
) |
Definition at line 148 of file rct.c.
References x, rcti::xmax, and rcti::xmin.
Referenced by area_actionzone_refresh_xy(), and file_box_select_find_last_selected().
int BLI_rcti_length_y | ( | const rcti * | rect, |
int | y | ||
) |
Definition at line 159 of file rct.c.
References y, rcti::ymax, and rcti::ymin.
Referenced by area_actionzone_refresh_xy(), and file_box_select_find_last_selected().
Definition at line 607 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by file_draw_preview(), and UI_view2d_edge_pan_apply().
Definition at line 993 of file rct.c.
References BLI_rctf_size_x(), BLI_rctf_size_y(), floorf, src, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 1001 of file rct.c.
References floorf, src, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 1009 of file rct.c.
References floorf, src, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 574 of file rct.c.
References BLI_rcti_cent_x(), BLI_rcti_cent_y(), BLI_rcti_translate(), x, and y.
Definition at line 599 of file rct.c.
References BLI_rcti_cent_x(), BLI_rcti_cent_y(), x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Referenced by ED_node_socket_draw(), region_rect_recursive(), ui_tooltip_create_with_data(), and widget_optionbut().
Change width & height around the central X location.
Definition at line 587 of file rct.c.
References BLI_rcti_cent_x(), x, rcti::xmax, and rcti::xmin.
Referenced by view3d_zoom_border_exec(), and wm_window_check_size().
Change width & height around the central Y location.
Definition at line 593 of file rct.c.
References BLI_rcti_cent_y(), y, rcti::ymax, and rcti::ymin.
Referenced by view3d_zoom_border_exec(), and wm_window_check_size().
Definition at line 449 of file rct.c.
References BLI_assert, BLI_rcti_is_valid(), SWAP, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by BLI_rcti_init(), GPU_viewport_draw_to_screen_ex(), and region_rect_recursive().
Definition at line 643 of file rct.c.
References BLI_rcti_cent_x(), BLI_rcti_cent_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 559 of file rct.c.
References x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Referenced by blf_glyph_draw(), BLI_rcti_recenter(), blender::compositor::ProjectorLensDistortionOperation::determine_canvas(), blender::compositor::ScreenLensDistortionOperation::determine_canvas(), blender::compositor::TransformOperation::determine_canvas(), blender::compositor::TranslateCanvasOperation::determine_canvas(), draw_filled_lasso(), ED_view3d_calc_render_border(), file_draw_list(), blender::compositor::TransformOperation::get_area_of_interest(), blender::compositor::TranslateOperation::get_area_of_interest(), blender::compositor::SharedOperationBuffers::get_areas_to_render(), blender::compositor::RotateOperation::get_rotation_area_of_interest(), blender::compositor::RotateOperation::get_rotation_canvas(), handler_region_v2d_mask_test(), region_azone_scrollbar_init(), region_overlap_fix(), region_visible_rect_calc(), blender::compositor::ScaleOperation::scale_area(), ui_but_pixelrect_in_view(), ui_but_to_pixelrect(), ui_popup_translate(), ui_region_winrct_get_no_margin(), ui_searchbox_create_generic_ex(), ui_tooltip_create_with_data(), UI_view2d_rect_in_scrollers_ex(), widget_optionbut(), WM_gesture_box_modal(), WM_gesture_straightline_modal(), and WM_gesture_straightline_oneshot_modal().
Definition at line 391 of file rct.c.
References rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
|
static |
Definition at line 1025 of file rct.c.
References BLI_rctf_size_x(), BLI_rctf_size_y(), str, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Definition at line 1037 of file rct.c.
References BLI_rcti_size_x(), BLI_rcti_size_y(), str, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Definition at line 1090 of file rct.c.
Referenced by BLI_rctf_transform_calc_m4_pivot_min_ex().