// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "cylinder.h" #include "PI.h" #include #include template IGL_INLINE void igl::cylinder( const int axis_devisions, const int height_devisions, Eigen::PlainObjectBase & V, Eigen::PlainObjectBase & F) { V.resize(axis_devisions*height_devisions,3); F.resize(2*(axis_devisions*(height_devisions-1)),3); int f = 0; typedef typename DerivedV::Scalar Scalar; for(int th = 0;th 0) { F(f,0) = ((th+0)%axis_devisions)+(h-1)*axis_devisions; F(f,1) = ((th+1)%axis_devisions)+(h-1)*axis_devisions; F(f,2) = ((th+0)%axis_devisions)+(h+0)*axis_devisions; f++; F(f,0) = ((th+1)%axis_devisions)+(h-1)*axis_devisions; F(f,1) = ((th+1)%axis_devisions)+(h+0)*axis_devisions; F(f,2) = ((th+0)%axis_devisions)+(h+0)*axis_devisions; f++; } } } assert(f == F.rows()); } #ifdef IGL_STATIC_LIBRARY template void igl::cylinder, Eigen::Matrix >(int, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif