예제 #1
0
func (segment *SegmentShape) Moment(mass float32) float32 {

	offset := vect.Mult(vect.Add(segment.A, segment.B), 0.5)

	return float32(mass) * (vect.DistSqr(segment.B, segment.A)/12.0 + vect.LengthSqr(offset))
}
예제 #2
0
func (circle *CircleShape) Moment(mass float32) float32 {
	return (float32(mass) * (0.5 * (circle.Radius * circle.Radius))) + vect.LengthSqr(circle.Position)
}