]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/src/org/simantics/g3d/shape/Cylinder.java
Gitignores
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / g3d / shape / Cylinder.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g3d.shape;\r
13 \r
14 import java.util.ArrayList;\r
15 import java.util.List;\r
16 \r
17 import javax.vecmath.Vector3d;\r
18 \r
19 public class Cylinder {\r
20         \r
21         public static Mesh create(Vector3d start, Vector3d dir, double r, int s) {\r
22                 Tube tube = new Tube();\r
23                 tube.setResolution(s);\r
24                 tube.setRadius(r);\r
25                 List<Vector3d> vertices = new ArrayList<Vector3d>();\r
26                 vertices.add(start);\r
27                 Vector3d t = new Vector3d(start);\r
28                 t.add(dir);\r
29                 vertices.add(dir);\r
30                 tube.setVertices(vertices);\r
31                 return tube.create();\r
32         }\r
33 \r
34 }\r