Extensible 3D (X3D)
Part 1: Architecture and base components

14 Geometry2D component

--- X3D separator bar ---

cube 14.1 Introduction

14.1.1 Name

The name of this component is "Geometry2D". This name shall be used when referring to this component in the COMPONENT statement (see 7.2.5.4 Component statement).

14.1.2 Overview

This clause describes the Geometry2D component of this document. This includes how two-dimensional geometry is specified and what shapes are available. Table 14.1 provides links to the major topics in this clause.

Table 14.1 — Topics

cube 14.2 Concepts

14.2.1 Overview of geometry

The geometry2D component consists of only geometry nodes since it uses the shape, geometry property, and appearance nodes defined in the Shape component. The geometry2D nodes may be considered to be planar objects.

The two-dimensional coordinate system in which all 2D nodes are specified is defined to be the z=0 plane of the current 3D coordinate system with x- and y-axes coincident with those of the current 3D coordinate system. The origin of the 2D coordinate system is defined to be the origin of the 3D coordinate system.  The unspecified z-component of a 2D coordinate is defined to always have value zero. The position and orientation of 2D nodes are affected by all transformations whether 2D or 3D.

Each face in a 2D node is coplanar with the z=0 plane of the coordinate system in which it is defined. Faces have both a front and a back face. The front face is defined to be that on the positive side of the z=0 plane. Faces are subject to culling as defined elsewhere in this standard for 3D geometry.

When 2D nodes are viewed edge-on, they disappear as they have no depth.

14.2.2 Shape and geometry nodes

The Shape node is defined in 12 Shape component.

14.2.3 Geometric property nodes

Several geometry nodes contain geometric property nodes such as Coordinate, Color, ColorRGBA, and/or Normal. These nodes are specified in 11 Rendering component. The X3DTextureCoordinate nodes specified in 18 Texturing component are also geometry property nodes.

14.2.4 Appearance nodes

Shape nodes may specify an Appearance node that describes the appearance properties (material and texture) to be applied to the Shape's geometry. Appearance is described in 12 Shape component

The interaction between the appearance properties and properties specific to geometry nodes  is described in 12 Shape component.

cube 14.3 Node reference

14.3.1 Arc2D

Arc2D : X3DGeometryNode { 
  SFNode  [in,out] metadata   NULL  [X3DMetadataObject]
  SFFloat []       endAngle   π/2   [-2π,2π]
  SFFloat []       radius     1     (0,∞)
  SFFloat []       startAngle 0     [-2π,2π]
}

The Arc node specifies a linear circular arc whose center is at (0,0) and whose angles are measured starting at the positive x-axis and sweeping towards the positive y-axis.

The radius field specifies the radius of the circle of which the arc is a portion.

The arc extends from the startAngle counterclockwise to the endAngle. The values of startAngle and endAngle shall be in the range [-2π, 2π] radians (or the equivalent if a different angle base unit has been specified). If startAngle and endAngle have the same value, a circle is specified.

See 11.4.10 LineSet for additional considerations regarding line rendering and collision detection.

See Figure 14.1 for a depiction of the Arc node.

Arc2D node

Figure 14.1 — Arc2D node

14.3.2 ArcClose2D

ArcClose2D : X3DGeometryNode { 
  SFNode   [in,out] metadata    NULL  [X3DMetadataObject]
  SFString []       closureType "PIE" ["PIE"|"CHORD"]
  SFFloat  []       endAngle    π/2   [-2π,2π]
  SFFloat  []       radius      1     (0,∞)
  SFBool   []       solid       FALSE
  SFFloat  []       startAngle  0     [-2π,2π]
}

The ArcClose2D node specifies surface geometry describing a portion of a circle, whose center is at (0,0) and whose angles are measured starting at the positive x-axis and sweeping towards the positive y-axis.

The end points of the arc specified are connected as defined by the closureType field.

The radius field specifies the radius of the circle of which the arc is a portion.

The arc extends from the startAngle counterclockwise to the endAngle. The value of radius shall be greater than zero. The values of startAngle and endAngle shall be in the range [-2π, 2π] radians (or the equivalent if a different default angle base unit has been specified). If startAngle and endAngle have the same value, a circle is specified and closureType is ignored.  If the absolute difference between startAngle and endAngle is greater than or equal to 2π, a complete circle is produced with no chord or radial line(s) drawn from the center.

A closureType of "PIE" connects the end point to the start point by defining two straight line segments first from the end point to the center and then the center to the start point. This forms a pie wedge surface as shown in Figure 14.2.

ArcClose2D node pie closure

Figure 14.2 — ArcClose2D node ("PIE" closure)

A closureType of "CHORD" connects the end point to the start point by defining a straight line segment from the end point to the start point. This forms a surface as shown in Figure 14.3.

ArcClose2D node CHORD closure)

Figure 14.3 — ArcClose2D node ("CHORD" closure)

Textures are applied individually to each face of the ArcClose2D. On the front (+Z) and back (-Z) faces of the ArcClose2D, when viewed from the +Z-axis, the texture is mapped onto each face with the same orientation as if the image were displayed normally in 2D. TextureTransform affects the texture coordinates of the ArcClose2D (see 18.4.9 TextureTransform).

11.2.3 Common geometry fields provides a complete description of the solid field.

14.3.3 Circle2D

Circle2D : X3DGeometryNode { 
  SFNode  [in,out] metadata NULL  [X3DMetadataObject]
  SFFloat []       radius   1     (0,∞)
}

The Circle2D node specifies a circle centred at (0,0) in the local 2D coordinate system.

The radius field specifies the radius of the Circle2D. The value of radius shall be greater than zero.

