Blue Brain BioExplorer
Curve.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  * Responsible Author: Jonas Karlsson <jonas.karlsson@epfl.ch>
5  *
6  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
7  *
8  * This library is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU Lesser General Public License version 3.0 as published
10  * by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
23 
25 
26 namespace core
27 {
28 enum class CurveType
29 {
30  flat = 0,
31  round = 1,
32  ribbon = 2
33 };
34 
35 enum class BaseType
36 {
37  linear = 0,
38  bezier = 1,
39  bspline = 2,
40  hermite = 3
41 };
42 
43 inline std::string baseTypeAsString(const BaseType baseType)
44 {
45  const strings values = {"linear", "bezier", "bspline", "hermite"};
46  return values[static_cast<size_t>(baseType)];
47 };
48 
49 inline std::string curveTypeAsString(const CurveType curveType)
50 {
51  const strings values = {"flat", "round", "ribbon"};
52  return values[static_cast<size_t>(curveType)];
53 };
54 
55 struct Curve
56 {
57  Curve(const CurveType curveType_in, const BaseType baseType_in, const Vector4fs& vertices_in,
58  const uint64_ts& indices_in, const Vector3fs& normals_in, const Vector3fs& tangents_in)
59  : curveType(curveType_in)
60  , baseType(baseType_in)
61  , vertices(vertices_in)
62  , indices(indices_in)
63  , normals(normals_in)
64  , tangents(tangents_in)
65  {
66  }
67 
68  // Curve type: falt, round, ribbon
70 
71  // Base type: linear, bezier, bspline, hermite
73 
74  // Vertices
76 
77  // Indices
79 
80  // Normals (for ribbon curves)
82 
83  // Tangents (for hermite curves)
85 };
86 } // namespace core
std::vector< Vector4f > Vector4fs
Definition: MathTypes.h:140
BaseType
Definition: Curve.h:36
CurveType
Definition: Curve.h:29
std::string baseTypeAsString(const BaseType baseType)
Definition: Curve.h:43
std::string curveTypeAsString(const CurveType curveType)
Definition: Curve.h:49
std::vector< Vector3f > Vector3fs
Definition: MathTypes.h:139
std::vector< std::string > strings
Definition: Types.h:44
std::vector< uint64_t > uint64_ts
Definition: Types.h:55
uint64_ts indices
Definition: Curve.h:78
BaseType baseType
Definition: Curve.h:72
Vector3fs tangents
Definition: Curve.h:84
Curve(const CurveType curveType_in, const BaseType baseType_in, const Vector4fs &vertices_in, const uint64_ts &indices_in, const Vector3fs &normals_in, const Vector3fs &tangents_in)
Definition: Curve.h:57
Vector3fs normals
Definition: Curve.h:81
Vector4fs vertices
Definition: Curve.h:75
CurveType curveType
Definition: Curve.h:69