<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2F3D%2FCone</id>
		<title>Java/3D/Cone - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2F3D%2FCone"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/3D/Cone&amp;action=history"/>
		<updated>2026-05-03T22:27:38Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/3D/Cone&amp;diff=6497&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/3D/Cone&amp;diff=6497&amp;oldid=prev"/>
				<updated>2010-06-01T06:15:52Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:15, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/3D/Cone&amp;diff=6496&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/3D/Cone&amp;diff=6496&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cone Yoyo ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * ConeYoyoApp.java 1.0 98/11/25&lt;br /&gt;
 * &lt;br /&gt;
 * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Sun grants you (&amp;quot;Licensee&amp;quot;) a non-exclusive, royalty free, license to use,&lt;br /&gt;
 * modify and redistribute this software in source and binary code form,&lt;br /&gt;
 * provided that i) this copyright notice and license appear on all copies of&lt;br /&gt;
 * the software; and ii) Licensee does not utilize the software in a manner&lt;br /&gt;
 * which is disparaging to Sun.&lt;br /&gt;
 * &lt;br /&gt;
 * This software is provided &amp;quot;AS IS,&amp;quot; without a warranty of any kind. ALL&lt;br /&gt;
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY&lt;br /&gt;
 * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR&lt;br /&gt;
 * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE&lt;br /&gt;
 * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING&lt;br /&gt;
 * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS&lt;br /&gt;
 * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,&lt;br /&gt;
 * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER&lt;br /&gt;
 * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF&lt;br /&gt;
 * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY&lt;br /&gt;
 * OF SUCH DAMAGES.&lt;br /&gt;
 * &lt;br /&gt;
 * This software is not designed or intended for use in on-line control of&lt;br /&gt;
 * aircraft, air traffic, aircraft navigation or aircraft communications; or in&lt;br /&gt;
 * the design, construction, operation or maintenance of any nuclear facility.&lt;br /&gt;
 * Licensee represents and warrants that it will not use or redistribute the&lt;br /&gt;
 * Software for such purposes.&lt;br /&gt;
 */&lt;br /&gt;
/*&lt;br /&gt;
 * Getting Started with the Java 3D API written in Java 3D&lt;br /&gt;
 * &lt;br /&gt;
 * This program demonstrates: 1. writing a visual object class In this program,&lt;br /&gt;
 * ConeYoyo class defines a visual object independent of all other classes. 2.&lt;br /&gt;
 * Using Cone to create surfaces.&lt;br /&gt;
 */&lt;br /&gt;
