Added OrientedDisk creation method. and a missing "clear()"
This commit is contained in:
parent
790cf5d7ef
commit
d331cf7f60
|
@ -721,9 +721,11 @@ void FaceGrid(MeshType & in, const std::vector<int> &grid, int w, int h)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
template <class MeshType>
|
||||
void Disk(MeshType & m, int slices)
|
||||
{
|
||||
m.Clear();
|
||||
typename MeshType::VertexIterator vi = vcg::tri::Allocator<MeshType>::AddVertices(m,slices+1);
|
||||
(*vi).P() = typename MeshType::CoordType(0,0,0);
|
||||
++vi;
|
||||
|
@ -749,6 +751,20 @@ void Disk(MeshType & m, int slices)
|
|||
}
|
||||
}
|
||||
|
||||
template <class MeshType>
|
||||
void OrientedDisk(MeshType &m, int slices, Point3f center, Point3f norm, float radius)
|
||||
{
|
||||
Disk(m,slices);
|
||||
tri::UpdatePosition<MeshType>::Scale(m,radius);
|
||||
float angleRad = Angle(Point3f(0,0,1),norm);
|
||||
Point3f axis = Point3f(0,0,1)^norm;
|
||||
|
||||
Matrix44f rotM;
|
||||
rotM.SetRotateRad(angleRad,axis);
|
||||
tri::UpdatePosition<MeshType>::Matrix(m,rotM);
|
||||
tri::UpdatePosition<MeshType>::Translate(m,center);
|
||||
}
|
||||
|
||||
template <class MeshType>
|
||||
void Cylinder(int slices, int stacks, MeshType & m){
|
||||
|
||||
|
|
Loading…
Reference in New Issue