Pass set_matrix_based_on_side arg by &
This commit is contained in:
parent
fc5b50c433
commit
ae6502f86b
|
@ -302,7 +302,7 @@ extern int med_form_bridge_segment(struct segment *seg1, int side1, struct segme
|
||||||
// they are properly updated.
|
// they are properly updated.
|
||||||
extern void med_compress_mine(void);
|
extern void med_compress_mine(void);
|
||||||
|
|
||||||
extern void set_matrix_based_on_side(vms_matrix *rotmat,int destside);
|
void update_matrix_based_on_side(vms_matrix &rotmat,int destside);
|
||||||
|
|
||||||
// Curves stuff.
|
// Curves stuff.
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ static void med_create_group_rotation_matrix(vms_matrix *result_mat, int delta_f
|
||||||
if (delta_flag) {
|
if (delta_flag) {
|
||||||
// Create rotation matrix describing rotation.
|
// Create rotation matrix describing rotation.
|
||||||
med_extract_matrix_from_segment(first_seg, &rotmat4); // get rotation matrix describing current orientation of first seg
|
med_extract_matrix_from_segment(first_seg, &rotmat4); // get rotation matrix describing current orientation of first seg
|
||||||
set_matrix_based_on_side(&rotmat4, first_side);
|
update_matrix_based_on_side(rotmat4, first_side);
|
||||||
rotmat3 = vm_transposed_matrix(*orient_matrix);
|
rotmat3 = vm_transposed_matrix(*orient_matrix);
|
||||||
const auto vm_desired_orientation = vm_matrix_x_matrix(rotmat4,rotmat3); // this is the desired orientation of the new segment
|
const auto vm_desired_orientation = vm_matrix_x_matrix(rotmat4,rotmat3); // this is the desired orientation of the new segment
|
||||||
vm_transpose_matrix(rotmat4);
|
vm_transpose_matrix(rotmat4);
|
||||||
|
@ -333,7 +333,7 @@ static void med_create_group_rotation_matrix(vms_matrix *result_mat, int delta_f
|
||||||
// Create rotation matrix describing rotation.
|
// Create rotation matrix describing rotation.
|
||||||
|
|
||||||
med_extract_matrix_from_segment(base_seg, &rotmat); // get rotation matrix describing desired orientation
|
med_extract_matrix_from_segment(base_seg, &rotmat); // get rotation matrix describing desired orientation
|
||||||
set_matrix_based_on_side(&rotmat, base_side); // modify rotation matrix for desired side
|
update_matrix_based_on_side(rotmat, base_side); // modify rotation matrix for desired side
|
||||||
|
|
||||||
// If the new segment is to be attached without rotation, then its orientation is the same as the base_segment
|
// If the new segment is to be attached without rotation, then its orientation is the same as the base_segment
|
||||||
vm_matrix_x_matrix(rotmat4,rotmat,*orient_matrix); // this is the desired orientation of the new segment
|
vm_matrix_x_matrix(rotmat4,rotmat,*orient_matrix); // this is the desired orientation of the new segment
|
||||||
|
@ -347,7 +347,7 @@ static void med_create_group_rotation_matrix(vms_matrix *result_mat, int delta_f
|
||||||
// Perhaps it is because segments are always attached at their front side. If the back side is the side
|
// Perhaps it is because segments are always attached at their front side. If the back side is the side
|
||||||
// passed to the function, then the matrix is not modified, which might suggest that what you need to do below
|
// passed to the function, then the matrix is not modified, which might suggest that what you need to do below
|
||||||
// is use Side_opposite[first_side].
|
// is use Side_opposite[first_side].
|
||||||
set_matrix_based_on_side(&rotmat3, Side_opposite[first_side]); // modify rotation matrix for desired side
|
update_matrix_based_on_side(rotmat3, Side_opposite[first_side]); // modify rotation matrix for desired side
|
||||||
|
|
||||||
vm_transpose_matrix(rotmat3); // get the inverse of the current orientation matrix
|
vm_transpose_matrix(rotmat3); // get the inverse of the current orientation matrix
|
||||||
rotmat2 = vm_transposed_matrix(vm_matrix_x_matrix(rotmat,rotmat3)); // now rotmat2 takes the current segment to the desired orientation
|
rotmat2 = vm_transposed_matrix(vm_matrix_x_matrix(rotmat,rotmat3)); // now rotmat2 takes the current segment to the desired orientation
|
||||||
|
|
|
@ -552,7 +552,7 @@ void med_extract_matrix_from_segment(segment *sp,vms_matrix *rotmat)
|
||||||
// ------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------
|
||||||
// Given a rotation matrix *rotmat which describes the orientation of a segment
|
// Given a rotation matrix *rotmat which describes the orientation of a segment
|
||||||
// and a side destside, return the rotation matrix which describes the orientation for the side.
|
// and a side destside, return the rotation matrix which describes the orientation for the side.
|
||||||
void set_matrix_based_on_side(vms_matrix *rotmat,int destside)
|
void update_matrix_based_on_side(vms_matrix &rotmat,int destside)
|
||||||
{
|
{
|
||||||
vms_angvec rotvec;
|
vms_angvec rotvec;
|
||||||
vms_matrix r1;
|
vms_matrix r1;
|
||||||
|
@ -561,31 +561,31 @@ void set_matrix_based_on_side(vms_matrix *rotmat,int destside)
|
||||||
case WLEFT:
|
case WLEFT:
|
||||||
vm_angvec_make(&rotvec,0,0,-16384);
|
vm_angvec_make(&rotvec,0,0,-16384);
|
||||||
vm_angles_2_matrix(r1,rotvec);
|
vm_angles_2_matrix(r1,rotvec);
|
||||||
*rotmat = vm_matrix_x_matrix(*rotmat, r1);
|
rotmat = vm_matrix_x_matrix(rotmat, r1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTOP:
|
case WTOP:
|
||||||
vm_angvec_make(&rotvec,-16384,0,0);
|
vm_angvec_make(&rotvec,-16384,0,0);
|
||||||
vm_angles_2_matrix(r1,rotvec);
|
vm_angles_2_matrix(r1,rotvec);
|
||||||
*rotmat = vm_matrix_x_matrix(*rotmat, r1);
|
rotmat = vm_matrix_x_matrix(rotmat, r1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRIGHT:
|
case WRIGHT:
|
||||||
vm_angvec_make(&rotvec,0,0,16384);
|
vm_angvec_make(&rotvec,0,0,16384);
|
||||||
vm_angles_2_matrix(r1,rotvec);
|
vm_angles_2_matrix(r1,rotvec);
|
||||||
*rotmat = vm_matrix_x_matrix(*rotmat, r1);
|
rotmat = vm_matrix_x_matrix(rotmat, r1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WBOTTOM:
|
case WBOTTOM:
|
||||||
vm_angvec_make(&rotvec,+16384,-32768,0); // bank was -32768, but I think that was an erroneous compensation
|
vm_angvec_make(&rotvec,+16384,-32768,0); // bank was -32768, but I think that was an erroneous compensation
|
||||||
vm_angles_2_matrix(r1,rotvec);
|
vm_angles_2_matrix(r1,rotvec);
|
||||||
*rotmat = vm_matrix_x_matrix(*rotmat, r1);
|
rotmat = vm_matrix_x_matrix(rotmat, r1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFRONT:
|
case WFRONT:
|
||||||
vm_angvec_make(&rotvec,0,0,-32768);
|
vm_angvec_make(&rotvec,0,0,-32768);
|
||||||
vm_angles_2_matrix(r1,rotvec);
|
vm_angles_2_matrix(r1,rotvec);
|
||||||
*rotmat = vm_matrix_x_matrix(*rotmat, r1);
|
rotmat = vm_matrix_x_matrix(rotmat, r1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WBACK:
|
case WBACK:
|
||||||
|
@ -851,7 +851,7 @@ static int med_attach_segment_rotated(segment *destseg, segment *newseg, int des
|
||||||
|
|
||||||
// Do lots of hideous matrix stuff, about 3/4 of which could probably be simplified out.
|
// Do lots of hideous matrix stuff, about 3/4 of which could probably be simplified out.
|
||||||
med_extract_matrix_from_segment(destseg,&rotmat); // get orientation matrix for destseg (orthogonal rotation matrix)
|
med_extract_matrix_from_segment(destseg,&rotmat); // get orientation matrix for destseg (orthogonal rotation matrix)
|
||||||
set_matrix_based_on_side(&rotmat,destside);
|
update_matrix_based_on_side(rotmat,destside);
|
||||||
vm_vector_2_matrix(rotmat1,forvec,&upvec,nullptr);
|
vm_vector_2_matrix(rotmat1,forvec,&upvec,nullptr);
|
||||||
const auto rotmat4 = vm_matrix_x_matrix(rotmat,rotmat1); // this is the desired orientation of the new segment
|
const auto rotmat4 = vm_matrix_x_matrix(rotmat,rotmat1); // this is the desired orientation of the new segment
|
||||||
med_extract_matrix_from_segment(newseg,&rotmat3); // this is the current orientation of the new segment
|
med_extract_matrix_from_segment(newseg,&rotmat3); // this is the current orientation of the new segment
|
||||||
|
|
Loading…
Reference in a new issue