Add a rotation to a homogeneous 3D transformation matrix.
::hom_mat3d_rotate adds a rotation around the Axis-axis by the angle Phi to a homogeneous 3D transformation matrix HomMat3D. The point (Px,Py,Pz) is the fixed point of the transformation. The resulting matrix is returned in HomMat3DRotate.
The homogeneous 4x3 transformation matrix HomMat3D describes the transformation of a 3D point from the source coordinate system into the destination coordinate system (Without Attention to the fixed point).
::hom_mat3d_rotate is used to generate a new 4x3 transformation matrix HomMat3DRotate by rotating the Axis-axis of HomMat3D by the angle Phi (in mathematical positive direction).
If you want to rotate the source coordinate system, you have to invert the transformation matrix using ::hom_mat3d_invert, rotate it using ::hom_mat3d_rotate, and invert it back again.
The transformation of a 3D point (given in the source coordinate system) into a destination coordinate system ist given by a rotation R and a translation T (see ::affine_trans_point_3d). Thus, the following holds:
/ x2 \ / x1 \
| y2 | = R_rot | y1 | + T_rot
\ z2 / \ z1 /
/ x2 \
= ( R_phi R_org ) | y2 | + T_org
\ z2 /
with
/ 1 0 0 \
R_phi = | 0 cos(phi) -sin(phi) | Rotation around x-axis
\ 0 sin(phi) cos(phi) /
/ cos(phi) 0 sin(phi) \
R_phi = | 0 1 0 | Rotation around y-axis
\ -sin(phi) 0 cos(phi) /
/ cos(phi) -sin(phi) 0 \
R_phi = | sin(phi) cos(phi) 0 | Rotation around z-axis
\ 0 0 1 /
|
HomMat3D (input_control) |
affine3d-array -> HTuple.double |
| Input transformation matrix. | |
| Number of elements: 12 | |
|
Phi (input_control) |
angle.rad -> HTuple.double / long |
| Rotation angle. | |
| Default value: 0.78 | |
| Suggested values: 0.1, 0.2, 0.3, 0.4, 0.78, 1.57, 3.14 | |
| Typical range of values: 0 <= Phi <= 6.28318530718 | |
| Minimum increment: 0.01 | |
|
Recommended increment: 0.1 | |
|
Axis (input_control) |
string -> HTuple.char * |
| Axis, to be rotated around. | |
| Default value: ''x'' | |
| Suggested values: ''x'', ''y'', ''z'' | |
|
Px (input_control) |
point3d.x -> HTuple.double / long |
| Fixed point of the transformation (x coordinate). | |
| Default value: 0 | |
| Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024 | |
| Typical range of values: 0 <= Px <= 1024 | |
| Minimum increment: 1 | |
|
Recommended increment: 10 | |
|
Py (input_control) |
point3d.y -> HTuple.double / long |
| Fixed point of the transformation (y coordinate). | |
| Default value: 0 | |
| Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024 | |
| Typical range of values: 0 <= Py <= 1024 | |
| Minimum increment: 1 | |
|
Recommended increment: 10 | |
|
Pz (input_control) |
point3d.z -> HTuple.double / long |
| Fixed point of the transformation (z coordinate). | |
| Default value: 0 | |
| Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024 | |
| Typical range of values: 0 <= Pz <= 1024 | |
| Minimum increment: 1 | |
|
Recommended increment: 10 | |
|
HomMat3DRotate (output_control) |
affine3d-array -> HTuple.double * |
| Output transformation matrix. | |
| Number of elements: 12 | |
HTuple CamPose, HomTransMat, HomTransMatRot;
HTuple HomTransMatInv, HomTransMatRot2, HomTransMat2;
// read camera pose
::read_pose("campose.dat",&CamPose);
// transform pose to transformation matrix
::pose_to_hom_mat3d(CamPose,&HomTransMat);
// rotate destination coordinate system around x-axis by 10 degree
::hom_mat3d_rotate(HomTransMat,10,"x",0,0,0,&HomTransMatRot);
// rotate source coordinate system around y-axis by 270 degree
::hom_mat3d_invert(HomTransMat,&HomTransMatInv);
::hom_mat3d_rotate(HomTransMatInv,270,"y",0,0,0,&HomTransMatRot2);
::hom_mat3d_invert(HomTransMatRot2,&HomTransMat2);
::hom_mat3d_rotate always returns H_MSG_TRUE.
::hom_mat3d_identity, ::hom_mat3d_translate, ::hom_mat3d_scale, ::hom_mat3d_rotate
::hom_mat3d_translate, ::hom_mat3d_scale, ::hom_mat3d_rotate
::hom_mat3d_invert, ::hom_mat3d_identity, ::hom_mat3d_rotate, ::hom_mat3d_translate, ::pose_to_hom_mat3d, ::hom_mat3d_to_pose, ::hom_mat3d_compose
Basic operators