/// Collsion algorithm based on a paper of J. Shane Sui and John A. Hirshey II: /// "A New Analytical Tire Model for Vehicle Dynamic Analysis" presented at 2001 MSC User Meeting public static bool DiscTerrainCollisionEnvelope( ChTerrain terrain, ///< [in] reference to terrain system ChVector disc_center, ///< [in] global location of the disc center ChVector disc_normal, ///< [in] disc normal, expressed in the global frame double disc_radius, ///< [in] disc radius ChFunction_Recorder areaDep, ///< [in] lookup table to calculate depth from intersection area ref ChCoordsys contact, ///< [out] contact coordinate system (relative to the global frame) ref double depth ///< [out] penetration depth (positive if contact occurred) ) { return(false); }
public double m_stepsize; //< tire integration step size (if applicable) /// Utility function to construct a loopkup table for penetration depth as function of intersection area, /// for a given tire radius. The return map can be used in DiscTerrainCollisionEnvelope. public static void ConstructAreaDepthTable(double disc_radius, ref ChFunction_Recorder areaDep) { const UInt64 n_lookup = 90; double depMax = disc_radius; // should be high enough to avoid extrapolation double depStep = depMax / (double)(n_lookup - 1); for (UInt64 i = 0; i < n_lookup; i++) { double dep = depStep * (double)(i); double alpha = 2.0 * Math.Acos(1.0 - dep / disc_radius); double area = 0.5 * disc_radius * disc_radius * (alpha - Math.Sin(alpha)); areaDep.AddPoint(area, dep); } }