diff --git a/vcg/complex/algorithms/create/platonic.h b/vcg/complex/algorithms/create/platonic.h index 8309c0e1..9d654e52 100644 --- a/vcg/complex/algorithms/create/platonic.h +++ b/vcg/complex/algorithms/create/platonic.h @@ -522,6 +522,47 @@ void Cone( MeshType& in, } } +template +void OrientedCone(MeshType & m, + const typename MeshType::CoordType origin, + const typename MeshType::CoordType end, + const typename MeshType::ScalarType r1, + const typename MeshType::ScalarType r2, + const int SubDiv = 36 ) +{ + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; + typedef Matrix44 Matrix44x; + Cone(m,r1,r2,Distance(origin,end),SubDiv); + +// tri::UpdatePosition::Translate(m,CoordType(0,1,0)); +// tri::UpdatePosition::Scale(m,CoordType(1,0.5f,1)); +// tri::UpdatePosition::Scale(m,CoordType(xScale,1.0f,yScale)); + +// float height = Distance(origin,end); +// tri::UpdatePosition::Scale(m,CoordType(radius,height,radius)); + CoordType norm = end-origin; + ScalarType angleRad = Angle(CoordType(0,1,0),norm); + const ScalarType Delta= 0.000000001; + Matrix44x rotM; + if (fabs(angleRad)::Matrix(m,rotM); + tri::UpdatePosition::Translate(m,origin); + +} + template void Box(MeshType &in, const typename MeshType::BoxType & bb ) @@ -1000,9 +1041,21 @@ void OrientedEllipticPrism(MeshType & m, const typename MeshType::CoordType orig tri::UpdatePosition::Scale(m,CoordType(radius,height,radius)); CoordType norm = end-origin; ScalarType angleRad = Angle(CoordType(0,1,0),norm); - CoordType axis = CoordType(0,1,0)^norm; + const ScalarType Delta= 0.000000001; Matrix44x rotM; - rotM.SetRotateRad(angleRad,axis); + if (fabs(angleRad)::Matrix(m,rotM); tri::UpdatePosition::Translate(m,origin);