Figure 14.4 illustrates the Circle2D node with a dashed linetype applied.

circle2D node

Figure 14.4 — Circle2D node

14.3.4 Disk2D

Disk2D : X3DGeometryNode { 
 SFNode  [in,out] metadata    NULL  [X3DMetadataObject]
 SFFloat []       innerRadius 0     [0,∞)
 SFFloat []       outerRadius 1     (0,∞)
 SFBool  []       solid       FALSE
}

The Disk2D node specifies a circular disk which is centred at (0, 0) in the local coordinate system.

The outerRadius field specifies the radius of the outer dimension of the Disk2D. The innerRadius field specifies the inner dimension of the Disk2D. The value of outerRadius shall be greater than zero. The value of innerRadius shall be greater than or equal to zero and less than or equal to outerRadius. If innerRadius is zero, the Disk2D is completely filled. Otherwise, the area within the innerRadius forms a hole in the Disk2D. If innerRadius is equal to outerRadius, a solid circular line shall be drawn using the current line properties.

Figure 14.5 illustrates the Disk2D node containing a non-zero innerRadius.

Disk2D node

Figure 14.5 — Disk2D node

Textures are applied individually to each face of the Disk2D. On the front (+Z) and back (-Z) faces of the Disk2D, when viewed from the +Z-axis, the texture is mapped onto each face with the same orientation as if the image were displayed normally in 2D. TextureTransform affects the texture coordinates of Disk2D nodes (see 18.4.9 TextureTransform).

11.2.3 Common geometry fields provides a complete description of the solid field.

14.3.5 Polyline2D

Polyline2D : X3DGeometryNode { 
  SFNode  [in,out] metadata     NULL  [X3DMetadataObject]
  MFVec2f []       lineSegments []    (-∞,∞)
}

The Polyline2D node specifies a series of contiguous line segments in the local 2D coordinate system connecting the specified vertices.

The lineSegments field specifies the vertices to be connected.

See 11.4.10 LineSet for additional considerations regarding line rendering and collision detection.

Figure 14.6 illustrates the Polyline2D node.

Polyline2D

Figure 14.6 — Polyline2D node

14.3.6 Polypoint2D

Polypoint2D : X3DGeometryNode { 
  SFNode  [in,out] metadata NULL [X3DMetadataObject]
  MFVec2f [in,out] point    []    (-∞,∞)
}

The Polyline2D node specifies a set of vertices in the local 2D coordinate system at each of which is displayed a point.

The points field specifies the vertices to be displayed.

Figure 14.7 illustrates the Polypoint2D node by depicting the line in Figure 14.6 (with points augmented for illustrative purposes).

Polypoint2D node

Figure 14.7 — Polypoint2D node

14.3.7 Rectangle2D

Rectangle2D : X3DGeometryNode { 
  SFNode  [in,out] metadata NULL  [X3DMetadataObject]
  SFVec2f []       size     2 2   (0,∞)
  SFBool  []       solid    FALSE
}

The Rectangle2D node specifies a rectangle centred at (0, 0) in the current local 2D coordinate system and aligned with the local coordinate axes. By default, the box measures 2 units in each dimension, from -1 to +1.

The size field specifies the extents of the box along the X- axis and Y-axis respectively, and each component value shall be greater than zero. Figure 14.8 illustrates the Rectangle2D node with a FillProperties node defining a hatch style.

Rectangle2D node

Figure 14.8 — Rectangle2D node

Textures are applied individually to each face of the Rectangle2D. On the front (+Z) and back (-Z) faces of the Rectangle2D, when viewed from the +Z-axis, the texture is mapped onto each face with the same orientation as if the image were displayed normally in 2D. TextureTransform affects the texture coordinates of the Rectangle2D (see 18.4.9 TextureTransform).

11.2.3 Common geometry fields provides a complete description of the solid field.

14.3.8 TriangleSet2D

TriangleSet2D : X3DGeometryNode { 
  SFNode  [in,out] metadata NULL  [X3DMetadataObject]
  MFVec2f [in,out] vertices []    (-∞,∞)
  SFBool  []       solid    FALSE
}

The TriangleSet2D node specifies a set of triangles in the local 2D coordinate system.

The vertices field specifies the triangles to be displayed. The number of vertices provided shall be evenly divisible by three.  Excess vertices shall be ignored.

Figure 14.9 illustrates the TriangleSet2D node.

TriangleSet2D node

Figure 14.9 — TriangleSet2D node

11.2.3 Common geometry fields provides a complete description of the solid field.

Textures are applied individually to each face of the TriangleSet2D. On the front (+Z) and back (-Z) faces of the TriangleSet2D, when viewed from the +Z-axis, the texture is mapped onto each face with the same orientation as if the image were displayed normally in 2D. TextureTransform affects the texture coordinates of the TriangleSet2D (see 18.4.9 TextureTransform).

cube 14.4 Support levels

The Geometry2D component provides two levels of support as specified in Table 14.2. Level 1 provides the basic support for two-dimensional geometry with straight sides. Level 2 adds support for two-dimensional geometry with non-straight sides.

Table 14.2 — Geometry2D component support levels

Level Prerequisites Nodes/Features Support
1 Core 1
Grouping 1
Shape 1
Rendering 1
Polyline2D All fields fully supported.
Polypoint2D All fields fully supported.
Rectangle2D All fields fully supported.
TriangleSet2D All fields fully supported.
2 Core 1
Grouping 1
Shape 1
Rendering 1
All Level 1 Geometry2D nodes All fields fully supported.
Arc2D All fields fully supported.
ArcClose2D All fields fully supported.
Circle2D All fields fully supported.
Disk2D All fields fully supported.

--- X3D separator bar ---