Program Listing for File HuntCrossley.h

Program Listing for File HuntCrossley.h#

Return to documentation for file (include/Karana/Collision/HuntCrossley.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/Collision/ContactForce.h"
#include"Karana/Frame/ChainedFrameToFrame.h"

namespaceKarana::Collision{

classHuntCrossley:publicContactForceBase{
public:
usingContactForceBase::ContactForceBase;

statickc::ks_ptr<HuntCrossley>create(std::string_viewname);

km::SpatialVectorcomputeForce(constFrameContact&contact,
constkc::ks_ptr<kd::Node>&nd_1,
constkc::ks_ptr<kd::Node>&nd_2)final;

structHuntCrossleyParams{
doublekp=km::notReadyNaN;

doublekc=km::notReadyNaN;

doublen=km::notReadyNaN;

doublemu=km::notReadyNaN;

doublelinear_region_tol=km::notReadyNaN;
};

structHuntCrossleyScratch{
doublepenetration=km::notReadyNaN;

km::Vec3linvel;

km::Vec3f;
};

HuntCrossleyParamsparams;

HuntCrossleyScratchscratch;

boolisReady()constfinal;

std::string
dumpString(std::string_viewprefix,
constKarana::Core::Base::DumpOptions*options=nullptr)constoverride;

private:
double_getHuntCrossleyNormalForce(constKarana::Math::Vec3&fext_dir)const;

Karana::Math::Vec3_getCoulombFrictionTangentForce(constKarana::Math::Vec3&fext_dir,
doublenormal_fmag)const;
};
}//namespaceKarana::Collision