I know Matlab has a function called cylinder to create the points for a cylinder when number of points along the circumference, and the radius length. What if I don't want a unit cylinder, and also don't want it to center at the default axis (for example along z-axis)? What would be the easiest approach to create such a cylinder? Thanks in advance.
相关问题
- Extract matrix elements using a vector of column i
- How do you get R's null and residual deviance
- How to display an image represented by three matri
- How to determine +/- sign when calculating diagona
- OpenCV - Is there an implementation of marker base
相关文章
- Algorithm for partially filling a polygonal mesh
- Robust polygon normal calculation
- How do I append metadata to an image in Matlab?
- Algorithm for maximizing coverage of rectangular a
- How can I write-protect the Matlab language?
- `std::sin` is wrong in the last bit
- Escape sequence to display apostrophe in MATLAB
- Vertical line fit using polyfit
The previous answer is fine, but you can get matlab to do more of the work for you (because the results of
cylinder
separatex,y,z
components you need to work a little to do the matrix multiplication for the rotation). To have the center of base of the cylinder at[x0 y0 z0]
, scaled by[xf yf xf]
(usexf=yf
unless you want an elliptic cylinder), use:If you also want to rotate it so it isn't aligned along the z-axis, use
rotate
. For example, to rotate about thex-axis
by 90 degrees, so it's aligned along the y-axis, use:Multiply the points by your favourite combination of a scaling matrix, a translation matrix, and a rotation matrix.