Java Reference
In-Depth Information
coordinate.set(radius, 0.0f, frontZ);
outerknobFace.setCoordinate(0, coordinate);
outerknobFace.setNormal(0, outNormal);
coordinate.set(radius, 0.0f, rearZ);
outerknobFace.setCoordinate(1, coordinate);
outerknobFace.setNormal(1, outNormal);
for(int count = 0; count < segmentCount; count++)
{
int index = 2 + count * 2;
tempAngle = segmentAngle * (double)(count + 1);
xDirection = (float)Math.cos(tempAngle);
yDirection = (float)Math.sin(tempAngle);
xKnob = radius * xDirection;
yKnob = radius * yDirection;
outNormal.set(xDirection, yDirection, 0.0f);
coordinate.set(xKnob, yKnob, frontZ);
outerknobFace.setCoordinate(index, coordinate);
outerknobFace.setNormal(index, outNormal);
coordinate.set(xKnob, yKnob, rearZ);
outerknobFace.setCoordinate(index + 1, coordinate);
outerknobFace.setNormal(index + 1, outNormal);
}
newShape = new Shape3D(outerknobFace, look);
PickTool.setCapabilities(newShape, PickTool.INTERSECT_FULL);
this.addChild(newShape);
Appearance dotlook = new Appearance();
Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
Color3f objColor = new Color3f(1.0f, 0.0f, 0.0f);
dotlook.setMaterial(new Material(objColor, black, objColor, white, 100.0f));
Point3f[] verts =
{
// front face
new Point3f(1.0f*radius, -0.06f*radius, 0.52f*length),
new Point3f(1.0f*radius, 0.06f*radius, 0.52f*length),
new Point3f(0.92f*radius, 0.06f*radius, 0.52f*length),
new Point3f(0.92f*radius, -0.06f*radius, 0.52f*length),
// right face
new Point3f(1.0f*radius, -0.06f*radius, -0.52f*length),
new Point3f(1.0f*radius, 0.06f*radius, -0.52f*length),
new Point3f(1.0f*radius, 0.06f*radius, 0.52f*length),
new Point3f(1.0f*radius, -0.06f*radius, 0.52f*length),
// top face
new Point3f(1.0f*radius, 0.06f*radius, 0.52f*length),
new Point3f(1.0f*radius, 0.06f*radius, -0.52f*length),
new Point3f(0.92f*radius, 0.06f*radius, -0.52f*length),
Search WWH ::




Custom Search