Visual Computing Library  devel
Loading...
Searching...
No Matches
vcl::comp::Tangent< P, ParentElemType, OPT > Class Template Reference

The Tangent class represents a N-Dimensional tangent vector that will be part of an Element (e.g. Vertex, Face...). More...

#include <vclib/mesh/components/tangent.h>

Inheritance diagram for vcl::comp::Tangent< P, ParentElemType, OPT >:

Public Types

using TangentType = P
 Expose the type of the Tangent.
 

Public Member Functions

bitangent () const
 Computes and returns the bitangent vector using the tangent and normal vectors.
 
 Tangent ()
 Initilizes the Tangent to (0, 0, 0) right handed.
 
P & tangent ()
 Returns a reference of the tangent of the element.
 
const P & tangent () const
 Returns a const reference of the tangent of the element.
 
booltangentRightHanded ()
 Returns a reference to the boolean that indicates if the tangent is right handed.
 
bool tangentRightHanded () const
 Returns true if the tangent is right handed, false otherwise.
 

Protected Member Functions

void deserialize (std::istream &is)
 
template<typename Element >
void importFrom (const Element &e, bool=true)
 
void serialize (std::ostream &os) const
 

Private Types

using Base = Component< Tangent< P, ParentElemType, OPT >, CompId::TANGENT, std::pair< P, bool >, ParentElemType, !std::is_same_v< ParentElemType, void >, OPT >
 

Private Member Functions

void init ()
 Initializes the tangent to (0, 0, 0) right handed.
 

Detailed Description

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
class vcl::comp::Tangent< P, ParentElemType, OPT >

The Tangent class represents a N-Dimensional tangent vector that will be part of an Element (e.g. Vertex, Face...).

Allows to get and set objects that represent a tangent. The type of these object must satisfy the PointConcept.

For example, if you have a Vertex Element v with the Tangent component, you'll be able to access to this component member functions from v:

auto tn = v.tangent();
A class representing a box in N-dimensional space.
Definition box.h:46
Template Parameters
PThe type of the tangent. This template argument must be a type that satisfies the PointConcept.
ParentElemTypeThis template argument must be void if the component needs to be stored horizontally, or the type of the parent element that will contain this component if the component needs to be stored vertically.
OPTIf true, the component will be optional. This argument is considered only if the component is stored vertically.

Member Function Documentation

◆ bitangent()

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
P vcl::comp::Tangent< P, ParentElemType, OPT >::bitangent ( ) const
inline

Computes and returns the bitangent vector using the tangent and normal vectors.

The bitangent is computed as the cross product between the tangent and the normal vectors. The direction of the bitangent depends on the handedness of the tangent.

Exceptions
vcl::MissingComponentExceptionif the Normal component is not enabled on the parent element.
Returns
The computed bitangent vector.

◆ init()

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
void vcl::comp::Tangent< P, ParentElemType, OPT >::init ( )
inlineprivate

Initializes the tangent to (0, 0, 0) right handed.

It is made in the init function since the component could be not available during construction (e.g. if the component is optional and not enabled).

This member function is hidden by the element that inherits this class.

◆ tangent() [1/2]

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
P & vcl::comp::Tangent< P, ParentElemType, OPT >::tangent ( )
inline

Returns a reference of the tangent of the element.

Returns
a reference of the tangent of the element.

◆ tangent() [2/2]

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
const P & vcl::comp::Tangent< P, ParentElemType, OPT >::tangent ( ) const
inline

Returns a const reference of the tangent of the element.

Returns
a const reference of the tangent of the element.

◆ tangentRightHanded() [1/2]

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
bool & vcl::comp::Tangent< P, ParentElemType, OPT >::tangentRightHanded ( )
inline

Returns a reference to the boolean that indicates if the tangent is right handed.

Returns
a reference to the boolean that indicates if the tangent is right handed.

◆ tangentRightHanded() [2/2]

template<PointConcept P, typename ParentElemType = void, bool OPT = false>
bool vcl::comp::Tangent< P, ParentElemType, OPT >::tangentRightHanded ( ) const
inline

Returns true if the tangent is right handed, false otherwise.

Returns
true if the tangent is right handed, false otherwise.

The documentation for this class was generated from the following file: