|
| 1 | +#include <npe.h> |
| 2 | +#include <common.h> |
| 3 | +#include <typedefs.h> |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +#include <igl/two_axis_valuator_fixed_up.h> |
| 11 | + |
| 12 | +const char *ds_two_axis_valuator_fixed_up = R"igl_Qu8mg5v7( |
| 13 | +
|
| 14 | +Applies a two-axis valuator drag rotation (as seen in Maya/Studio max) to a given rotation. |
| 15 | +
|
| 16 | +Parameters |
| 17 | +---------- |
| 18 | + w width of the trackball context |
| 19 | +h height of the trackball context |
| 20 | +speed controls how fast the trackball feels, 1 is normal |
| 21 | +down_quat rotation at mouse down, i.e. the rotation we're applying the |
| 22 | + trackball motion to (as quaternion). **Note:** Up-vector that is fixed |
| 23 | + is with respect to this rotation. |
| 24 | +down_x position of mouse down |
| 25 | +down_y position of mouse down |
| 26 | +mouse_x current x position of mouse |
| 27 | +mouse_y current y position of mouse |
| 28 | +
|
| 29 | +Returns |
| 30 | +------- |
| 31 | +quat the resulting rotation (as quaternion) |
| 32 | +
|
| 33 | +See also |
| 34 | +-------- |
| 35 | +snap_to_fixed_up |
| 36 | +
|
| 37 | +Notes |
| 38 | +----- |
| 39 | +None |
| 40 | +
|
| 41 | +Examples |
| 42 | +-------- |
| 43 | +
|
| 44 | +)igl_Qu8mg5v7"; |
| 45 | + |
| 46 | +npe_function(two_axis_valuator_fixed_up) |
| 47 | +npe_doc(ds_two_axis_valuator_fixed_up) |
| 48 | + |
| 49 | +npe_arg(w, int) |
| 50 | +npe_arg(h, int) |
| 51 | +npe_arg(speed, double) |
| 52 | +npe_arg(down_quat, dense_float, dense_double) |
| 53 | +npe_arg(down_x, int) |
| 54 | +npe_arg(down_y, int) |
| 55 | +npe_arg(mouse_x, int) |
| 56 | +npe_arg(mouse_y, int) |
| 57 | + |
| 58 | + |
| 59 | +npe_begin_code() |
| 60 | + assert_size_equals(down_quat, 4, "down_quat"); |
| 61 | + Eigen::Quaternion<double> down_quat_copy; |
| 62 | + if (down_quat.cols() == 1) |
| 63 | + { |
| 64 | + down_quat_copy.x() = down_quat(0, 0); |
| 65 | + down_quat_copy.y() = down_quat(1, 0); |
| 66 | + down_quat_copy.z() = down_quat(2, 0); |
| 67 | + down_quat_copy.w() = down_quat(3, 0); |
| 68 | + } |
| 69 | + else |
| 70 | + { |
| 71 | + down_quat_copy.x() = down_quat(0, 0); |
| 72 | + down_quat_copy.y() = down_quat(0, 1); |
| 73 | + down_quat_copy.z() = down_quat(0, 2); |
| 74 | + down_quat_copy.w() = down_quat(0, 3); |
| 75 | + } |
| 76 | + |
| 77 | + Eigen::Quaternion<double> quat_copy; |
| 78 | + igl::two_axis_valuator_fixed_up(w, h, speed, down_quat_copy, down_x, down_y, mouse_x, mouse_y, quat_copy); |
| 79 | + EigenDenseLike<npe_Matrix_down_quat> quat(4, 1); |
| 80 | + quat(0) = quat_copy.x(); |
| 81 | + quat(1) = quat_copy.y(); |
| 82 | + quat(2) = quat_copy.z(); |
| 83 | + quat(3) = quat_copy.w(); |
| 84 | + |
| 85 | + return npe::move(quat); |
| 86 | + |
| 87 | +npe_end_code() |
| 88 | + |
| 89 | + |
0 commit comments