MCPcopy
hub / github.com/g3n/engine / SetFromCenterAndSize

Method SetFromCenterAndSize

math32/box3.go:54–61  ·  view source on GitHub ↗

SetFromCenterAndSize set this bounding box from a center point and size. Size is a vector from the minimum point to the maximum point. Returns pointer to this updated bounding box.

(center, size *Vector3)

Source from the content-addressed store, hash-verified

52// Size is a vector from the minimum point to the maximum point.
53// Returns pointer to this updated bounding box.
54func (b *Box3) SetFromCenterAndSize(center, size *Vector3) *Box3 {
55
56 v1 := NewVector3(0, 0, 0)
57 halfSize := v1.Copy(size).MultiplyScalar(0.5)
58 b.Min.Copy(center).Sub(halfSize)
59 b.Max.Copy(center).Add(halfSize)
60 return b
61}
62
63// Copy copy other to this bounding box.
64// Returns pointer to this updated bounding box.

Callers

nothing calls this directly

Calls 6

CopyMethod · 0.95
NewVector3Function · 0.85
MultiplyScalarMethod · 0.45
SubMethod · 0.45
CopyMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected