Geometry Objects

Geometry Objects

Chi Chung Ko (National University of Singapore, Singapore) and Chang Dong Cheng (CCS Automation PTE LTD, Singapore)
Copyright: © 2009 |Pages: 43
DOI: 10.4018/978-1-59904-789-8.ch003
OnDemand PDF Download:
$37.50

Abstract

To create 3D graphics, we have to build graphics or visual objects and position them appropriately in a virtual scene. In general, there are three possible approaches for doing this (Java 3D geometry, 2006). One approach is to make use of geometry utility classes to create basic geometric shapes or primitives. The basic shapes are boxes, spheres, cones, and cylinders. Another approach is to employ commercial modeling tools, such as 3D studio max, and have the results loaded into Java 3D. Lastly, custom geometrical shapes or objects can also be created by defining their vertices. While using utility classes or commercial modeling tools may be simpler and less time consuming, creating objects based on specifying vertices corresponds to the most general method. From a certain angle, the latter can in fact be regarded as the foundation from which the other approaches are based. The main thrust in this chapter will thus be on how objects can be built from their vertices, with some brief discussion on using utility classes presented toward the end of the chapter.
Chapter Preview
Top

Shape3d

As specified in the constructor of Figure 1, the most basic method for creating and specifying the geometry and appearance of an object is through the Shape3D class. The geometry component of this class hold the geometric data for the 3D object to be created, while the appearance component defines physical properties like color and line styles.

Figure 1.

Specifying geometry and appearance of Shape3D objects

After its definition, a Shape3D class can be instantiated to create one or several Shape3D objects. These objects are usually added as child nodes to a BranchGroup, TransformGroup or any appropriate group node. The node components of the Shape3D object include objects under the Geometry and Appearance classes. The latter is optional, but will most likely be present.

Figure 2 shows the structure of a created Shape3D object and its components under a TransformGroup. The corresponding code segment is shown in Figure 3. Specifically, in line 17, objRoot is an instance of the branch group. Line 18 creates an object objTrans and add it as a child of objRoot in the scene graph. In line 20, the constructor for the createShape3D subclass is invoked and an instance of the Shape3D class is created and added to the TransformGroup. Using the setGeometry method, line 32 specifies the geometry for the created Shape3D object to that from a private createGeometry method. This private method specifies the geometrical shape of the visual object to be rendered. How this specification can be written will be discussed in subsequent sections.

Figure 2.

A Shape3D object and its components

Figure 3.

Code segment structure for setting up a scene with a single Shape3D node

Top

Geometryarray Class

As discussed earlier in the first section, the shape of the visual object to be rendered is specified by a geometry object, which is a component under a Shape3D object. The creation of a geometry object can be done using the geometry class, which is an abstract superclass.

Under the geometry class (Java 3D API specification, 2006), a useful abstract subclass is the GeometryArray class and the class hierarchy is shown in Figure 4. Figure 5 illustrates the geometry subclasses.

Figure 4.

GeometryArray class hierarchy

Figure 5.

Geometry subclasses

Complete Chapter List

Search this Book:
Reset
Table of Contents
Preface
Chi Chung Ko
Chapter 1
Chi Chung Ko, Chang Dong Cheng
Web-based virtual reality is fast becoming an important application and technological tools in the next generation of games and simulation as well... Sample PDF
Virtual Reality and Java 3D
$37.50
Chapter 2
Java 3D Overview  (pages 18-31)
Chi Chung Ko, Chang Dong Cheng
In the last chapter, a brief introduction on the creation of 3D content through the use of Java 3D and other programming methodologies for virtual... Sample PDF
Java 3D Overview
$37.50
Chapter 3
Geometry Objects  (pages 32-74)
Chi Chung Ko, Chang Dong Cheng
To create 3D graphics, we have to build graphics or visual objects and position them appropriately in a virtual scene. In general, there are three... Sample PDF
Geometry Objects
$37.50
Chapter 4
Appearance Objects  (pages 75-96)
Chi Chung Ko, Chang Dong Cheng
In the last chapter, the creation of the skeletons or shapes of 3D objects has been discussed through the use of geometry objects in Java 3D. In... Sample PDF
Appearance Objects
$37.50
Chapter 5
Textures  (pages 97-113)
Chi Chung Ko, Chang Dong Cheng
Although extensive use of basic attributes such as color and material will be able to make an object realistic to the human user, it will be time... Sample PDF
Textures
$37.50
Chapter 6
Chi Chung Ko, Chang Dong Cheng
How the properties of virtual 3D objects can be specified and defined has been discussed in earlier chapters. However, how a certain virtual object... Sample PDF
Lighting, Fog, and Background
$37.50
Chapter 7
Animation Objects  (pages 132-158)
Chi Chung Ko, Chang Dong Cheng
We have discussed important Java 3D objects that are basically static in the last few chapters. Starting from this chapter, we will be looking at... Sample PDF
Animation Objects
$37.50
Chapter 8
Interaction  (pages 159-187)
Chi Chung Ko, Chang Dong Cheng
In Chapter VII, we discussed how animation can be applied in Java 3D to increase the visual impact of a virtual 3D world and illustrate the dynamic... Sample PDF
Interaction
$37.50
Chapter 9
Picking  (pages 188-216)
Chi Chung Ko, Chang Dong Cheng
The last two chapters have discussed how animation and interaction can be created in Java 3D to increase visual impact, to show object dynamics and... Sample PDF
Picking
$37.50
Chapter 10
Chi Chung Ko, Chang Dong Cheng
One of the most useful and important advantages of 3D graphics rendering and applications is that there is the possibility for the user to navigate... Sample PDF
Navigation, Input Devices, and Collision
$37.50
Chapter 11
Multiple Views  (pages 238-263)
Chi Chung Ko, Chang Dong Cheng
Our discussions in previous chapters have centered on the creation and interaction of visual objects in a virtual 3D world. The objects and scenes... Sample PDF
Multiple Views
$37.50
Chapter 12
Audio  (pages 264-275)
Chi Chung Ko, Chang Dong Cheng
Of all the human perceptions, two of the most important ones are perhaps vision and sound, for which we have developed highly specialized sensors... Sample PDF
Audio
$37.50
Chapter 13
Chi Chung Ko, Chang Dong Cheng
In this final chapter, we will describe the use of Java 3D as a visualization technology in the development of a Web-based 3D real time oscilloscope... Sample PDF
A Web-Based 3D Real Time Oscilloscope Experiment
$37.50
Appendix A: Downloading Software
Appendix B: Running the Rotating Cube Program
Appendix C: ViewManager
Appendix D: Main Applet for Web-Based 3D Experiment
Appendix E: Scene Graph Implementation for Web-Based 3D Experiment
Appendix F: Knob Class for Web-Based 3D Experiment
Appendix G: Navigation and Collision Detection for Web-Based 3D Experiment
Appendix H: Picking for Web-Based 3D Experiment
Appendix I: Program Summary and Screen Capture
About the Authors