Program Listing for File LoopConstraintCutJoint.h#
↰ Return to documentation for file (include/Karana/SOADyn/LoopConstraintCutJoint.h)
/*
*Copyright(c)2024-2026KaranaDynamicsPtyLtd.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/SOADyn/FramePairHinge.h"
#include"Karana/SOADyn/LoopConstraintBase.h"
namespaceKarana::Dynamics{
classMultibody;
classHingePnode;
classConstraintNode;
classFramePairHinge;
classPhysicalBody;
classLoopConstraintCutJoint:publicLoopConstraintBase{
//foraccessto_sourceParentPnode
friendclassSubGraph;
//foraccessto_error_f2f
friendclassMultibody;
//foraccesstoresidualmethodsfortheTAalgorithm
friendclassAlgorithms;
//Foraccessto_cleanup_source.
friendclassPhysicalBody;
public:
staticconstkc::ks_ptr<LoopConstraintCutJoint>
create(std::string_viewname,
kc::ks_ptr<Multibody>&mb,
kc::ks_ptr<kf::FrameToFrame>constraint_f_to_f,
HingeBase::HingeTypehtype,
conststd::vector<SubhingeBase::SubhingeType>&subhinge_types=
std::vector<SubhingeBase::SubhingeType>());
LoopConstraintCutJoint(std::string_viewname,
kc::ks_ptr<Multibody>&mb,
kc::ks_ptr<kf::FrameToFrame>constraint_f_to_f,
HingeBase::HingeTypehtype,
conststd::vector<SubhingeBase::SubhingeType>&subhinge_types=
std::vector<SubhingeBase::SubhingeType>());
boolhasHinge()constoverride{returntrue;}
kc::ks_ptr<FramePairHinge>hinge()const{return_hinge;}
kc::ks_ptr<kf::FrameToFrame>errorFrameToFrame()const{return_error_f2f;}
voidspExternalForceFromT(constkm::Vec&T,boolno_accumulate=true);
km::VecposeError()constoverride;
km::SpatialVectorgetInterBodyForceTAFwdDyn();
statickc::ks_ptr<PhysicalHinge>toPhysicalHinge(kc::ks_ptr<LoopConstraintCutJoint>lc,
boolreverse);
size_tnResiduals()constoverride{return6-_hinge->nU();}
km::VecvelError()constoverride;
km::VecaccelError()constoverride;
protected:
km::Vec_accelResidual()constoverride;
void_updateInvDynT();
protected:
void_discard(kc::ks_ptr<Base>&base)override;
void_computeQMats(QMats&val)override;
km::SpatialVector_constraintSpForceTToTarget(constkm::Vec&T)const;
km::SpatialVector_constraintSpForceTToSource(constkm::SpatialVector&tgt_f)const;
km::Vec_poseResidual()constoverride;
km::Vec_velResidual()constoverride;
protected:
kc::ks_ptr<kf::FrameToFrame>_error_f2f;
std::optional<HingeBase::HingeType>_hinge_type=std::nullopt;
private:
kc::ks_ptr<FramePairHinge>_hinge=nullptr;
bool_cleanup_source=false;
};
}//namespaceKarana::Dynamics