| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_RENDERING_CARTOON_H |
| 7 |
#define AVOGADRO_RENDERING_CARTOON_H |
| 8 |
|
| 9 |
#include "bsplinegeometry.h" |
| 10 |
|
| 11 |
#include <avogadro/core/residue.h> |
| 12 |
|
| 13 |
namespace Avogadro { |
| 14 |
namespace Rendering { |
| 15 |
|
| 16 |
enum CartoonType |
| 17 |
{ |
| 18 |
Undefined = -1, // constant small radius |
| 19 |
Body = 0, // constant big radius |
| 20 |
Arrow = 3, // arrow head |
| 21 |
Head = 2, // decreasing |
| 22 |
Tail = 1 // increasing |
| 23 |
}; |
| 24 |
|
| 25 |
class AVOGADRORENDERING_EXPORT Cartoon : public BSplineGeometry |
| 26 |
{ |
| 27 |
public: |
| 28 |
Cartoon(); |
| 29 |
Cartoon(float minRadius, float maxRadius); |
| 30 |
static const float ELIPSE_RATIO; |
| 31 |
|
| 32 |
void addPoint(const Vector3f& pos, const Vector3ub& color, size_t group, |
| 33 |
size_t id, Core::Residue::SecondaryStructure sec); |
| 34 |
|
| 35 |
protected: |
| 36 |
// create an ellipsis and adapt it to the affine A |
| 37 |
std::vector<ColorNormalVertex> computeCirclePoints(const Eigen::Affine3f& a, |
| 38 |
const Eigen::Affine3f& b, |
| 39 |
bool flat) const override; |
| 40 |
|
| 41 |
float computeScale(size_t index, float t, float scale) const override; |
| 42 |
|
| 43 |
std::vector<std::pair<CartoonType, size_t>> m_type; |
| 44 |
float m_minRadius, m_maxRadius; |
| 45 |
}; |
| 46 |
} // namespace Rendering |
| 47 |
} // namespace Avogadro |
| 48 |
|
| 49 |
#endif |