[Bf-blender-cvs] [47d4ce498e3] master: Cleanup: minor changes to camera frame fitting
Campbell Barton
noreply at git.blender.org
Thu Jul 14 14:10:13 CEST 2022
Commit: 47d4ce498e3f5a11a0210b1efd57053f0b1c85bd
Author: Campbell Barton
Date: Thu Jul 14 22:05:31 2022 +1000
Branches: master
https://developer.blender.org/rB47d4ce498e3f5a11a0210b1efd57053f0b1c85bd
Cleanup: minor changes to camera frame fitting
Use const vars & make order of min/max checks consistent.
===================================================================
M source/blender/blenkernel/intern/camera.c
===================================================================
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 48a48d6e2b4..7cfac0cb75a 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -704,7 +704,7 @@ static bool camera_frame_fit_calc_from_data(CameraParams *params,
}
if ((!isect_plane_plane_v3(
- plane_tx[Y_MAX], plane_tx[Y_MIN], plane_isect_1, plane_isect_1_no)) ||
+ plane_tx[Y_MIN], plane_tx[Y_MAX], plane_isect_1, plane_isect_1_no)) ||
(!isect_plane_plane_v3(
plane_tx[Z_MIN], plane_tx[Z_MAX], plane_isect_2, plane_isect_2_no))) {
return false;
@@ -713,28 +713,27 @@ static bool camera_frame_fit_calc_from_data(CameraParams *params,
add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
- if (isect_line_line_v3(plane_isect_1,
- plane_isect_1_other,
- plane_isect_2,
- plane_isect_2_other,
- plane_isect_pt_1,
- plane_isect_pt_2) == 0) {
+ if (!isect_line_line_v3(plane_isect_1,
+ plane_isect_1_other,
+ plane_isect_2,
+ plane_isect_2_other,
+ plane_isect_pt_1,
+ plane_isect_pt_2)) {
return false;
}
float cam_plane_no[3];
float plane_isect_delta[3];
- float plane_isect_delta_len;
- float shift_fac = BKE_camera_sensor_size(
- params->sensor_fit, params->sensor_x, params->sensor_y) /
- params->lens;
+ const float shift_fac = BKE_camera_sensor_size(
+ params->sensor_fit, params->sensor_x, params->sensor_y) /
+ params->lens;
/* we want (0, 0, -1) transformed by camera_rotmat, this is a quicker shortcut. */
negate_v3_v3(cam_plane_no, data->camera_rotmat[2]);
sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
- plane_isect_delta_len = len_v3(plane_isect_delta);
+ const float plane_isect_delta_len = len_v3(plane_isect_delta);
if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
copy_v3_v3(r_co, plane_isect_pt_1);
More information about the Bf-blender-cvs
mailing list