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 PointDComputer extends CubeFacesPointComputer implements PointComputer {
24 private final int firstAxisIndex;
25 private final Vector3d secondPosition;
26 private final Vector3d firstPosition;
31 * @param axes current axes.
32 * @param pointCComputer previous point computer.
33 * @param point clicked point in AWT coordinate.
35 public PointDComputer(Axes axes, PointComputer pointCComputer, Point point) {
37 firstAxisIndex = pointCComputer.getFirstAxisIndex();
38 if (getPosition() != null) {
39 firstPosition = pointCComputer.getFirstPosition();
40 secondPosition = setCoordinate(pointCComputer.getSecondPosition(), getPosition(), firstAxisIndex);
43 secondPosition = null;
48 public final boolean isValid() {
49 return secondPosition != null;
53 public final Vector3d getFirstPosition() {
58 public final Vector3d getSecondPosition() {
59 return secondPosition;
63 public final int getFirstAxisIndex() {
64 return firstAxisIndex;
68 public boolean is2D() {