RayZaler 0.1
The free opto-mechanical simulation framework
TubeElement.h
1//
2// Copyright (c) 2024 Gonzalo José Carracedo Carballal
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as
6// published by the Free Software Foundation, either version 3 of the
7// License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public
15// License along with this program. If not, see
16// <http://www.gnu.org/licenses/>
17//
18
19#ifndef _TUBEELEMENT_H
20#define _TUBEELEMENT_H
21
22#include <Element.h>
23#include <GL/glu.h>
24#include <GLHelpers.h>
25
26namespace RZ {
27 class TranslatedFrame;
28 class RotatedFrame;
29
30 class TubeElement : public Element {
31 TranslatedFrame *m_sides[3]; // Top, middle, bottom
32 RotatedFrame *m_rotatedSides[3]; // Top, middle, bottom
33
34 Real m_cachedLength = 5e-2;
35 Real m_cachedOuterDiameter = 3e-3;
36 Real m_cachedInnerDiameter = 1.5e-3;
37
38 GLTube m_tube;
39
40 void recalcBoundingBox();
41 void initSides();
42
43 protected:
44 virtual bool propertyChanged(std::string const &, PropertyValue const &) override;
45
46 public:
49 std::string const &,
51 Element *parent = nullptr);
52
53 virtual ~TubeElement() override;
54 virtual void renderOpenGL() override;
55 };
56
57 RZ_DECLARE_ELEMENT(TubeElement);
58}
59
60#endif // _TUBEELEMENT_H
Definition: Element.h:393
Definition: Element.h:173
Definition: GLHelpers.h:225
Definition: Element.h:58
Definition: ReferenceFrame.h:59
Definition: RotatedFrame.h:25
Definition: TranslatedFrame.h:25
Definition: TubeElement.h:30