git-svn-id: svn://db.shs.com.ru/libs@631 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-11-26 21:20:59 +00:00
parent 9059a17cd0
commit 5eaf516eae
16 changed files with 615 additions and 411 deletions

View File

@@ -126,7 +126,7 @@ Mesh * Primitive::ellipsoid(int segments_wl, int segments_h, float width, float
}
Mesh * Primitive::disc(int segments, float width, float length, bool up) {
Mesh * Primitive::disc(int segments, float width, float length, bool up, float end_angle) {
Mesh * ret = new Mesh();
QVector<QVector3D> & v(ret->vertices ());
QVector<QVector3D> & n(ret->normals ());
@@ -137,8 +137,9 @@ Mesh * Primitive::disc(int segments, float width, float length, bool up) {
QVector3D cp;
v << QVector3D();
t << QVector2D(0.5f, 0.5f);
end_angle *= deg2rad;
for (int i = 0; i < segments; i++) {
double a = (double)i / (segments - 1) * M_2PI;
double a = (double)i / (segments - 1) * end_angle;
cp.setX(length / 2. * cos(a));
cp.setY(width / 2. * sin(a));
v << cp;
@@ -263,7 +264,7 @@ Mesh * Primitive::arrow(int segments, float thick, float angle) {
}
Mesh * Primitive::torus(int segments_main, int segments_second, float radius_main, float radius_second) {
Mesh * Primitive::torus(int segments_main, int segments_second, float radius_main, float radius_second, float end_angle) {
Mesh * ret = new Mesh();
QVector<QVector3D> & v(ret->vertices ());
QVector<QVector3D> & n(ret->normals ());
@@ -287,7 +288,7 @@ Mesh * Primitive::torus(int segments_main, int segments_second, float radius_mai
for (int i = 0; i < segments_main; i++) {
double x = (double)i / (segments_main - 1);
QMatrix4x4 rm;
rm.rotate(x * 360., 0., 0., 1.);
rm.rotate(x * end_angle, 0., 0., 1.);
for (int j = 0; j < ccnt; j++) {
ct[j].setX(x);
v << rm.map(cv[j]);