⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rhodoneashape3d.java

📁 java3D game engine design of the source [three-dimensionalvirtualrealitynetworkprogram] - "virtual
💻 JAVA
字号:

// RhodoneaShape3D.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th

/* So named because it resembles a rose. The equation is:
     r = a cos(k . angle)
   There will be k or 2k petals depending on if k is an odd 
   or even integer.

   When angle == 0, r == a == radius, so we use radius as the
   'a' value. 
   After obtaining r, we must convert back to cartesian (x,y)
   coordinates.
*/

import javax.media.j3d.*;
import javax.vecmath.*;


public class RhodoneaShape3D extends LatheShape3D
{
  public RhodoneaShape3D(double[] xsIn, double[] ysIn,
                                Color3f darkCol, Color3f lightCol)
  { super(xsIn, ysIn, darkCol, lightCol);  }


  public RhodoneaShape3D(double[] xsIn, double[] ysIn, Texture tex)
  { super(xsIn, ysIn, tex);  }


  protected double xCoord(double radius, double angle)
  { double r = radius * Math.cos(4 * angle);   // 8 petals
    return  r * Math.cos(angle);  
  }

  protected double zCoord(double radius, double angle)
  { double r = radius * Math.cos(4 * angle);
    return  r * Math.sin(angle); 
  }

}  // end of RhodoneaShape3D class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -