Closed BrentHuang closed 5 years ago
Exactly! There are a few settings specifically for the command line debug mode to be able to position and rotate your object:
While the last setting is called "rotation matrix", it can also be used for scaling. You can apply any linear transformation with that matrix.
Thank you, can you give me some configuration examples, such as scaling 1.5 times, then rotating the model, then panning the model?
Sure. Here is a scaling matrix:
[[1.5, 0, 0], [0, 1.5, 0], [0, 0, 1.5]]
See also documentation here.
Here is a rotation matrix of 30 degrees around the Z axis (you'd have to calculate the cosines and sines before putting this in a setting):
[[1, 0, 0], [0, cos(30), -sin(30)], [0, sin(30), cos(30)]]
There is a comprehensive formula for it here on Wikipedia but a more intuitive explanation would be on Wolfram.
Panning (moving) the model is not a linear transformation so it can't be represented by the rotation matrix. Use the settings mesh_position_x
, mesh_position_y
, and mesh_position_z
for that.
There is only one matrix here. What should I do if I want to scale and rotate together?
You multiply the two matrices with matrix multiplication. The order in which the matrix multiplication happens matters though (whether you rotate first and then scale or scale first and then rotate).
Sure. Here is a scaling matrix:
[[1.5, 0, 0], [0, 1.5, 0], [0, 0, 1.5]]
See also documentation here.
Here is a rotation matrix of 30 degrees around the Z axis (you'd have to calculate the cosines and sines before putting this in a setting):
[[1, 0, 0], [0, cos(30), -sin(30)], [0, sin(30), cos(30)]]
There is a comprehensive formula for it here on Wikipedia but a more intuitive explanation would be on Wolfram.
Panning (moving) the model is not a linear transformation so it can't be represented by the rotation matrix. Use the settings
mesh_position_x
,mesh_position_y
, andmesh_position_z
for that.
[[1, 0, 0], [0, cos(30), -sin(30)], [0, sin(30), cos(30)]] => should be rotate by X axis?not Z axis.
Is it clockwise to rotate +10 degrees around the x-axis? How is the direction of rotation determined?
What is the range of rotation angle? 0~360 or -180~180?
@BrentHuang This issue was closed by @Ghostkeeper. Please direct your question to a maths- or computer graphics related forum.
https://math.stackexchange.com/ https://medium.com/swlh/understanding-3d-matrix-transforms-with-pixijs-c76da3f8bd8
Unrelated to maths: putting cos(30)
in there like my example won't work. You'll need to calculate the cosine of your angle yourself because CuraEngine will not evaluate it. Whether you do that in degrees, radians, grads, sextants, etc. doesn't matter as long as your calculator does it correctly.
Application Version
4.3.0
Platform
linux
how to pass model scale and rotate settings to curaEngine? with -s?