Java Reference
In-Depth Information
any graphics system, Java 3D included, point and line attributes are the two most funda-
mental attributes on which all visual objects are constructed.
In Java 3D, PointAttributes objects control how points in the virtual universe are ren-
dered. The PointAttributes class has several methods to increase the size of a single point.
However, note that a point will appear to be square in shape unless the setPointAntialias-
ingEnable() method is set to true.
Figure 9. Second segment of LineAttributesExample1.java and result
25.
26. public BranchGroup createSceneGraph() {
27.
BranchGroup objRoot = new BranchGroup();
28.
//add more lines here
29.
//test line width
30.
objRoot.addChild(new aLine(-0.8f, 0.8f, 0.8f, 0.8f, 1f, LineAttributes.PATTERN_SOLID, false));
31.
objRoot.addChild(new aLine(-0.8f, 0.7f, 0.8f, 0.7f, 3f, LineAttributes.PATTERN_SOLID, false));
32.
objRoot.addChild(new aLine(-0.8f, 0.6f, 0.8f, 0.6f, 5f, LineAttributes.PATTERN_SOLID, false));
33.
34.
//test line pattern
35.
objRoot.addChild(new aLine(-0.8f, 0.4f, 0.8f, 0.4f, 3f, LineAttributes.PATTERN_DASH, false));
36.
objRoot.addChild(new aLine(-0.8f, 0.3f, 0.8f, 0.3f, 3f, LineAttributes.PATTERN_DOT, false));
37.
objRoot.addChild(new aLine(-0.8f, 0.2f, 0.8f, 0.2f, 3f, LineAttributes.PATTERN_DASH_DOT, false));
38.
39.
//test antialiasing
40.
objRoot.addChild(new aLine(-0.8f, -0.8f, -0.2f, -0.1f, 1f, LineAttributes.PATTERN_SOLID, false));
41.
objRoot.addChild(new aLine(-0.7f, -0.8f, -0.1f, -0.1f, 1f, LineAttributes.PATTERN_SOLID, true));
42.
objRoot.addChild(new aLine(-0.6f, -0.8f, 0.0f, -0.1f, 3f, LineAttributes.PATTERN_SOLID, false));
43.
objRoot.addChild(new aLine(-0.5f, -0.8f, 0.1f, -0.1f, 3f, LineAttributes.PATTERN_SOLID, true));
44.
objRoot.addChild(new aLine(-0.4f, -0.8f, 0.2f, -0.1f, 1f, LineAttributes.PATTERN_DASH, false));
45.
objRoot.addChild(new aLine(-0.3f, -0.8f, 0.3f, -0.1f, 1f, LineAttributes.PATTERN_DASH, true));
46.
objRoot.addChild(new aLine(-0.2f, -0.8f, 0.4f, -0.1f, 3f, LineAttributes.PATTERN_DASH, false));
47.
objRoot.addChild(new aLine(-0.1f, -0.8f, 0.5f, -0.1f, 3f, LineAttributes.PATTERN_DASH, true));
48.
49. objRoot.compile();
50.
return objRoot;
51. }
Search WWH ::




Custom Search