Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returned faces not on surface #16

Open
RichardFoss opened this issue May 25, 2022 · 0 comments
Open

Returned faces not on surface #16

RichardFoss opened this issue May 25, 2022 · 0 comments

Comments

@RichardFoss
Copy link

Hi, thank you for your code!
I have been using it to create a convex hull for speakers in an immersive sound system. I have given the relevant code below, and also the DBG output - apologies for the long listing. My concern is that triangles, indicated by the indices, are often not on the surface of the hull. Could I be doing something wrong? Speaker coords are in meters.

In header:
QuickHull<float> qh; std::vector<Vector3<float>> vertices; ConvexHull<FloatType> faces;

Part of code:
` for (int i = 0; i < noSpeakers; i++) {
vertices.emplace_back(speakers[i]->x, speakers[i]->y, speakers[i]->z);
}
DBG("Speakers";
for (int i = 0; i < noSpeakers; i++) {
DBG(i);
DBG(vertices[i].x);
DBG(vertices[i].y);
DBG(vertices[i].z);
}

DBG("size of vertices");
DBG(vertices.size());
faces = qh.getConvexHull(vertices, true, false);
const auto& indexBuffer = faces.getIndexBuffer();
const auto& vertexBuffer = faces.getVertexBuffer();

DBG("Index Buffer");
for (int i = 0; i < indexBuffer.size(); i=(i+3)) {
    DBG(indexBuffer[i]);
    DBG(indexBuffer[i+1]);
    DBG(indexBuffer[i+2]);
    DBG(" ");
}`

Speakers
Speaker:
0
4
1.77
Speaker:
9.60067e-09
3.89018
4.14666
Speaker:
-2
3.46
1.77
Speaker:
2
3.46
1.77
Speaker:
-1.94509
3.36489
4.14666
Speaker:
1.94509
3.36489
4.14666
Speaker:
-3.76
-1.37
1.77
Speaker:
3.76
-1.37
1.77
Speaker:
-3.6568
-1.33244
4.14666
Speaker:
3.6568
-1.33244
4.14666
Speaker:
2
-3.46
1.77
Speaker:
-2
-3.46
1.77
Speaker:
0
0.27
4.2
size of vertices
13
Index Buffer
0
2
1

1
2
3

3
2
4

2
5
4

5
6
4

6
3
4

6
7
3

7
1
3

7
0
1

0
7
8

8
7
9

7
6
9

9
6
10

6
5
10

5
11
10

11
9
10

11
8
9

8
11
12

11
0
12

0
8
12

0
11
2

2
11
5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant