Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

Sensory Combinatronics Using 3D to Surf the WEB


Intro  

Concepts  3 Nodes  4 Fields/Events   5 Conformance
A Grammar   B Java   C JavaScript      D Examples       Quick Nodes
 
           
 

  

 

 

Chapter 3:
Node Reference

Intro
Anchor
Appearance
AudioClip
Background
Billboard
Box
Collision
Color
ColorInterpolator
Cone
Coordinate
CoordinateInterpolator
Cylinder
CylinderSen
sor
DirectionalLight
ElevationGrid
Extrusion
Fog
FontStyle
Group
ImageTexture
IndexedFaceSet
IndexedLineSet
Inline
LOD
Material
MovieTexture
NavigationInfo
Normal
NormalInterpolator
OrientationInterpolator
PixelTexture
PlaneSensor
PointLight
PointSet
PositionInterpolator
ProximitySensor
ScalarInterpolator
Script
Shape
Sound
Sphere
SphereSensor
SpotLight
Switch
Text
TextureCoordinate
TextureTransform
TimeSensor
TouchSensor
Transform
Viewpoint
VisibilitySensor
WorldInfo

 

+ 3.11 Cone


Cone { 

  field     SFFloat   bottomRadius 1        # (0,INF)

  field     SFFloat   height       2        # (0,INF)

  field     SFBool    side         TRUE

  field     SFBool    bottom       TRUE

}

The Cone node specifies a cone which is centred in the local coordinate system and whose central axis is aligned with the local Y-axis. The bottomRadius field specifies the radius of the cone's base, and the height field specifies the height of the cone from the centre of the base to the apex. By default, the cone has a radius of 1.0 at the bottom and a height of 2.0, with its apex at y = height/2 and its bottom at y = -height/2. Both bottomRadius and height must be greater than 0.0. Figure 3-10 illustrates the Cone node.

Cone node figure

Figure 3-10: Cone node

The side field specifies whether sides of the cone are created and the bottom field specifies whether the bottom cap of the cone is created. A value of TRUE specifies that this part of the cone exists, while a value of FALSE specifies that this part does not exist (not rendered or eligible for collision or sensor intersection tests).

When a texture is applied to the sides of the cone, the texture wraps counterclockwise (from above) starting at the back of the cone. The texture has a vertical seam at the back in the X=0 plane, from the apex (0, height/2, 0) to the point (0, -height/2, -bottomRadius). For the bottom cap, a circle is cut out of the texture square centred at (0, -height/2, 0) with dimensions (2 × bottomRadius) by (2 × bottomRadius). The bottom cap texture appears right side up when the top of the cone is rotated towards the -Z-axis. TextureTransform affects the texture coordinates of the Cone.

The Cone geometry requires outside faces only. When viewed from the inside the results are undefined.

TIP: Cone nodes are specified in the geometry field of a Shape node; they may not be children of a Transform or Group node.
 

TECHNICAL NOTE: The VRML 1.0 version of the Cone was almost exactly the same. The only difference is the specification of the cone parts. VRML 1.0 has a special SFBitmask field for specifying a set of bits. One of the simplifications done in VRML 2.0 was removing that field type, since the same results can be achieved using multiple SFBool fields. So, the VRML 1.0 Cone's parts SFEnum field becomes the side and bottom SFBool fields.

Like the rest of the geometry primitives (Box, Sphere, and Cylinder), none of the fields of Cone are exposed, allowing very lightweight, efficient implementations. If you need to change the size of a cone, you must modify a parent Transform node's scale field. If you want to turn the parts of a Cone on and off, you must either simulate that by using a Switch node containing several Cone Shapes, or you must remove the Cone from its Shape (effectively deleting it) and replace it with a newly created Cone.

EXAMPLE (click to run): The following example illustrates the use of the Cone node (see Figure 3-11). The first cone sits on top of the second cone. Note the default texture map orientation as seen in the second Cone:

#VRML V2.0 utf8

Transform { children [

  Transform {

    translation 0 2.0 0      # sit on top of other Cone

    children Transform {

      translation 0 -1 0

      children Shape {

        geometry Cone { bottomRadius 2 height 1 }

        appearance Appearance {

          material Material { diffuseColor 1 1 1 }

        }

      }

    }

  }

  Transform {

    translation 0 1 0         # sit on y=0

    children Transform {

      translation 0 -1 0

      children Shape {

        geometry Cone {

          bottomRadius 2 height 4 bottom FALSE

        }

        appearance Appearance {

          material Material { diffuseColor 1.0 1.0 1.0 }

          texture ImageTexture { url "marble2.gif" }

        }

      }

    }

  }

  DirectionalLight { direction -.5 -0.5 .6 }

  Background { skyColor 1 1 1 }

  NavigationInfo { type "EXAMINE" }

]}


Cone node example

Figure 3-11: Example Cone Nodes with Texture Image