/** * Whether the linear x-axis of the current selection frame has been selected. * * @return the selection state of the linear x-axis. */ public boolean isLinearXSelected() { return linearPart.isXSelected(); }
/** * Whether the angular x-axis of the current selection frame has been selected. * * @return the selection state of the angular x-axis. */ public boolean isAngularXSelected() { return angularPart.isXSelected(); }
/** * Computes the number of selections. Will be a number between 0 and 3. * @return the number of selected axes. */ public int getNumberOfSelectedAxes() { return (isXSelected() ? 1 : 0) + (isYSelected() ? 1 : 0) + (isZSelected() ? 1 : 0); }
/** * Whether the {@code axisIndex}<sup>th</sup> axis of the current selection frame has been selected. * <p> * For an {@code axisIndex} of 0, the corresponding component is {@code x}, 1 it is {@code y}, 2 * it is {@code z}. * </p> * * @param axisIndex the index of the axis to get the selection state of. * @return the selection state of the chosen axis. * @throws IndexOutOfBoundsException if {@code axisIndex} ∉ [0, 2]. */ public boolean isAxisSelected(int axisIndex) { switch (axisIndex) { case 0: return isXSelected(); case 1: return isYSelected(); case 2: return isZSelected(); default: throw new IndexOutOfBoundsException(Integer.toString(axisIndex)); } }
public SelectionMatrix6D getSelectionMatrix() { SelectionMatrix6D selectionMatrix = new SelectionMatrix6D(); selectionMatrix.clearSelection(); if (trajectorySelectionMatrix.getLinearPart().isXSelected() || explorationSelectionMatrix.getLinearPart().isXSelected()) selectionMatrix.getLinearPart().selectXAxis(true); if (trajectorySelectionMatrix.getLinearPart().isYSelected() || explorationSelectionMatrix.getLinearPart().isYSelected()) selectionMatrix.getLinearPart().selectYAxis(true); if (trajectorySelectionMatrix.getLinearPart().isZSelected() || explorationSelectionMatrix.getLinearPart().isZSelected()) selectionMatrix.getLinearPart().selectZAxis(true); if (trajectorySelectionMatrix.getAngularPart().isXSelected() || explorationSelectionMatrix.getAngularPart().isXSelected()) selectionMatrix.getAngularPart().selectXAxis(true); if (trajectorySelectionMatrix.getAngularPart().isYSelected() || explorationSelectionMatrix.getAngularPart().isYSelected()) selectionMatrix.getAngularPart().selectYAxis(true); if (trajectorySelectionMatrix.getAngularPart().isZSelected() || explorationSelectionMatrix.getAngularPart().isZSelected()) selectionMatrix.getAngularPart().selectZAxis(true); return selectionMatrix; }
assertTrue(selectionMatrix3D.isXSelected()); assertTrue(selectionMatrix3D.isYSelected()); assertTrue(selectionMatrix3D.isZSelected()); boolean zSelected = random.nextBoolean(); selectionMatrix3D.setAxisSelection(xSelected, ySelected, zSelected); assertEquals(xSelected, selectionMatrix3D.isXSelected()); assertEquals(ySelected, selectionMatrix3D.isYSelected()); assertEquals(zSelected, selectionMatrix3D.isZSelected()); selectionMatrix3D.selectYAxis(ySelected); selectionMatrix3D.selectZAxis(zSelected); assertEquals(xSelected, selectionMatrix3D.isXSelected()); assertEquals(ySelected, selectionMatrix3D.isYSelected()); assertEquals(zSelected, selectionMatrix3D.isZSelected()); assertTrue(selectionMatrix3D.isXSelected()); assertTrue(selectionMatrix3D.isYSelected()); assertTrue(selectionMatrix3D.isZSelected()); assertFalse(selectionMatrix3D.isXSelected()); assertFalse(selectionMatrix3D.isYSelected()); assertFalse(selectionMatrix3D.isZSelected());
assertEquals(linearXSelected, selectionMatrixLinearPart.isXSelected()); assertEquals(linearYSelected, selectionMatrixLinearPart.isYSelected()); assertEquals(linearZSelected, selectionMatrixLinearPart.isZSelected()); assertEquals(angularXSelected, selectionMatrixAngularPart.isXSelected()); assertEquals(angularYSelected, selectionMatrixAngularPart.isYSelected()); assertEquals(angularZSelected, selectionMatrixAngularPart.isZSelected());
assertNull(selectionMatrix6D.getLinearSelectionFrame()); SelectionMatrix3D selectionMatrixLinearPart = selectionMatrix6D.getLinearPart(); assertEquals(linearXSelected, selectionMatrixLinearPart.isXSelected()); assertEquals(linearYSelected, selectionMatrixLinearPart.isYSelected()); assertEquals(linearZSelected, selectionMatrixLinearPart.isZSelected()); assertEquals(angularXSelected, selectionMatrixAngularPart.isXSelected()); assertEquals(angularYSelected, selectionMatrixAngularPart.isYSelected()); assertEquals(angularZSelected, selectionMatrixAngularPart.isZSelected());
if (selectionMatrix.isXSelected())