import java.applet.Applet;&lt;br /&gt;
import java.awt.BorderLayout;&lt;br /&gt;
import java.awt.Frame;&lt;br /&gt;
import javax.media.j3d.Alpha;&lt;br /&gt;
import javax.media.j3d.Appearance;&lt;br /&gt;
import javax.media.j3d.BoundingSphere;&lt;br /&gt;
import javax.media.j3d.BranchGroup;&lt;br /&gt;
import javax.media.j3d.Canvas3D;&lt;br /&gt;
import javax.media.j3d.RotationInterpolator;&lt;br /&gt;
import javax.media.j3d.Transform3D;&lt;br /&gt;
import javax.media.j3d.TransformGroup;&lt;br /&gt;
import javax.vecmath.Point3d;&lt;br /&gt;
import javax.vecmath.Vector3f;&lt;br /&gt;
import com.sun.j3d.utils.applet.MainFrame;&lt;br /&gt;
import com.sun.j3d.utils.geometry.Cone;&lt;br /&gt;
import com.sun.j3d.utils.universe.SimpleUniverse;&lt;br /&gt;
public class ConeYoyoApp extends Applet {&lt;br /&gt;
  /////////////////////////////////////////////////&lt;br /&gt;
  //&lt;br /&gt;
  // create scene graph branch group&lt;br /&gt;
  //&lt;br /&gt;
  public class ConeYoyo {&lt;br /&gt;
    private BranchGroup yoyoBG;&lt;br /&gt;
    ////////////////////////////////////////////&lt;br /&gt;
    //&lt;br /&gt;
    // create Shape3D with geometry and appearance&lt;br /&gt;
    // the geometry is created in method yoyoGeometry&lt;br /&gt;
    // the appearance is created in method yoyoAppearance&lt;br /&gt;
    //&lt;br /&gt;
    public ConeYoyo() {&lt;br /&gt;
      yoyoBG = new BranchGroup();&lt;br /&gt;
      Appearance app = new Appearance();&lt;br /&gt;
      // rotate object has composited transformation matrix&lt;br /&gt;
      Transform3D rotate = new Transform3D();&lt;br /&gt;
      Transform3D translate = new Transform3D();&lt;br /&gt;
      translate.set(new Vector3f(0.1f, 0.0f, 0.0f));&lt;br /&gt;
      TransformGroup yoyoTGT1 = new TransformGroup(translate);&lt;br /&gt;
      yoyoBG.addChild(yoyoTGT1);&lt;br /&gt;
      rotate.rotZ(Math.PI / 2.0d);&lt;br /&gt;
      TransformGroup yoyoTGR1 = new TransformGroup(rotate);&lt;br /&gt;
      Cone cone1 = new Cone(0.6f, 0.2f);&lt;br /&gt;
      cone1.setAppearance(app);&lt;br /&gt;
      yoyoTGR1.addChild(cone1);&lt;br /&gt;
      yoyoTGT1.addChild(yoyoTGR1);&lt;br /&gt;
      translate.set(new Vector3f(-0.1f, 0.0f, 0.0f));&lt;br /&gt;
      TransformGroup yoyoTGT2 = new TransformGroup(translate);&lt;br /&gt;
      yoyoBG.addChild(yoyoTGT2);&lt;br /&gt;
      rotate.rotZ(-Math.PI / 2.0d);&lt;br /&gt;
      TransformGroup yoyoTGR2 = new TransformGroup(rotate);&lt;br /&gt;
      Cone cone2 = new Cone(0.6f, 0.2f);&lt;br /&gt;
      cone2.setAppearance(app);&lt;br /&gt;
      yoyoTGR2.addChild(cone2);&lt;br /&gt;
      yoyoTGT2.addChild(yoyoTGR2);&lt;br /&gt;
      yoyoBG.rupile();&lt;br /&gt;
    } // end of ConeYoyo constructor&lt;br /&gt;
    public BranchGroup getBG() {&lt;br /&gt;
      return yoyoBG;&lt;br /&gt;
    }&lt;br /&gt;
  } // end of class ConeYoyo&lt;br /&gt;
  /////////////////////////////////////////////////&lt;br /&gt;
  //&lt;br /&gt;
  // create scene graph branch group&lt;br /&gt;
  //&lt;br /&gt;
  public BranchGroup createSceneGraph() {&lt;br /&gt;
    BranchGroup objRoot = new BranchGroup();&lt;br /&gt;
    // Create the transform group node and initialize it to the&lt;br /&gt;
    // identity. Enable the TRANSFORM_WRITE capability so that&lt;br /&gt;
    // our behavior code can modify it at runtime. Add it to the&lt;br /&gt;
    // root of the subgraph.&lt;br /&gt;
    TransformGroup objSpin = new TransformGroup();&lt;br /&gt;
    objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);&lt;br /&gt;
    objRoot.addChild(objSpin);&lt;br /&gt;
    objSpin.addChild(new ConeYoyo().getBG());&lt;br /&gt;
    // Create a new Behavior object that will perform the desired&lt;br /&gt;
    // operation on the specified transform object and add it into&lt;br /&gt;
    // the scene graph.&lt;br /&gt;
    Transform3D yAxis = new Transform3D();&lt;br /&gt;
    Alpha rotationAlpha = new Alpha(-1, 4000);&lt;br /&gt;
    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,&lt;br /&gt;
        objSpin);&lt;br /&gt;
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),&lt;br /&gt;
        100.0);&lt;br /&gt;
    rotator.setSchedulingBounds(bounds);&lt;br /&gt;
    objSpin.addChild(rotator);&lt;br /&gt;
    // Let Java 3D perform optimizations on this scene graph.&lt;br /&gt;
    objRoot.rupile();&lt;br /&gt;
    return objRoot;&lt;br /&gt;
  } // end of CreateSceneGraph method of yoyo1&lt;br /&gt;
  // Create a simple scene and attach it to the virtual universe&lt;br /&gt;
  public ConeYoyoApp() {&lt;br /&gt;
    setLayout(new BorderLayout());&lt;br /&gt;
    Canvas3D canvas3D = new Canvas3D(null);&lt;br /&gt;
    add(&amp;quot;Center&amp;quot;, canvas3D);&lt;br /&gt;
    BranchGroup scene = createSceneGraph();&lt;br /&gt;
    SimpleUniverse simpleU = new SimpleUniverse(canvas3D);&lt;br /&gt;
    simpleU.getViewingPlatform().setNominalViewingTransform();&lt;br /&gt;
    simpleU.addBranchGraph(scene);&lt;br /&gt;
  } // end of ConeYoyoApp constructor&lt;br /&gt;
  //  The following allows this to be run as an application&lt;br /&gt;
  //  as well as an applet&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Frame frame = new MainFrame(new ConeYoyoApp(), 256, 256);&lt;br /&gt;
  } // end of main method of coneyoyo&lt;br /&gt;
} // end of class ConeYoyoApp&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creates a cone using the utility class Cone ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Essential Java 3D Fast&lt;br /&gt;
Ian Palmer&lt;br /&gt;
Publisher: Springer-Verlag&lt;br /&gt;
ISBN: 1-85233-394-4&lt;br /&gt;
*/&lt;br /&gt;
import java.awt.BorderLayout;&lt;br /&gt;
import java.awt.Button;&lt;br /&gt;
import java.awt.Frame;&lt;br /&gt;
import java.awt.event.ActionEvent;&lt;br /&gt;
import java.awt.event.ActionListener;&lt;br /&gt;
import javax.media.j3d.Appearance;&lt;br /&gt;
import javax.media.j3d.BranchGroup;&lt;br /&gt;
import javax.media.j3d.Canvas3D;&lt;br /&gt;
import javax.media.j3d.Locale;&lt;br /&gt;
import javax.media.j3d.Node;&lt;br /&gt;
import javax.media.j3d.PhysicalBody;&lt;br /&gt;
import javax.media.j3d.PhysicalEnvironment;&lt;br /&gt;
import javax.media.j3d.Transform3D;&lt;br /&gt;
import javax.media.j3d.TransformGroup;&lt;br /&gt;
import javax.media.j3d.View;&lt;br /&gt;
import javax.media.j3d.ViewPlatform;&lt;br /&gt;
import javax.media.j3d.VirtualUniverse;&lt;br /&gt;
import javax.vecmath.AxisAngle4d;&lt;br /&gt;
import javax.vecmath.Vector3f;&lt;br /&gt;
import com.sun.j3d.utils.geometry.Cone;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a cone using the utility class Cone.&lt;br /&gt;
 * &lt;br /&gt;
 * @author I.J.Palmer&lt;br /&gt;
 * @version 1.0&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleCone extends Frame implements ActionListener {&lt;br /&gt;
  protected Canvas3D myCanvas3D = new Canvas3D(null);&lt;br /&gt;
  protected Button myButton = new Button(&amp;quot;Exit&amp;quot;);&lt;br /&gt;
  /**&lt;br /&gt;
   * This function builds the view branch of the scene graph. It creates a&lt;br /&gt;
   * branch group and then creates the necessary view elements to give a&lt;br /&gt;
   * useful view of our content.&lt;br /&gt;
   * &lt;br /&gt;
   * @param c&lt;br /&gt;
   *            Canvas3D that will display the view&lt;br /&gt;
   * @return BranchGroup that is the root of the view elements&lt;br /&gt;
   */&lt;br /&gt;
  protected BranchGroup buildViewBranch(Canvas3D c) {&lt;br /&gt;
    BranchGroup viewBranch = new BranchGroup();&lt;br /&gt;
    Transform3D viewXfm = new Transform3D();&lt;br /&gt;
    viewXfm.set(new Vector3f(0.0f, 0.0f, 5.0f));&lt;br /&gt;
    TransformGroup viewXfmGroup = new TransformGroup(viewXfm);&lt;br /&gt;
    ViewPlatform myViewPlatform = new ViewPlatform();&lt;br /&gt;
    PhysicalBody myBody = new PhysicalBody();&lt;br /&gt;
    PhysicalEnvironment myEnvironment = new PhysicalEnvironment();&lt;br /&gt;
    viewXfmGroup.addChild(myViewPlatform);&lt;br /&gt;
    viewBranch.addChild(viewXfmGroup);&lt;br /&gt;
    View myView = new View();&lt;br /&gt;
    myView.addCanvas3D(c);&lt;br /&gt;
    myView.attachViewPlatform(myViewPlatform);&lt;br /&gt;
    myView.setPhysicalBody(myBody);&lt;br /&gt;
    myView.setPhysicalEnvironment(myEnvironment);&lt;br /&gt;
    return viewBranch;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * This builds the content branch of our scene graph. It uses the buildShape&lt;br /&gt;
   * function to create the actual shape, adding to to the transform group so&lt;br /&gt;
   * that the shape is slightly tilted to reveal its 3D shape.&lt;br /&gt;
   * &lt;br /&gt;
   * @param shape&lt;br /&gt;
   *            Node that represents the geometry for the content&lt;br /&gt;
   * @return BranchGroup that is the root of the content branch&lt;br /&gt;
   */&lt;br /&gt;
  protected BranchGroup buildContentBranch() {&lt;br /&gt;
    BranchGroup contentBranch = new BranchGroup();&lt;br /&gt;
    Transform3D rotateCube = new Transform3D();&lt;br /&gt;
    rotateCube.set(new AxisAngle4d(1.0, 1.0, 0.0, Math.PI / 4.0));&lt;br /&gt;
    TransformGroup rotationGroup = new TransformGroup(rotateCube);&lt;br /&gt;
    contentBranch.addChild(rotationGroup);&lt;br /&gt;
    rotationGroup.addChild(new Cone(1.0f, 2.0f, 0, new Appearance()));&lt;br /&gt;
    return contentBranch;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * This simply builds the shape using the Cone utility class.&lt;br /&gt;
   * &lt;br /&gt;
   * @param Node&lt;br /&gt;
   *            that the is the Cone created&lt;br /&gt;
   */&lt;br /&gt;
  protected Node buildShape() {&lt;br /&gt;
    return new Cone(1.0f, 2.0f, Cone.GENERATE_NORMALS, new Appearance());&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Handles the exit button action to quit the program.&lt;br /&gt;
   */&lt;br /&gt;
  public void actionPerformed(ActionEvent e) {&lt;br /&gt;
    dispose();&lt;br /&gt;
    System.exit(0);&lt;br /&gt;
  }&lt;br /&gt;
  public SimpleCone() {&lt;br /&gt;
    VirtualUniverse myUniverse = new VirtualUniverse();&lt;br /&gt;
    Locale myLocale = new Locale(myUniverse);&lt;br /&gt;
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));&lt;br /&gt;
    myLocale.addBranchGraph(buildContentBranch());&lt;br /&gt;
    setTitle(&amp;quot;SimpleWorld&amp;quot;);&lt;br /&gt;
    setSize(400, 400);&lt;br /&gt;
    setLayout(new BorderLayout());&lt;br /&gt;
    add(&amp;quot;Center&amp;quot;, myCanvas3D);&lt;br /&gt;
    add(&amp;quot;South&amp;quot;, myButton);&lt;br /&gt;
    myButton.addActionListener(this);&lt;br /&gt;
    setVisible(true);&lt;br /&gt;
  }&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    SimpleCone sw = new SimpleCone();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>