fixed types in OrientedDisk function

This commit is contained in:
Luigi Malomo 2014-08-09 17:10:19 +00:00
parent f2efb48a3c
commit bb49f1c657
1 changed files with 11 additions and 8 deletions

View File

@ -869,15 +869,18 @@ void Disk(MeshType & m, int slices)
template <class MeshType> template <class MeshType>
void OrientedDisk(MeshType &m, int slices, typename MeshType::CoordType center, typename MeshType::CoordType norm, float radius) void OrientedDisk(MeshType &m, int slices, typename MeshType::CoordType center, typename MeshType::CoordType norm, float radius)
{ {
Disk(m,slices); typedef typename MeshType::ScalarType ScalarType;
tri::UpdatePosition<MeshType>::Scale(m,radius); typedef typename MeshType::CoordType CoordType;
MeshType::ScalarType angleRad = Angle(MeshType::CoordType(0,0,1),norm);
MeshType::CoordType axis = MeshType::CoordType(0,0,1)^norm;
Matrix44<MeshType::ScalarType> rotM; Disk(m,slices);
rotM.SetRotateRad(angleRad,axis); tri::UpdatePosition<MeshType>::Scale(m,radius);
tri::UpdatePosition<MeshType>::Matrix(m,rotM); ScalarType angleRad = Angle(CoordType(0,0,1),norm);
tri::UpdatePosition<MeshType>::Translate(m,center); CoordType axis = CoordType(0,0,1)^norm;
Matrix44<ScalarType> rotM;
rotM.SetRotateRad(angleRad,axis);
tri::UpdatePosition<MeshType>::Matrix(m,rotM);
tri::UpdatePosition<MeshType>::Translate(m,center);
} }
template <class MeshType> template <class MeshType>