Exemplo n.º 1
0
Arquivo: shape.go Projeto: toophy/vu
// Implements Shape.Inertia
func (s *sphere) Inertia(mass float64, inertia *lin.V3) *lin.V3 {
	elem := 0.4 * mass * s.R * s.R
	inertia.SetS(elem, elem, elem)
	return inertia
}
Exemplo n.º 2
0
Arquivo: shape.go Projeto: toophy/vu
// Implements Shape.Inertia
func (b *box) Inertia(mass float64, inertia *lin.V3) *lin.V3 {
	lx2, ly2, lz2 := 4.0*b.Hx*b.Hx, 4.0*b.Hy*b.Hy, 4.0*b.Hz*b.Hz
	inertia.SetS(mass/12.0*(ly2+lz2), mass/12.0*(lx2+lz2), mass/12.0*(lx2+ly2))
	return inertia
}