2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2009-2012 - DIGITEO - Pierre Lando
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 package org.scilab.modules.renderer.JoGLView.interaction.util;
14 import org.scilab.forge.scirenderer.tranformations.Vector3d;
15 import org.scilab.modules.graphic_objects.axes.Axes;
17 import java.awt.Point;
20 * @author Pierre Lando
22 public class PointCComputer extends CubeFacesPointComputer implements PointComputer {
24 private final Vector3d secondPosition;
25 private final Vector3d firstPosition;
26 private final int firstAxisIndex;
32 * @param axes current axes.
33 * @param pointBComputer previous point computer.
34 * @param point clicked point in AWT coordinate.
36 public PointCComputer(Axes axes, PointComputer pointBComputer, Point point) {
38 firstAxisIndex = pointBComputer.getFirstAxisIndex();
39 if (getPosition() != null) {
40 firstPosition = setCoordinate(pointBComputer.getFirstPosition(), getPosition(), firstAxisIndex);
41 secondPosition = setCoordinate(pointBComputer.getSecondPosition(), getPosition(), firstAxisIndex);
44 secondPosition = null;
49 public final boolean isValid() {
50 return secondPosition != null;
54 public final int getFirstAxisIndex() {
55 return firstAxisIndex;
59 public final Vector3d getFirstPosition() {
64 public final Vector3d getSecondPosition() {
65 return secondPosition;
69 public boolean is2D() {