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

How to visualize a 3D polyhedron #1653

Open
wyqsnddd opened this issue Jan 24, 2022 · 0 comments
Open

How to visualize a 3D polyhedron #1653

wyqsnddd opened this issue Jan 24, 2022 · 0 comments

Comments

@wyqsnddd
Copy link

I want to visualize a three-dimensional polyhedron through its vertices ( i.e., the V-representation ).

By investigating the support polygon, I noticed that we could feed vertices to a Polygon through the following snippet:

if(mDisplayPolygon)
  {
    mVertices->resize(poly.size());
    mFaces->resize(poly.size());
    for(std::size_t i=0; i < poly.size(); ++i)
    {
      const Eigen::Vector3d& v = axes.first*poly[i][0] + axes.second*poly[i][1]
                                  + up*mElevation;
      (*mVertices)[i] = ::osg::Vec3(v[0], v[1], v[2]);
      (*mFaces)[i] = i;
    }

    mPolygonGeom->setVertexArray(mVertices);
    mPolygonGeom->setPrimitiveSet(0, mFaces);
  }

This example only manages to visualize planar polygon no matter how much I tweak it. Could anyone give me a solution?

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