Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
TrackData.h
1// trax track library
2// AD 2013
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
9// Copyright (c) 2019 Marc-Michael Horstmann
10//
11// Permission is hereby granted to any person obtaining a copy of this software
12// and associated source code (the "Software"), to use, view, and study the
13// Software for personal or internal business purposes, subject to the following
14// conditions:
15//
16// 1. Redistribution, modification, sublicensing, or commercial use of the
17// Software is NOT permitted without prior written consent from the copyright
18// holder.
19//
20// 2. The Software is provided "AS IS", without warranty of any kind, express
21// or implied.
22//
23// 3. All copies of the Software must retain this license notice.
24//
25// For further information, please contact: horstmann.marc@trendverlag.de
26
27#pragma once
28
29#include "spat/Frame.h"
30
31namespace trax{
32
33
35 template<typename Valtype>
36 struct TrackData{
39 Valtype c;
40 Valtype t;
41
42 TrackData()
43 : F{}, wF{}, c{0}, t{0}
44 {}
45 TrackData( const TrackData& ) = default;
46 TrackData( TrackData&& ) = default;
47 TrackData( spat::Frame<Valtype> _F, spat::Frame<Valtype> _wF, Valtype _c, Valtype _t )
48 : F{_F}, wF{_wF}, c{_c}, t{_t}
49 {}
50
51 TrackData& operator=( const TrackData& ) = default;
52 TrackData& operator=( TrackData&& ) = default;
53
54 template<typename Valtype2>
55 inline TrackData& operator=( const TrackData<Valtype2>& );
56
58 void Init() noexcept{
59 F.Init();
60 wF.Init();
61 c = 0;
62 t = 0;
63 }
64
70 virtual bool SetValues( const TrackData& td ) noexcept;
71
72 virtual ~TrackData() = default;
73 };
74
75
76template<typename Valtype>
77template<typename Valtype2>
78TrackData<Valtype>& TrackData<Valtype>::operator=( const TrackData<Valtype2>& td ){
79 F = spat::Frame<Valtype>{ td.F.ptr() };
80 wF = spat::Frame<Valtype>{ td.wF.ptr() };
81 c = static_cast<Valtype>(td.c);
82 t = static_cast<Valtype>(td.t);
83 return *this;
84}
85
86template<typename Valtype>
87bool TrackData<Valtype>::SetValues( const TrackData& td ) noexcept{
88 F = td.F;
89 wF = td.wF;
90 c = td.c;
91 t = td.t;
92 return true;
93}
94
95}
constexpr Real _t(Mass m) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1459
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordin...
Definition Frame.h:52
Full geometrical data at a point on a track.
Definition TrackData.h:36
void Init() noexcept
Initializes all values.
Definition TrackData.h:58
spat::Frame< Valtype > F
TNB Frame of the curve.
Definition TrackData.h:37
Valtype t
torsion
Definition TrackData.h:40
spat::Frame< Valtype > wF
twisted TNB Frame
Definition TrackData.h:38
Valtype c
curvature
Definition TrackData.h:39
virtual bool SetValues(const TrackData &td) noexcept
Sets the curve values for calculating the contraint.
Definition TrackData.h:87