Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
spat::Frame< Valtype, ValtypeT > Struct Template Reference

A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordinate cross of vectors. More...

#include <C:/Trend/Development/Trax3/Code/spat/Frame.h>

Inheritance diagram for spat::Frame< Valtype, ValtypeT >:

Public Member Functions

Valtype * ptr () noexcept
 Pointer accessor for direct copying.
const Valtype * ptr () const noexcept
 Pointer accessor for direct copying.
FrameInit (const VectorBundle< Valtype, ValtypeT > &vb, const Vector< ValtypeT > &up) noexcept
 Initializes the Frame structure to vb and calculates nor as to be orthogonal to up.
FrameInit (const VectorBundle2< Valtype, ValtypeT > &vb2) noexcept
 Initializes the Frame structure.
FrameNormalize () noexcept
 Makes the vectors unit vectors.
FrameOrthoNormalize () noexcept
 Normalizes the vectors preserving the direction of T as is. It then adjusts Nor and Bin in a way to form an orthogonal frame.
bool IsOrthoNormal (ValtypeT epsilon_length=2 *std::numeric_limits< ValtypeT >::epsilon(), ValtypeT epsilon_angle=2 *std::numeric_limits< ValtypeT >::epsilon()) const noexcept
FrameTransportTo (Valtype d) noexcept
 Moves the Frame by d in direction T.
FrameTransportBy (const Vector< Valtype > &v) noexcept
 Moves the Frame by v.
FrameTransportTo (const Position< Valtype > &p) noexcept
 Transport this Frame to p.
FrameTransportTan (Valtype d) noexcept
 Moves the Frame by d in direction T.
FrameTransportNor (Valtype d) noexcept
 Moves the Frame by d in direction N.
FrameTransportBin (Valtype d) noexcept
 Moves the Frame by d in direction B.
FrameFlipTan () noexcept
 Rotates the Frame by pi around T.
FrameFlipNor () noexcept
 Rotates the Frame by pi around N.
FrameFlipBin () noexcept
 Rotates the Frame by pi around B.
FrameRotate (const Vector< ValtypeT > &nr, ValtypeT angle) noexcept
 Rotate the vectors around nr with angle in radiants.
FrameRotate (const Vector< ValtypeT > &r) noexcept
 Rotate the vectors around r with angle r.Length() in radiants.
template<typename Valtype2>
FrameRotate (const VectorBundle< Valtype, Valtype2 > &axis) noexcept
 Rotates the frame by axis (length of axis.T make angle in radiants).
template<typename Valtype2>
FrameRotate (const VectorBundle< Valtype, Valtype2 > &axis, Valtype2 angle) noexcept
 Rotates the frame by axis and angle in radiants.
FrameRotateTan (ValtypeT angle) noexcept
 Rotates the vectors around the tan vector (roll).
FrameRotateTan (const Vector< ValtypeT > &up) noexcept
 Brings B as close as possible to up by rotating around T.
FrameRotateNor (ValtypeT angle) noexcept
 Rotates the vectors around the nor vector (-pitch).
FrameRotateBin (ValtypeT angle) noexcept
 Rotates the vectors around the bin vector (-yaw).
constexpr bool Equals (const Frame &frame, Valtype epsilon_length=std::numeric_limits< Valtype >::epsilon(), ValtypeT epsilon_lengthT=std::numeric_limits< ValtypeT >::epsilon()) const noexcept
 Comparison within some ranges.
FrameRound (int toDigit) noexcept
 Rounds the frames position and vectors to a certain digit after the point.
template<typename Valtype2>
Frame< Valtype, ValtypeT > & operator= (const Matrix< Valtype2, 4, 4 > &trans) noexcept
template<typename Valtype2>
Frame< Valtype, ValtypeT > & operator= (const Valtype2 *pVal) noexcept
template<typename Valtype2>
Frame< Valtype, ValtypeT > & Rotate (const VectorBundle< Valtype, Valtype2 > &axis) noexcept
template<typename Valtype2>
Frame< Valtype, ValtypeT > & Rotate (const VectorBundle< Valtype, Valtype2 > &axis, Valtype2 angle) noexcept
Construction
Parameters
vb2VectorBundle2 object giving the P,T,N part; B gets computed.
vbVectorBundle object giving the P,T part; N and B get computed.
upUp direction. N gets calculated so that it is perpendicular to this.
posPosition object giving the P part.
tanVector object giving the T part.
norVector object giving the N part.
binVector object giving the B part.
rotRotation object giving the T,N and B part.
transTransformation object. Compute the Frame so that it is the frame of reference corresponding to the transformation.
pHTransPointer to homogenuous transformation matrix. The first three columns of the transformation matrix are the transformed global axis vectors. The position is the transformed homogen origin (0,0,0,1).
constexpr Frame () noexcept=default
 Does not initialize the members.
