visual drawing circle in c++
visual drawing circle in c++
下面的代码在x和z坐标平面上为我绘制了一个3d球体对象的圆圈。
double radiusCircle =0.5;
double i;
double j;
for(i = 0.0f;i<6.0f;i+=0.2f){
sphere1 = new Sphere;
sphere1->position.x = radiusCircle *cos(i * (2.0 * 3.14) /6)+4;
sphere1->position.z = radiusCircle *sin(i * (2.0 * 3.14) / 6 )+2;
}
我试图在y轴上堆叠它们,但不能得到正确的。我想知道是否有人能帮我做这件事。
基本上,我想要上面的代码在一个圆圈中绘制30 sphere1
,但我也想要它的高度为4。
double radiusCircle =0.5;
double i;
double j;
for (y = 0; y < 4; y++) {
for(i = 0.0f;i<6.0f;i+=0.2f){
sphere1 = new Sphere;
sphere1->position.x = radiusCircle *cos(i * (2.0 * 3.14) /6)+4;
sphere1->position.z = radiusCircle *sin(i * (2.0 * 3.14) / 6 )+2;
sphere1->position.y = sphere1.radius * 2 * y; // <-- assign position.y to the sphere height
}
}
相关文章:
- netcat command in c++
- Difference in displaying cv2 Mat
- C++ MFC Libraries in Travis CI
- 如何在OpenSSL中从configuration.h.in获取configuration.h
- 创建具有 new in 函数和"this is nullptr"异常的对象
- IN, OUT, INOUT Parameters
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 有人安装"IITB Simplecpp in mac"吗?
- 从 C 样式字符串中删除子字符串 "in place" 在C++代码中
- 如何修复"error: ‘_1’ was not declared in this scope"?
- Softmax Implementation in C++
- 将 out/in out 参数与 if/switch 的 init 语句一起使用
- IF-nesting in c++
- Gurobi GRBModel and GRBmodel in C++
- Tensorflow Hub in C++
- Centos7 g++ "to_string is not in a member of std"
- InitializeCriticalSectionEx Not Located In KERNEL32.Dll
- 将 lambda 表达式传递给 std::function in C++
- @CPPFLAGS@在 Makefile.in 中意味着什么?
- std::async from std::async in windows xp