/** * Creates the abstract layer for a new joint. * * @param name the name for the new joint. * @param predecessor the rigid-body connected to and preceding this joint. * @param transformToParent the transform to the frame after the parent joint. Not modified. */ public Joint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent) { if (name.contains(NAME_ID_SEPARATOR)) throw new IllegalArgumentException("A joint name can not contain '" + NAME_ID_SEPARATOR + "'. Tried to construct a jonit with name " + name + "."); this.name = name; this.predecessor = predecessor; beforeJointFrame = MecanoFactories.newFrameBeforeJoint(this, transformToParent); afterJointFrame = MecanoFactories.newFrameAfterJoint(this); if (predecessor.isRootBody()) nameId = name; else nameId = predecessor.getParentJoint().getNameId() + NAME_ID_SEPARATOR + name; predecessor.addChildJoint(this); }