material.go 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2016 The G3N Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package physics
  5. type Material struct {
  6. name string
  7. friction float32
  8. restitution float32
  9. }
  10. type ContactMaterial struct {
  11. mat1 *Material
  12. mat2 *Material
  13. friction float32
  14. restitution float32
  15. contactEquationStiffness float32
  16. contactEquationRelaxation float32
  17. frictionEquationStiffness float32
  18. frictionEquationRelaxation float32
  19. }
  20. func NewContactMaterial() *ContactMaterial {
  21. cm := new(ContactMaterial)
  22. cm.friction = 0.3
  23. cm.restitution = 0.3
  24. cm.contactEquationStiffness = 1e7
  25. cm.contactEquationRelaxation = 3
  26. cm.frictionEquationStiffness = 1e7
  27. cm.frictionEquationRelaxation = 3
  28. return cm
  29. }
  30. //type intPair struct {
  31. // i int
  32. // j int
  33. //}
  34. //type ContactMaterialTable map[intPair]*ContactMaterial