Celeritas 0.7.0-dev.149+develop.91f427834
|
Free functions to apply to a CSG tree. More...
Typedefs | |
using | celeritas::orangeinp::TransformedTree = std::pair< CsgTree, std::vector< NodeId > > |
Transformed CSG tree and mapping from the old one. | |
Functions | |
std::vector< NodeId > | celeritas::orangeinp::replace_and_simplify (CsgTree *tree, NodeId repl_key, Node repl_value) |
Replace the given node ID with the replacement node. | |
NodeId | celeritas::orangeinp::simplify_up (CsgTree *tree, NodeId start) |
Simplify all nodes in the tree starting with this one. | |
void | celeritas::orangeinp::simplify (CsgTree *tree, NodeId start) |
Iteratively simplify all nodes in the tree. | |
TransformedTree | celeritas::orangeinp::transform_negated_joins (CsgTree const &tree) |
Simplify negated joins using De Morgan's law. | |
std::string | celeritas::orangeinp::build_infix_string (CsgTree const &tree, NodeId n) |
Convert a node to an infix string expression. | |
std::vector< LocalSurfaceId > | celeritas::orangeinp::calc_surfaces (CsgTree const &tree) |
Construct the sorted set of all surfaces that are part of the tree. | |
Free functions to apply to a CSG tree.
using celeritas::orangeinp::TransformedTree = typedef std::pair<CsgTree, std::vector<NodeId> > |
Transformed CSG tree and mapping from the old one.
The new_nodes
member has the same size as the original tree, and is a map from {old node ID} -> {equivalent simplified node ID}.
Construct the sorted set of all surfaces that are part of the tree.
This list removes surfaces that have been eliminated by logical replacement. Thanks to the CSG tree's deduplication, each surface should appear in the tree at most once.
std::vector< NodeId > celeritas::orangeinp::replace_and_simplify | ( | CsgTree * | tree, |
NodeId | repl_key, | ||
Node | repl_value | ||
) |
Replace the given node ID with the replacement node.
This recurses through daughters of "Joined" to simplify their originating surfaces if possible.
b
This operation is at worst O((number of nodes) * (depth of graph)).
Iteratively simplify all nodes in the tree.
The input 'start' node should be the minimum node from a replace_down
operation. In the worst case, it should take as many sweeps as the depth of the tree.
Simplify all nodes in the tree starting with this one.