RayZaler 0.1
The free opto-mechanical simulation framework
SurfaceShape.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 _GENERIC_APERTURE_H
20#define _GENERIC_APERTURE_H
21
22#include "Vector.h"
23#include "ReferenceFrame.h"
24#include <Random.h>
25#include <vector>
26
27#define GENERIC_APERTURE_NUM_SEGMENTS 36
28#define GENERIC_APERTURE_NUM_GRIDLINES 13
29
30namespace RZ {
32 ExprRandomState m_state;
33 std::vector<std::vector<Real>> m_emptyEdges;
34 bool m_complementary = false;
35
36 public:
37 virtual ~SurfaceShape();
38
39 inline ExprRandomState &
40 randState()
41 {
42 return m_state;
43 }
44
45 inline void
46 setComplementary(bool comp) {
47 m_complementary = comp;
48 }
49
50 inline bool
51 complementary() const {
52 return m_complementary;
53 }
54
55 inline bool
56 intercept(Vec3 &hit) const
57 {
58 Vec3 ignore;
59 Real tIgnore = 0;
60 return intercept(hit, ignore, tIgnore, Vec3::zero(), hit);
61 }
62
63 virtual Real area() const = 0;
64 virtual std::string name() const = 0;
65 virtual bool intercept(
66 Vec3 &hit,
67 Vec3 &normal,
68 Real &dT,
69 Vec3 const &origin,
70 Vec3 const &direction) const = 0;
71
72 virtual void generatePoints(
73 const ReferenceFrame *,
74 Real *pointArr,
75 Real *normals,
76 unsigned int N) = 0;
77
78 virtual std::vector<std::vector<Real>> const &edges() const;
79 virtual void renderOpenGL();
80
81 };
82}
83
84#endif // _GENERIC_APERTURE_H
Definition: Random.h:28
Definition: ReferenceFrame.h:59
Definition: SurfaceShape.h:31
Definition: Vector.h:66