![]() |
Trax3 3.1.0
trax track library
|
Since Curves maintain no direct notion of what is to be an up direction (see Curves), with the RoadwayTwist we introduced an additional rotation around the Curve's tangent axis T. This will rotate the TNB frame returned by a track relative to the Curve's TNB frame. E.g., there is a DirectionalTwist that would rotate the frame in a way that the B vector as returned by the track would have the most minimal angle with an DirectionalTwist::Attractor() axis. If the attractor would be the world's up direction, that would bring the track's B vector to be something that looks quite reasonable like an upside for the track. With a CombinedTwist such a DirectionalTwist can be combined with e.g. a LinearTwist, so that the rotations of the latter would count from this up direction.
A track has always a RoadwayTwist, which would be the ConstantTwist with a zero angle; on detaching a twist from the track that default twist gets automatically reattached to it.
A twist is unique to a track, it can not be shared between tracks.
If a track is flipped, i.e. front and end are exchanged, a twist might change its charakteristics. E.g. a LinearTwist that runs from 0_deg to 90_deg would revert to go from -90_deg to 0_deg, to keep the geomery of the track.
If on a curve the curvature becomes zero at one point, this might be a location where the Curve's TNB frame flips around by 180_deg all of a sudden, since the main curvature transitions through zero to the other side (one might say it becomes negative, but curvature is always positive; the N vector flips and with it the B vector). These cases are counterbalanced by the twist by adding a 180_deg rotation at each such point automaticly.
To make a track's B vector rotate from 0_deg to 7_deg around T with respect to the world's trax::Up during the course of the track:
Do also look at the tests in the test suit for further examples.