1 /*****************************************************************************
2 * Virtual Mockup for Machine Vision
3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr.,
4 * Carlos S. Santos.
5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP
6 *
7 * Permission is granted to redistribute and/or modify this
8 * software under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html)
16 * for more details.
17 *
18 *****************************************************************************/
19
20 package camera3d;
21
22 /*
23 * Title: Câmera Virtual - LIVES
24 * Description: Câmera Virtual para Controle via LabVIEW
25 * Copyright: Copyright (c) 2001
26 * Company: Centro de Educação em Informática - SENAC - SP
27 */
28
29
30 import javax.vecmath.*;
31 import camera3d.test.NodeTester;
32 import camera3d.action.ActionExecutor;
33 import camera3d.action.ActionQueue;
34
35 /***
36 * Drawing of planes test.
37 *
38 * This class should be in the camera3d.test package, but it uses the
39 * TranslationManipulator.computeIntersection method, which has package access.
40 * Thus, it remains in the same package as TranslationManipulator.
41 *
42 * @author Fábio de Miranda
43 * @version 1.0
44 */
45 class PlanesTest {
46
47 PlanesTest() {
48 }
49
50 public static void main(String[] args) {
51 NodeTester tester = new NodeTester();
52 GeometryBag bag = new GeometryBag();
53 tester.add(bag.getBranchGroup());
54 PlanesTest planesTest1 = new PlanesTest();
55 //GUIControl guiControl = new GUIControl(new ActionQueue());
56
57 Vector3d planeVector = new Vector3d(1.0, 1.0, 1.0);
58 Point3d planePoint = new Point3d(0.0, -1.0, 0.0);
59 Vector3d lineVector = new Vector3d(0.0, 1.0, 0.0);
60 Point3d linePoint = new Point3d(1.0, 1.0, 1.0);
61 bag.addLine(linePoint, lineVector);
62 Point3d result = new Point3d();
63 Vector4d plane = new Vector4d();
64
65 for (int i=0; i < 5; i++) {
66 planePoint.y+=2.0;
67 MathUtility.buildPlaneFromPointAndNormal(plane, planePoint, planeVector);
68 bag.addPlane(plane);
69 System.out.println("Plane in 4d form "+plane);
70 //bag.addPlane(planePoint, planeVector);
71
72 MathUtility.computeIntersection(result, linePoint, lineVector, plane);
73 bag.addPoint(result);
74 }
75
76 linePoint.x += 1.0;
77 planePoint.y = -1.0;
78
79 bag.addLine(linePoint, lineVector);
80 for (int i=0; i < 5; i++) {
81 planePoint.y+=2.0;
82
83 //bag.addPlane(plane);
84 bag.addPlane(planePoint, planeVector);
85 MathUtility.computeIntersection(result, linePoint, lineVector, planePoint, planeVector);
86
87 bag.addPoint(result);
88
89 }
90
91 }
92 }
This page was automatically generated by Maven