Program Listing for File HingeBase.h

Program Listing for File HingeBase.h#

Return to documentation for file (include/Karana/SOADyn/HingeBase.h)

/*
*Copyright(c)2024-2025KaranaDynamicsPtyLtd.Allrightsreserved.
*
*NOTICETOUSER:
*
*Thissourcecodeand/ordocumentation(the"LicensedMaterials")is
*theconfidentialandproprietaryinformationofKaranaDynamicsInc.
*UseoftheseLicensedMaterialsisgovernedbythetermsandconditions
*ofaseparatesoftwarelicenseagreementbetweenKaranaDynamicsandthe
*Licensee("LicenseAgreement").Unlessexpresslypermittedunderthat
*agreement,anyreproduction,modification,distribution,ordisclosure
*oftheLicensedMaterials,inwholeorinpart,toanythirdparty
*withoutthepriorwrittenconsentofKaranaDynamicsisstrictlyprohibited.
*
*THELICENSEDMATERIALSAREPROVIDED"ASIS"WITHOUTWARRANTYOFANYKIND.
*KARANADYNAMICSDISCLAIMSALLWARRANTIES,EXPRESSORIMPLIED,INCLUDING
*BUTNOTLIMITEDTOWARRANTIESOFMERCHANTABILITY,NON-INFRINGEMENT,AND
*FITNESSFORAPARTICULARPURPOSE.
*
*INNOEVENTSHALLKARANADYNAMICSBELIABLEFORANYDAMAGESWHATSOEVER,
*INCLUDINGBUTNOTLIMITEDTOLOSSOFPROFITS,DATA,ORUSE,EVENIF
*ADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGES,WHETHERINCONTRACT,TORT,
*OROTHERWISEARISINGOUTOFORINCONNECTIONWITHTHELICENSEDMATERIALS.
*
*U.S.GovernmentEndUsers:TheLicensedMaterialsarea"commercialitem"
*asdefinedat48C.F.R.2.101,andareprovidedtotheU.S.Government
*onlyasacommercialenditemunderthetermsofthislicense.
*
*AnyuseoftheLicensedMaterialsinindividualorcommercialsoftwaremust
*include,intheuserdocumentationandinternalsourcecodecomments,
*thisNotice,Disclaimer,andU.S.GovernmentUseProvision.
*/


#pragmaonce

#include"Karana/KCore/RegistryList.h"
#include"Karana/Math/UnitQuaternion.h"
#include"Karana/SOADyn/SubhingeBase.h"

namespaceKarana::Dynamics{

namespacekc=Karana::Core;
namespacekm=Karana::Math;

classSubhingeBase;

classHingeBase{

//foraccessto_subhinges_usage_map
friendclassHingeOnode;
friendclassSubTree;

//foraccessto_subhinges_list
friendclassCompoundSubhinge;
friendclassCompoundBody;

public:
enumclassHingeType{
LOCKED,
PIN,
UJOINT,
GIMBAL,
BALL,
BALL_QUAT,
SLIDER,
PLANAR,
TRANSLATIONAL,
FULL6DOF,
//SubhingeBase::SubhingeType::SPHERICALsubhinge
CYLINDRICAL,
HELICAL,
HOOKE,
INLINE,
INPLANE,
PERPENDICULAR,
PARALLEL,
CUSTOM,
COMPOUND
};

staticstd::vector<SubhingeBase::SubhingeType>getSubhingeTypes(HingeBase::HingeTypehtype);

HingeBase(HingeBase::HingeTypehtype)
:_hinge_type(htype){}

virtualstd::string_viewtypeString()constnoexcept=0;

virtual~HingeBase(){};

virtualstd::string_viewname()const=0;

kc::ks_ptr<SubhingeBase>subhinge(size_tindex)const;

size_tnSubhinges()const{return_subhinges_list.size();}

constkc::RegistryList<SubhingeBase>&subhinges()const{return_subhinges_list;}

virtualkm::MatpframeCoordMapMatrix()const=0;

km::MatpframeCoordMapMatrixOrthoComplement()const;

km::MatoframeCoordMapMatrixOrthoComplement()const;

km::VecpframeCoordMapSingularValues()const;

size_tnU()const;

HingeTypehingeType()const{return_hinge_type;}

staticstd::stringhingeTypeString(HingeTypehtype);

constkc::ks_ptr<CoordData>&coordData()const{return_hinge_coord_data;}

public:
structHingeParams{
km::UnitQuaternioni_to_onode_q=km::UnitQuaternion(
0,0,0,1);
km::UnitQuaternionj_to_pnode_q=km::UnitQuaternion(
0,0,0,1);
km::Mataxes;
};

staticHingeParamsgetHookeHingeParams(constkm::UnitQuaternion&ij_q);

staticHingeParamsgetInlineHingeParams();

staticHingeParamsgetInplaneHingeParams();

staticHingeParamsgetPerpendicularHingeParams(constkm::UnitQuaternion&ij_q);

staticHingeParamsgetParallelHingeParams();

protected:
//thecoordinatemapmatrixacrossallsubhingesintheonodeframe
virtualkm::MatoframeCoordMapMatrix()const//NOLINT(readability-identifier-naming)
{
returnkm::Mat(0,0);
}

kc::RegistryList<SubhingeBase>_subhinges_list;

HingeType_hinge_type;

std::vector<SubhingeBase::SubhingeType>_subhinge_types;

kc::ks_ptr<CoordData>_hinge_coord_data=nullptr;
};

}//namespaceKarana::Dynamics