constexpr Frame (Valtype px, Valtype py, Valtype pz, ValtypeT tx, ValtypeT ty, ValtypeT tz, ValtypeT nx, ValtypeT ny, ValtypeT nz, ValtypeT bx, ValtypeT by, ValtypeT bz) noexcept
 Does not initialize the members.
constexpr Frame (const VectorBundle2< Valtype, ValtypeT > &vb2) noexcept
 Does not initialize the members.
 Frame (const VectorBundle< Valtype, ValtypeT > &vb, const Vector< ValtypeT > &up) noexcept
 Does not initialize the members.
constexpr Frame (const Position< Valtype > &pos) noexcept
 Does not initialize the members.
constexpr Frame (const Position< Valtype > &pos, const Vector< ValtypeT > &tan, const Vector< ValtypeT > &nor, const Vector< ValtypeT > &bin) noexcept
 Does not initialize the members.
 Frame (const Position< Valtype > &pos, const Rotation< ValtypeT > &rot) noexcept
 Does not initialize the members.
 Frame (const Rotation< ValtypeT > &rot) noexcept
 Does not initialize the members.
template<typename Valtype2>
 Frame (const Matrix< Valtype2, 4, 4 > &trans) noexcept
 Does not initialize the members.
template<typename Valtype2>
 Frame (const Valtype2 *pVal) noexcept
 Does not initialize the members.
Assignment
Parameters
vb2VectorBundle2 object giving the P,T,N part; B gets computed.
rotRotation object giving the T,N and B part.
transTransformation object. Compute the Frame so that it is the frame of reference corresponding to the transformation.
Frameoperator= (const VectorBundle2< Valtype, ValtypeT > &vb2) noexcept
Frameoperator= (const Rotation< ValtypeT > &rot) noexcept
template<typename Valtype2>
Frameoperator= (const Matrix< Valtype2, 4, 4 > &trans) noexcept
template<typename Valtype2>
Frameoperator= (const Valtype2 *pVal) noexcept
Implicit conversion
Returns
A Vector2 bundle with the P, T and N values.
 operator VectorBundle2< Valtype, ValtypeT > () const noexcept
 operator VectorBundle< Valtype, ValtypeT > () const noexcept
FrameInit () noexcept
 Initializes the Frame structure to position (or zero) and the vectors to standard right-handed orthogonal unit vector system.
FrameInit (const Position< Valtype > &pos) noexcept
 Initializes the Frame structure to position (or zero) and the vectors to standard right-handed orthogonal unit vector system.
LookAt

Rotate the Frame so that a reference vector points along dir.

Returns
A reference to this object. Frame& Invert();
Parameters
dirDirection to point to.
referenceThe vector formulated in the frame reference, that is supposed to point in the direction of dir
upDirection to bring B to by a final rotation.
FrameLookAt (const Vector< ValtypeT > &reference, const Vector< ValtypeT > &dir) noexcept
FrameLookTAt (const Vector< ValtypeT > &dir) noexcept
FrameLookTAt (const Vector< ValtypeT > &dir, const Vector< ValtypeT > &up) noexcept
FrameLookNAt (const Vector< ValtypeT > &dir) noexcept
FrameLookBAt (const Vector< ValtypeT > &dir) noexcept
AircraftPrincipalAxes

Calculate the vectors as orthonormal vectors from Yaw, Pitch and Roll.

The angles used in aviation refer to a right handed coordinate system and rotate Yaw, Pitch and Roll in the order of Z, Y, and X following a right handed orientation rule. Note that in order to keep the Pitch positive on upward rotation, aeroplanes are typically oriented with the Z-axis down in the frame.

