Unravel Engine C++ Reference
Loading...
Searching...
No Matches
helix_path.cpp
Go to the documentation of this file.
1#include "helix_path.hpp"
2
3using namespace generator;
4
5helix_path_t::helix_path_t(double radius, double size, int segments, double start, double sweep)
6 : parametric_path_{[radius, size, start, sweep](double t)
7 {
8 path_vertex_t vertex;
9 const double angle = start + t * sweep;
10 const double sine = std::sin(angle);
11 const double cosine = std::cos(angle);
12
13 vertex.position = gml::dvec3{radius * cosine, radius * sine, 2.0 * t * size - size};
14
15 vertex.tangent = gml::normalize(gml::dvec3{
16 -radius * sine,
17 radius * cosine,
18 2.0 * size / sweep,
19 });
20
21 vertex.normal = gml::dvec3{cosine, sine, 0.0};
22
23 vertex.tex_coord = t;
24
25 return vertex;
26 },
28{
29}
helix_path_t(double radius=1.0, double size=1.0, int segments=32, double start=0.0, double sweep=gml::radians(720.0))
Definition helix_path.cpp:5
const segment_list * segments