/*
* @(#)SpurGear.java 1.12 98/02/20 14:29:58
*
* Copyright (c) 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
*
* Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
* modify and redistribute this software in source and binary code form,
* provided that i) this copyright notice and license appear on all copies of
* the software; and ii) Licensee does not utilize the software in a manner
* which is disparaging to Sun.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
* LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
* INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
* OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* This software is not designed or intended for use in on-line control of
* aircraft, air traffic, aircraft navigation or aircraft communications; or in
* the design, construction, operation or maintenance of any nuclear
* facility. Licensee represents and warrants that it will not use or
* redistribute the Software for such purposes.
*/
import java.lang.Math.*;
import javax.media.j3d.*;
import javax.vecmath.*;
public class SpurGear extends Gear {
float toothTopAngleIncrement;
float toothDeclineAngleIncrement;
float rootRadius;
float outsideRadius;
//The angle subtended by the ascending or descending portion of a tooth
float circularToothEdgeAngle;
// The angle subtended by a flat (either a tooth top or a valley
// between teeth
float circularToothFlatAngle;
/**
* internal constructor for SpurGear, used by subclasses to establish
* SpurGear's required state
* @return a new spur gear that contains sufficient information to
* continue building
* @param toothCount number of teeth
* @param pitchCircleRadius radius at center of teeth
* @param addendum distance from pitch circle to top of teeth
* @param dedendum distance from pitch circle to root of teeth
* @param toothToValleyAngleRatio the ratio of the angle subtended by the
* tooth to the angle subtended by the valley (must be <= .25)
*/
SpurGear(int toothCount, float pitchCircleRadius,
float addendum, float dedendum, float toothToValleyAngleRatio) {
super(toothCount);
// The angle about Z subtended by one tooth and its associated valley
circularPitchAngle = (float)(2.0 * Math.PI / (double)toothCount);
// The angle subtended by a flat (either a tooth top or a valley
// between teeth
circularToothFlatAngle = circularPitchAngle * toothToValleyAngleRatio;
//The angle subtended by the ascending or descending portion of a tooth
circularToothEdgeAngle = circularPitchAngle/2.0f -
circularToothFlatAngle;
// Increment angles
toothTopAngleIncrement = circularToothEdgeAngle;
toothDeclineAngleIncrement
= toothTopAngleIncrement + circularToothFlatAngle;
toothValleyAngleIncrement
= toothDeclineAngleIncrement + circularToothEdgeAngle;
// Differential angles for offsetting to the center of tooth's top
// and valley
toothTopCenterAngle
= toothTopAngleIncrement + circularToothFlatAngle/2.0f;
valleyCenterAngle
= toothValleyAngleIncrement + circularToothFlatAngle/2.0f;
// Gear start differential angle. All gears are constructed with the
// center of a tooth at Z-axis angle = 0.
gearStartAngle = -1.0 * toothTopCenterAngle;
// The radial distance to the root and top of the teeth, respectively
rootRadius = pitchCircleRadius - dedendum;
outsideRadius = pitchCircleRadius + addendum;
// Allow this object to spin. etc.
this.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
}
/**
* Construct a SpurGear;
* @return a new spur gear that conforms to the input paramters
* @param toothCount number of teeth
* @param pitchCircleRadius radius at center of teeth
* @param shaftRadius radius of hole at center
* @param addendum distance from pitch circle to top of teeth
* @param dedendum distance from pitch circle to root of teeth
* @param gearThickness thickness of the gear
*/
public SpurGear(int toothCount, float pitchCircleRadius, float shaftRadius,
float addendum, float dedendum, float gearThickness) {
this(toothCount, pitchCircleRadius, shaftRadius, addendum, dedendum,
gearThickness, gearThickness, 0.25f, null);
}
/**
* Construct a SpurGear;
* @return a new spur gear that conforms to the input paramters
* @param toothCount number of teeth
* @param pitchCircleRadius radius at center of teeth
* @param shaftRadius radius of hole at center
* @param addendum distance from pitch circle to top of teeth
* @param dedendum distance from pitch circle to root of teeth
* @param gearThickness thickness of the gear
* @param look the gear's appearance
*/
public SpurGear(int toothCount, float pitchCircleRadius, float shaftRadius,
float addendum, float dedendum, float gearThickness,
Appearance look) {
this(toothCount, pitchCircleRadius, shaftRadius, addendum, dedendum,
gearThickness, gearThickness, 0.25f, look);
}
/**
* Construct a SpurGear;
* @return a new spur gear that conforms to the input paramters
* @param toothCount number of teeth
* @param pitchCircleRadius radius at center of teeth
* @param shaftRadius radius of hole at center
* @param addendum distance from pitch circle to top of teeth
* @param dedendum distance from pitch circle to root of teeth
* @param gearThickness thickness of the gear
* @param toothTipThickness thickness of the tip of the tooth
* @param look the gear's appearance
*/
public SpurGear(int toothCount, float pitchCircleRadius, float shaftRadius,
float addendum, float dedendum, float gearThickness,
float toothTipThickness, Appearance look) {
this(toothCount, pitchCircleRadius, shaftRadius, addendum, dedendum,
gearThickness, toothTipThickness, 0.25f, look);
}
/**
* Construct a SpurGear;
* @return a new spur gear that conforms to the input paramters
* @param toothCount number of teeth
* @param pitchCircleRadius radius at center of teeth
* @param shaftRadius radius of hole at center
* @param addendum distance from pitch circle to top of teeth
* @param dedendum distance from pitch circle to root of teeth
* @param gearThickness thickness of the gear
* @param toothTipThickness thickness of the tip of the tooth
* @param toothToValleyAngleRatio the ratio of the angle subtended by the
* tooth to the angle subtended by the valley (must be <= .25)
* @param look the gear's appearance object
*/
public SpurGear(int toothCount, float pitchCircleRadius, float shaftRadius,
float addendum, float dedendum, float gearThickness,
float toothTipThickness, float toothToValleyAngleRatio,
Appearance look) {
this(toothCount, pitchCircleRadius, addendum, dedendum,
toothToValleyAngleRatio);
// Generate the gear's body disks
addBodyDisks(shaftRadius, rootRadius, gearThickness, look);
// Generate the gear's interior shaft
addCylinderSkins(shaftRadius, gearThickness, InwardNormals, look);
// Generate the gea
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
java经典入门教材 (919个子文件)
ax.gif 6KB
arwtoc2.gif 183B
arwnext2.gif 172B
arwprev2.gif 170B
arwndx2.gif 166B
vtee.gif 150B
htee.gif 142B
elbow.gif 138B
hline.gif 125B
blank.gif 108B
vline.gif 103B
empty.gif 43B
ExSound.htm 19KB
ExHenge.htm 18KB
ExTexture.htm 18KB
mt0024.htm 16KB
mt0329.htm 15KB
ExSpotLight.htm 15KB
mt0367.htm 15KB
mt0065.htm 14KB
mt0102.htm 14KB
mt0514.htm 14KB
mt0000.htm 13KB
GearBox.htm 12KB
ExBluePrint.htm 11KB
mt0454.htm 11KB
mt0426.htm 11KB
mt0234.htm 11KB
mt0291.htm 11KB
ExSwitch.htm 11KB
ExDepthCue.htm 10KB
ExClip.htm 10KB
mt0170.htm 10KB
ExAppearance.htm 10KB
ColumnScene.htm 9KB
SphereMotion.htm 9KB
mt0211.htm 9KB
PickWorld.htm 9KB
mt0148.htm 9KB
ExDirectionalLight.htm 9KB
mt0493.htm 8KB
ExPointLight.htm 8KB
ExLightBounds.htm 8KB
mt0271.htm 8KB
mt0005.htm 8KB
ExLinearFog.htm 8KB
Drag.htm 8KB
mt0549.htm 7KB
mt0595.htm 7KB
mt0466.htm 7KB
ExExponentialFog.htm 7KB
mt0195.htm 7KB
mt0569.htm 7KB
A3DApplet.htm 7KB
ExLightScope.htm 6KB
mt0096.htm 6KB
mt0411.htm 6KB
mt0439.htm 6KB
ExRaster.htm 6KB
mt0107.htm 5KB
ExText.htm 5KB
mt0318.htm 5KB
mt0482.htm 5KB
mt0137.htm 5KB
mt0172.htm 5KB
mt0140.htm 5KB
mt0261.htm 5KB
ExBackgroundImage.htm 5KB
mt0585.htm 5KB
mt0154.htm 5KB
preface.htm 4KB
ExAmbientLight.htm 4KB
mt0091.htm 4KB
mt0237.htm 4KB
mt0484.htm 4KB
mt0518.htm 4KB
ExBackgroundColor.htm 4KB
mt0086.htm 4KB
mt0084.htm 4KB
mt0088.htm 4KB
mt0082.htm 4KB
mt0293.htm 4KB
mt0205.htm 4KB
mt0200.htm 4KB
mt0600.htm 4KB
bios.htm 3KB
mt0108.htm 3KB
mt0480.htm 3KB
mt0447.htm 3KB
mt0035.htm 3KB
mt0501.htm 3KB
mt0132.htm 3KB
mt0275.htm 3KB
mt0429.htm 3KB
java.htm 3KB
mt0078.htm 3KB
mt0080.htm 3KB
mt0322.htm 3KB
mt0041.htm 3KB
mt0405.htm 3KB
共 919 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
puchuanqian
- 粉丝: 5
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0