/** * Generates a moving reference frame with random transform and twist to world frame. * * @param random the random generator to use. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(Random random) { return nextMovingReferenceFrame(random, false); }
/** * Generates a moving reference frame with random transform and twist to its parent frame. * * @param frameName the name of the new frame. * @param random the random generator to use. * @param parentFrame the parent frame of the new moving reference frame. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(String frameName, Random random, ReferenceFrame parentFrame) { return nextMovingReferenceFrame(frameName, random, parentFrame, false); }
/** * Generates a moving reference frame with random transform and twist to its parent frame. * * @param random the random generator to use. * @param parentFrame the parent frame of the new moving reference frame. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(Random random, ReferenceFrame parentFrame) { return nextMovingReferenceFrame(random, parentFrame, false); }
/** * Generates a moving reference frame with random transform and twist to its parent frame. * * @param random the random generator to use. * @param parentFrame the parent frame of the new moving reference frame. * @param use2DTransform whether to use a 2D or 3D rotation for the transform used to create the * random frame. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(Random random, ReferenceFrame parentFrame, boolean use2DTransform) { return nextMovingReferenceFrame("randomFrame" + random.nextInt(), random, parentFrame, use2DTransform); }
/** * Creates a tree structure of random moving reference frames starting off the given * {@code rootFrame}. * * @param frameNamePrefix prefix to use when creating each random moving reference frame. * @param random the random generator to use. * @param rootFrame the base frame from which the tree is to be expanded. * @param numberOfMovingReferenceFrames the number of moving reference frames to be created. * @param use2DTransforms whether to use a 2D or 3D rotation for the transform used to create the * random frames. * @return the array containing the random moving reference frames. */ public static MovingReferenceFrame[] nextMovingReferenceFrameTree(String frameNamePrefix, Random random, ReferenceFrame rootFrame, int numberOfMovingReferenceFrames, boolean use2DTransforms) { ReferenceFrame[] referenceFrames = new ReferenceFrame[numberOfMovingReferenceFrames + 1]; MovingReferenceFrame[] movingReferenceFrames = new MovingReferenceFrame[numberOfMovingReferenceFrames]; referenceFrames[0] = rootFrame; for (int i = 0; i < numberOfMovingReferenceFrames; i++) { int parentFrameIndex = random.nextInt(i + 1); ReferenceFrame parentFrame = referenceFrames[parentFrameIndex]; MovingReferenceFrame nextMovingReferenceFrame = nextMovingReferenceFrame(frameNamePrefix + i, random, parentFrame, use2DTransforms); referenceFrames[i + 1] = nextMovingReferenceFrame; movingReferenceFrames[i] = nextMovingReferenceFrame; } return movingReferenceFrames; }
/** * Generates a moving reference frame with random transform and twist to world frame. * * @param random the random generator to use. * @param use2DTransform whether to use a 2D or 3D rotation for the transform used to create the * random frame. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(Random random, boolean use2DTransform) { return nextMovingReferenceFrame(random, ReferenceFrame.getWorldFrame(), use2DTransform); }