Pinecoast Software Inc.
      Home
Subscribe
 

Tutorial: Basic 2D Shapes

The 2D shapes are all restricted to the xy plane. These shapes were introduced in version 3.0, and so cannot be used in Vrml97 files. If these shapes are used in the Immersive profile, it is necessary to specify the Geometry2D component. In classic Vrml format, ...

 


#X3D V3.0 utf8
PROFILE Immersive

COMPONENT Geometry2D:2
...

 

In X3D format, ...

 


<X3D profile="Immersive" version="3.0">
  <head>
    <component name="Geometry2D" level="2"/>
  </head>
  ...

 

Arc2D and Circle

A circle is specified simply by its radius. An Arc2D has a radius, and also a startAngle and endAngle. All angles are specified in radians.



ArcClose2D

An ArcClose2D is similar to an Arc2D, having radius, startAngle and endAngle. In addition, there is a closureType field that specifies the type of return to the starting point. The two possible values for the closureType is PIE and CHORD.



Polypoint2D

The point field of a Polypoint2D contains a list of two dimensional points in the xy plane.



Polyline2D

The point field of a Polyline2D contains a list of two dimensional points in the xy plane. These points are connected to form a single polyline.



Disk2D

The Disk2D node has innerRadius and outerRadius fields. The innerRadius is less than the outerRadius and specifies the size of the hole in the center. The disk illustrated has innerRadius equal to 0. A texture is applied by pasting it onto the square that bounds the disk.



Rectangle2D

The size field of a Rectangle2D is a two dimensional vector that specifies the dimensions parallel to the x and y axes. A texture is stretched to fill the rectangle. For the texture the first direction is along the longest side. This is the u axis for the texture. The v axis is the other direction.



Rectangle2D

If the height is greater than the width, the y axis is the u axis for the texture. The v axis for the texture will be along the x axis. To preserve the orientation of the u and v axes, the texture faces toward the negative z axis.

If this texturing is not desired, it is necessary to create the rectangle with an IndexedFaceSet and the TextureCoordinates should be specified directly.



TriangleSet2D

The vertices field of the TriangleSet2D node contains a list of two dimensional points in the xy plane. The first three points form the first triangle, the next three points form the second triangle, etc. A texture is applied by finding the smallest rectangle that contains this triangle set, and then applying the texture to this rectangle.













































































































Copyright © Pinecoast Software 2000-2008. All rights reserved.