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/KCore/UsageTrackingMap.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:
enumclassHINGE_TYPE{
LOCKED,
PIN,
UJOINT,
GIMBAL,
BALL,
BALL_QUAT,
SLIDER,
PLANAR,
TRANSLATIONAL,
FULL6DOF,
//SubhingeBase::SUBHINGE_TYPE::SPHERICALsubhinge
CYLINDRICAL,
HELICAL,
HOOKE,
INLINE,
INPLANE,
PERPENDICULAR,
PARALLEL,
CUSTOM,
COMPOUND
};

staticstd::vector<SubhingeBase::SUBHINGE_TYPE>
getSubhingeTypes(HingeBase::HINGE_TYPEhtype);

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

virtualconststd::string&typeString()constnoexcept=0;

virtual~HingeBase(){};

virtualconststd::string&name()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;

HINGE_TYPEhingeType()const{return_hinge_type;}

staticstd::stringhingeTypeString(HINGE_TYPEhtype);

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

public:
structHingeParams{
km::UnitQuaternioni2onode_q=
km::UnitQuaternion(0,0,0,1);
km::UnitQuaternionj2pnode_q=
km::UnitQuaternion(0,0,0,1);
km::Mataxes;
};

staticHingeParamsgetHookeHingeParams(constkm::UnitQuaternion&ij_q);

staticHingeParamsgetInlineHingeParams();

staticHingeParamsgetInplaneHingeParams();

staticHingeParamsgetPerpendicularHingeParams(constkm::UnitQuaternion&ij_q);

staticHingeParamsgetParallelHingeParams();

protected:
//TODO-fixforthelongterm
virtualkm::MatoframeCoordMapMatrix()const{returnkm::Mat(0,0);}

kc::RegistryList<SubhingeBase>_subhinges_list;

HINGE_TYPE_hinge_type;

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

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

}//namespaceKarana::Dynamics