Skip to content

Commit

Permalink
Added edgeShell for edge mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
gianpaolopalma committed Feb 13, 2024
1 parent 123325e commit 0ca039b
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions vcg/complex/algorithms/create/platonic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1215,14 +1215,26 @@ template <class MeshType>
void BuildCylinderEdgeShell(MeshType &mIn, MeshType &mOut, float radius=0, int slices=16, int stacks=1 )
{
if(radius==0) radius = mIn.bbox.Diag()/100.0f;
typedef typename tri::UpdateTopology<MeshType>::PEdge PEdge;
std::vector<PEdge> edgeVec;
tri::UpdateTopology<MeshType>::FillUniqueEdgeVector(mIn,edgeVec,false);
for(size_t i=0;i<edgeVec.size();++i)
if (mIn.edge.size() > 0)
{
MeshType mCyl;
tri::OrientedCylinder(mCyl,edgeVec[i].v[0]->P(),edgeVec[i].v[1]->P(),radius,true,slices,stacks);
tri::Append<MeshType,MeshType>::Mesh(mOut,mCyl);
for (size_t i = 0; i < mIn.edge.size(); ++i) {
MeshType mCyl;
tri::OrientedCylinder(
mCyl, mIn.edge[i].V(0)->P(), mIn.edge[i].V(1)->P(), radius, true, slices, stacks);
tri::Append<MeshType, MeshType>::Mesh(mOut, mCyl);
}
}
else
{
typedef typename tri::UpdateTopology<MeshType>::PEdge PEdge;
std::vector<PEdge> edgeVec;
tri::UpdateTopology<MeshType>::FillUniqueEdgeVector(mIn, edgeVec, false);
for (size_t i = 0; i < edgeVec.size(); ++i) {
MeshType mCyl;
tri::OrientedCylinder(
mCyl, edgeVec[i].v[0]->P(), edgeVec[i].v[1]->P(), radius, true, slices, stacks);
tri::Append<MeshType, MeshType>::Mesh(mOut, mCyl);
}
}
}

Expand Down

0 comments on commit 0ca039b

Please sign in to comment.