Revert dumb composite for GDML

This commit is contained in:
Alexander Nozik 2021-09-11 18:50:59 +03:00
parent d131dc49ab
commit 42eb0a6f66
2 changed files with 4 additions and 2 deletions

View File

@ -215,7 +215,7 @@ private class GdmlLoader(val settings: GdmlLoaderOptions) {
val first: GdmlSolid = solid.first.resolve(root) ?: error("")
val second: GdmlSolid = solid.second.resolve(root) ?: error("")
val type: CompositeType = when (solid) {
is GdmlUnion -> CompositeType.GROUP // dumb sum for better performance
is GdmlUnion -> CompositeType.UNION // dumb sum for better performance
is GdmlSubtraction -> CompositeType.SUBTRACT
is GdmlIntersection -> CompositeType.INTERSECT
}

View File

@ -32,7 +32,9 @@ public inline fun VisionContainerBuilder<Solid>.composite(
): Composite {
val group = SolidGroup().apply(builder)
val children = group.children.values.filterIsInstance<Solid>()
if (children.size != 2) error("Composite requires exactly two children, but found ${children.size}")
if (children.size != 2){
error("Composite requires exactly two children, but found ${children.size}")
}
val res = Composite(type, children[0], children[1])
res.meta.update(group.meta)