/******************************************************************************* * Copyright (c) 2012, 2013 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.g3d.shape; import java.util.ArrayList; import java.util.List; import javax.vecmath.Tuple3d; import javax.vecmath.Vector3d; public class Cylinder { public static Mesh create(Vector3d start, Vector3d dir, double r, int s) { Tube tube = new Tube(); tube.setResolution(s); tube.setRadius(r); List vertices = new ArrayList(); vertices.add(start); Vector3d t = new Vector3d(start); t.add(dir); vertices.add(dir); tube.setVertices(vertices); return tube.create(); } }