xref: /aosp_15_r20/external/eigen/demos/opengl/icosphere.h (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li // This file is part of Eigen, a lightweight C++ template library
2*bf2c3715SXin Li // for linear algebra.
3*bf2c3715SXin Li //
4*bf2c3715SXin Li // Copyright (C) 2008 Gael Guennebaud <[email protected]>
5*bf2c3715SXin Li //
6*bf2c3715SXin Li // This Source Code Form is subject to the terms of the Mozilla
7*bf2c3715SXin Li // Public License v. 2.0. If a copy of the MPL was not distributed
8*bf2c3715SXin Li // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9*bf2c3715SXin Li 
10*bf2c3715SXin Li #ifndef EIGEN_ICOSPHERE_H
11*bf2c3715SXin Li #define EIGEN_ICOSPHERE_H
12*bf2c3715SXin Li 
13*bf2c3715SXin Li #include <Eigen/Core>
14*bf2c3715SXin Li #include <vector>
15*bf2c3715SXin Li 
16*bf2c3715SXin Li class IcoSphere
17*bf2c3715SXin Li {
18*bf2c3715SXin Li   public:
19*bf2c3715SXin Li     IcoSphere(unsigned int levels=1);
vertices()20*bf2c3715SXin Li     const std::vector<Eigen::Vector3f>& vertices() const { return mVertices; }
21*bf2c3715SXin Li     const std::vector<int>& indices(int level) const;
22*bf2c3715SXin Li     void draw(int level);
23*bf2c3715SXin Li   protected:
24*bf2c3715SXin Li     void _subdivide();
25*bf2c3715SXin Li     std::vector<Eigen::Vector3f> mVertices;
26*bf2c3715SXin Li     std::vector<std::vector<int>*> mIndices;
27*bf2c3715SXin Li     std::vector<int> mListIds;
28*bf2c3715SXin Li };
29*bf2c3715SXin Li 
30*bf2c3715SXin Li #endif // EIGEN_ICOSPHERE_H
31