MCPcopy
hub / github.com/fogleman/ln / PartitionScore

Method PartitionScore

ln/tree.go:93–110  ·  view source on GitHub ↗
(axis Axis, point float64)

Source from the content-addressed store, hash-verified

91}
92
93func (node *Node) PartitionScore(axis Axis, point float64) int {
94 left, right := 0, 0
95 for _, shape := range node.Shapes {
96 box := shape.BoundingBox()
97 l, r := box.Partition(axis, point)
98 if l {
99 left++
100 }
101 if r {
102 right++
103 }
104 }
105 if left >= right {
106 return left
107 } else {
108 return right
109 }
110}
111
112func (node *Node) Partition(size int, axis Axis, point float64) (left, right []Shape) {
113 left = make([]Shape, 0, size)

Callers 1

SplitMethod · 0.95

Calls 2

BoundingBoxMethod · 0.65
PartitionMethod · 0.45

Tested by

no test coverage detected