shapes-0.1.0.0: physics engine and other tools for 2D shapes

Safe HaskellNone
LanguageHaskell2010

Physics.Constraints.Contact

Description

Generate and solve all contact constraints for pairs of colliding objects.

Synopsis

Documentation

data ObjectFeatureKey k Source #

Indicates a specific pair of "features" on a specific pair of objects that are touching. This is how we check if we can reuse a cached solution from the previous frame. (We can reuse the cached solution if it has the same ObjectFeatureKey)

Constructors

ObjectFeatureKey 

Fields

  • _ofkObjKeys :: (k, k)

    (first shape's key, second shape's key)

  • _ofkFeatKeys :: (Int, Int)

    (first shape's feature's key, second shape's feature's key)

Instances

Unbox k => Vector Vector (ObjectFeatureKey k) Source # 
Unbox k => MVector MVector (ObjectFeatureKey k) Source # 
Eq k => Eq (ObjectFeatureKey k) Source # 
Ord k => Ord (ObjectFeatureKey k) Source # 
Show k => Show (ObjectFeatureKey k) Source # 
Generic (ObjectFeatureKey k) Source # 

Associated Types

type Rep (ObjectFeatureKey k) :: * -> * #

NFData k => NFData (ObjectFeatureKey k) Source # 

Methods

rnf :: ObjectFeatureKey k -> () #

Unbox k => Unbox (ObjectFeatureKey k) Source # 
data MVector s (ObjectFeatureKey k) Source # 
type Rep (ObjectFeatureKey k) Source # 
type Rep (ObjectFeatureKey k) = D1 * (MetaData "ObjectFeatureKey" "Physics.Constraints.Contact" "shapes-0.1.0.0-E6UUiYRpOc15rGTlEn6KOE" False) (C1 * (MetaCons "ObjectFeatureKey" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "_ofkObjKeys") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (k, k))) (S1 * (MetaSel (Just Symbol "_ofkFeatKeys") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Int, Int)))))
data Vector (ObjectFeatureKey k) Source # 

ofkObjKeys :: forall k k. Lens (ObjectFeatureKey k) (ObjectFeatureKey k) (k, k) (k, k) Source #

keyedContacts :: (k, k) -> (Shape, Shape) -> Descending (ObjectFeatureKey k, Flipping Contact') Source #

Calculate all contacts between a pair of shapes.

constraintGen :: ContactBehavior -> Double -> Flipping Contact' -> (PhysicalObj, PhysicalObj) -> ContactResult Constraint Source #

Build a constraint from a pair of shapes and a contact between them.

solutionProcessor Source #

Arguments

:: (Double, Double)

coefficients of friction for a pair of shapes (a, b)

-> ContactResult Lagrangian

cached solution

-> ContactResult Lagrangian

new incremental solution

-> Processed (ContactResult Lagrangian)
  1. incremental solution to actually apply, 2. new cached solution

Given an already-applied Lagrangian and the newly-calculated Lagrangian, figure out what portion of the newly-calculated Lagrangian should actually be applied.