coordsys_cutoff
namespace nin {
template <coordsys_traits CT>
class coordsys_cutoff : public coordsys<CT>;
}
coordsys_cutoff accelerates transformation generation by short-circuiting kinematic tree
traversal.
When mapCS() builds a coord_tf, it composes the tf_to_WCS() of the source with the
tf_from_WCS() of the target. Each of those traverses the full chain of parents up to WCS,
which can be expensive when the tree is deep or when backends along the way make remote
calls (e.g. querying a physics engine or a network service).
If two coordinate systems are known to share a common subtree root, a coordsys_cutoff
can be placed at that root and locked. While locked, offset() returns the identity
transformation, so traversal stops at the cutoff instead of continuing to WCS. Both sides
of a mapCS() call see the same cutoff and their common prefix cancels out, giving the
correct relative transformation at lower cost.
A lock guard pattern is typical:
cutoff.lock();
coord_tf tf = mapCS(cs_a, cs_b); // traversal stops at cutoff
cutoff.unlock();
Member functions
(Constructor)
|
(1) |
|
(2) |
|
(3) |
|
(4) |
|
(5) |
-
(1) Default constructor.
-
(2) Deep copy.
-
(3) Move constructor.
-
(4)-(5) Constructs with a parent coordinate system.
lock
unlock
control tree traversal
lock
unlock
control tree traversal
|
(1) |
|
(2) |
-
(1) Locks the cutoff. While locked,
offset()returns a default-constructed transformation (identity), stopping traversal at this point. -
(2) Unlocks the cutoff. Traversal resumes through the parent as normal.
parent
access the parent coordinate system
parent
access the parent coordinate system
|
(1) |
Returns the parent coordinate system.
set_parent
change the parent coordinate system
set_parent
change the parent coordinate system
|
(1) |
Sets a new parent coordinate system.