Generate stl file for random spheres
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello,
I had a look at the example in matlab documentation for generating a sphere and to export it in stl format http://nl.mathworks.com/help/symbolic/mupad_ref/export-stl.html
What is not clear to me is how do I specify radius and centre of the spheres, so that I could loop through to generate a number of random spheres and generate an stl file?
Thanks a lot.
댓글 수: 0
채택된 답변
Rohit Kudva
2015년 10월 22일
Hi SS
The equations for a sphere centered at (m,n,p) with radius 'r' in spherical coordinate system will be
x = m + r*cos(theta)*sin(phi)
y = n+ r*sin(theta)*sin(phi)
z = p+ r*cos(phi)
Thus the code for MuPAD will look like
x:= m+r*cos(u)*sin(v):
y:= n+r*sin(u)*sin(v):
z:= p+r*cos(v):
filename:= NOTEBOOKPATH."sphere.stl":
export::stl(filename, [x, y, z], u = 0 .. 2*PI, v = 0 .. PI, Text)
plot(plot::SurfaceSTL(filename, MeshVisible))
Regards,
Rohit
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 3-D Function Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!