1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.jme.shape;
\r
14 import javax.vecmath.AxisAngle4d;
\r
15 import javax.vecmath.Vector3d;
\r
17 import org.simantics.g3d.math.MathTools;
\r
18 import org.simantics.g3d.shape.Color4d;
\r
19 import org.simantics.g3d.shape.Cone;
\r
20 import org.simantics.g3d.shape.Cylinder;
\r
21 import org.simantics.g3d.shape.Sphere;
\r
23 import com.jme3.app.Application;
\r
25 public class AxesActor2 extends MeshNode {
\r
27 public AxesActor2(Application app, double size) {
\r
32 org.simantics.g3d.shape.Mesh cone_x = Cone.create(size*0.3, res);
\r
33 org.simantics.g3d.shape.Mesh cone_y = Cone.create(size*0.3, res);
\r
34 org.simantics.g3d.shape.Mesh cone_z = Cone.create(size*0.3, res);
\r
35 cone_x.rotate(MathTools.getQuat(new AxisAngle4d(0,0,-1,Math.PI*0.5)));
\r
36 cone_z.rotate(MathTools.getQuat(new AxisAngle4d(1,0,0,Math.PI*0.5)));
\r
37 cone_x.translate(new Vector3d(size,0,0));
\r
38 cone_y.translate(new Vector3d(0,size,0));
\r
39 cone_z.translate(new Vector3d(0,0,size));
\r
41 org.simantics.g3d.shape.Mesh tube_x = Cylinder.create(MathTools.ORIGIN, new Vector3d(size,0,0), size*0.1, res);
\r
42 org.simantics.g3d.shape.Mesh tube_y = Cylinder.create(MathTools.ORIGIN, new Vector3d(0,size,0), size*0.1, res);
\r
43 org.simantics.g3d.shape.Mesh tube_z = Cylinder.create(MathTools.ORIGIN, new Vector3d(0,0,size), size*0.1, res);
\r
45 org.simantics.g3d.shape.Mesh sphere = Sphere.create(size*0.3, res, res*2/3);
\r
47 Color4d x_col = new Color4d(1,0,0,1);
\r
48 Color4d y_col = new Color4d(1,1,0,1);
\r
49 Color4d z_col = new Color4d(0,1,0,1);
\r
50 Color4d o_col = new Color4d(0,0,1,1);
\r
52 cone_x.setColor(x_col);
\r
53 tube_x.setColor(x_col);
\r
54 cone_y.setColor(y_col);
\r
55 tube_y.setColor(y_col);
\r
56 cone_z.setColor(z_col);
\r
57 tube_z.setColor(z_col);
\r
58 sphere.setColor(o_col);
\r