Parameters
yawThe Yaw angle (rotation around Z).
pitchThe Pitch angle (rotation around rotated Y).
rollThe Roll angle (rotation around rotated X).
epsilonIf T is epsilon-close to Ez, the yaw will be zero and Pitch +- pi/2.
Returns
Yaw, Pitch, Roll in a Position struct.
FrameAircraftPrincipalAxes (ValtypeT yaw, ValtypeT pitch, ValtypeT roll)
FrameAircraftPrincipalAxes (const Position< ValtypeT > &angles)
Position< ValtypeT > AircraftPrincipalAxes (ValtypeT epsilon=std::numeric_limits< ValtypeT >::epsilon()) const
Transformations to parent frame.

Transformation to the coordinate system in wich this Frame is formulated.

The coordinates are understood to be formulated relative to this Frame and get calculated to be formulated to the base Frame.

template<typename Valtype2>
Position< Valtype2 > & ToParent (Position< Valtype2 > &p) const noexcept
template<typename Valtype2>
Vector< Valtype2 > & ToParent (Vector< Valtype2 > &v) const noexcept
template<typename Valtype2>
Vector< Valtype2 > & NormalToParent (Vector< Valtype2 > &normal) const noexcept
template<typename Valtype2, typename ValtypeT2>
VectorBundle< Valtype2, ValtypeT2 > & ToParent (VectorBundle< Valtype2, ValtypeT2 > &v) const noexcept
template<typename Valtype2, typename ValtypeT2>
VectorBundle2< Valtype2, ValtypeT2 > & ToParent (VectorBundle2< Valtype2, ValtypeT2 > &v) const noexcept
template<typename Valtype2, typename ValtypeT2>
Frame< Valtype2, ValtypeT2 > & ToParent (Frame< Valtype2, ValtypeT2 > &frame) const noexcept
template<typename Valtype2>
Box< Valtype2 > & ToParent (Box< Valtype2 > &box) const noexcept
template<typename Valtype2>
Sphere< Valtype2 > & ToParent (Sphere< Valtype2 > &sphere) const noexcept
Transformations from parent frame.

Transformation from the coordinate system in wich this Frame is formulated.

The coordinates are understood to be formulated relative to the parent Frame and get calculated to be formulated relative to this Frame.

template<typename Valtype2>
Position< Valtype2 > & FromParent (Position< Valtype2 > &p) const noexcept
template<typename Valtype2>
Vector< Valtype2 > & FromParent (Vector< Valtype2 > &v) const noexcept
template<typename Valtype2, typename ValtypeT2>
VectorBundle< Valtype2, ValtypeT2 > & FromParent (VectorBundle< Valtype2, ValtypeT2 > &b) const noexcept
template<typename Valtype2, typename ValtypeT2>
VectorBundle2< Valtype2, ValtypeT2 > & FromParent (VectorBundle2< Valtype2, ValtypeT2 > &b) const noexcept
template<typename Valtype2, typename ValtypeT2>
Frame< Valtype2, ValtypeT2 > & FromParent (Frame< Valtype2, ValtypeT2 > &frame) const noexcept

Public Attributes

Position< Valtype > P
 Point in 3D space.
Vector< ValtypeT > T
 Tangential axis or x-axis.
Vector< ValtypeT > N
 Normal axis or y-axis.
Vector< ValtypeT > B
 Binormal axis or z-axis.

Detailed Description

template<typename Valtype, typename ValtypeT = Valtype>
struct spat::Frame< Valtype, ValtypeT >

A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordinate cross of vectors.

These axes normaly are used right handed. If tan points in the direction of the thump of the right hand and the index finger points along the nor vector, then bin points along the middle finger.

Member Function Documentation

◆ Equals()

template<typename Valtype, typename ValtypeT>
bool spat::Frame< Valtype, ValtypeT >::Equals ( const Frame< Valtype, ValtypeT > & frame,
Valtype epsilon_length = std::numeric_limits<Valtype>::epsilon(),
ValtypeT epsilon_lengthT = std::numeric_limits<ValtypeT>::epsilon() ) const
inlineconstexprnoexcept

Comparison within some ranges.

The area within two positions regarded as equal is a sphere with radius epsilon_length; the absolute difference of two vectors will at most be epsilon_lengthT. If the two vectors are both unit vectors, the actual difference between them will be sin(a) with a being the rotational angle. This makes a small enough epsilon_lengthT a limit in rotational angle.

Parameters
frameFrame to compare with.
epsilon_lengthepsilon distance <= which two positions are regarded as equal.
epsilon_lengthTepsilon for the Vectors of the Frames.

◆ Init() [1/2]

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::Init ( const VectorBundle2< Valtype, ValtypeT > & vb2)
inlinenoexcept

Initializes the Frame structure.

Parameters
vb2VectorBundle2 object giving the P,T,N part; B gets computed.

◆ Init() [2/2]

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::Init ( const VectorBundle< Valtype, ValtypeT > & vb,
const Vector< ValtypeT > & up )
inlinenoexcept

Initializes the Frame structure to vb and calculates nor as to be orthogonal to up.

Parameters
vbValues for pos and tan.
upVector pointing in up direction.

◆ IsOrthoNormal()

template<typename Valtype, typename ValtypeT>
bool spat::Frame< Valtype, ValtypeT >::IsOrthoNormal ( ValtypeT epsilon_length = 2*std::numeric_limits<ValtypeT>::epsilon(),
ValtypeT epsilon_angle = 2*std::numeric_limits<ValtypeT>::epsilon() ) const
inlinenoexcept
Parameters
epsilon_lengthMargin for deviation.
epsilon_angleMargin for deviation.
Returns
true if the Frame forms an orthonormal frameset.

◆ Rotate() [1/2]

template<typename Valtype, typename ValtypeT = Valtype>
template<typename Valtype2>
Frame & spat::Frame< Valtype, ValtypeT >::Rotate ( const VectorBundle< Valtype, Valtype2 > & axis)
noexcept

Rotates the frame by axis (length of axis.T make angle in radiants).

Template Parameters
Valtype2template parameter of axis.T
Parameters
axisrotation axis

◆ Rotate() [2/2]

template<typename Valtype, typename ValtypeT = Valtype>
template<typename Valtype2>
Frame & spat::Frame< Valtype, ValtypeT >::Rotate ( const VectorBundle< Valtype, Valtype2 > & axis,
Valtype2 angle )
noexcept

Rotates the frame by axis and angle in radiants.

Template Parameters
Valtype2template parameter of axis.T and angle
Parameters
axisrotation axis
anglerotation angle in radiants

◆ RotateBin()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::RotateBin ( ValtypeT angle)
inlinenoexcept

Rotates the vectors around the bin vector (-yaw).

Parameters
anglerotation angle in radiants

◆ RotateNor()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::RotateNor ( ValtypeT angle)
inlinenoexcept

Rotates the vectors around the nor vector (-pitch).

Parameters
anglerotation angle in radiants

◆ RotateTan()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::RotateTan ( ValtypeT angle)
inlinenoexcept

Rotates the vectors around the tan vector (roll).

Parameters
anglerotation angle in radiants

◆ TransportBin()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::TransportBin ( Valtype d)
inlinenoexcept

Moves the Frame by d in direction B.

Parameters
dDistance to move along B.

◆ TransportBy()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::TransportBy ( const Vector< Valtype > & v)
inlinenoexcept

Moves the Frame by v.

Parameters
vVector formulated in parent Frame, giving the distance to move P

◆ TransportNor()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::TransportNor ( Valtype d)
inlinenoexcept

Moves the Frame by d in direction N.

Parameters
dDistance to move along N.

◆ TransportTan()

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::TransportTan ( Valtype d)
inlinenoexcept

Moves the Frame by d in direction T.

Parameters
dDistance to move along T.

◆ TransportTo() [1/2]

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::TransportTo ( const Position< Valtype > & p)
inlinenoexcept

Transport this Frame to p.

Parameters
pa point in space formulated with respect to this Frame.

◆ TransportTo() [2/2]

template<typename Valtype, typename ValtypeT>
Frame< Valtype, ValtypeT > & spat::Frame< Valtype, ValtypeT >::TransportTo ( Valtype d)
inlinenoexcept

Moves the Frame by d in direction T.

Parameters
dDistance to move along T.

The documentation for this struct was generated from the following file:
  • C:/Trend/Development/Trax3/Code/spat/Frame.h