material.go 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 implements a basic physics engine.
  5. package material
  6. type Material struct {
  7. name string
  8. friction float32
  9. restitution float32
  10. }
  11. type ContactMaterial struct {
  12. mat1 *Material
  13. mat2 *Material
  14. friction float32
  15. restitution float32
  16. contactEquationStiffness float32
  17. contactEquationRelaxation float32
  18. frictionEquationStiffness float32
  19. frictionEquationRelaxation float32
  20. }
  21. func NewContactMaterial() *ContactMaterial {
  22. cm := new(ContactMaterial)
  23. cm.friction = 0.3
  24. cm.restitution = 0.3
  25. cm.contactEquationStiffness = 1e7
  26. cm.contactEquationRelaxation = 3
  27. cm.frictionEquationStiffness = 1e7
  28. cm.frictionEquationRelaxation = 3
  29. return cm
  30. }
  31. //type intPair struct {
  32. // i int
  33. // j int
  34. //}
  35. //type ContactMaterialTable map[intPair]*ContactMaterial