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

32 CAD geometry component

# 32.1 Introduction

## 32.1.1 Name

The name of this component is "CADGeometry". The CADGeometry component provides X3D support for Computer-Aided Design (CAD) model geometry. This name shall be used when referring to this component in the COMPONENT statement (see 7.2.5.4 Component statement).

## 32.1.2 Overview

This clause describes the CADGeometry component of this part of ISO/IEC 19775. This includes how 3D geometry is specified and what shapes are available. Table 32.1 provides links to the major topics in this clause.

Table 32.1 — Topics

32.1 Introduction 32.1.1 Name 32.1.2 Overview 32.2 Concepts 32.2.1 Overview of CAD geometry 32.2.2 Product Structure Nodes 32.2.3 CAD layer relationships 32.2.4 Quad nodes 32.2.5 Common geometry fields 32.3 Abstract Types 32.3.1 X3DProductStructureChildNode 32.4 Node reference 32.4.1 CADAssembly 32.4.2 CADFace 32.4.3 CADLayer 32.4.4 CADPart 32.4.5 IndexedQuadSet 32.4.6 QuadSet 32.5 Support levels Figure 32.1 — QuadSet Table 32.1 — Topics Table 32.2 — CADGeometry component support levels

# 32.2 Concepts

## 32.2.1 Overview of geometry

The CADGeometry component consists of two types of nodes: product structure nodes and quad geometry nodes. Together, these node types are used to describe CAD-specific data representations for X3D worlds.

## 32.2.2 Product structure nodes

Three nodes maintain CAD structural relationships. These nodes define the shape of a tangible object. Additional content may be grouped with these nodes using the CADLayer node. These nodes are, in hierarchy order:

1. CADAssembly represents a product assembly composed of subassemblies and parts.
2. CADPart is a physical object with a defined shape. It is composed of CADFace nodes which represent the spatial boundary of the object.
3. CADFace contains a single Shape node defining one face of CADPart.

This hierarchy structures the file in a way that facilitates reuse of the CAD data in different domains.

## 32.2.3 CAD layer relationships

The CADLayer node maintains CAD layer relationships. CAD layers are used to visually and/or functionally organize geometric content.

The CADLayer node allows CADAssembly and CADPart nodes to be grouped together to model relationship beyond assembly structure. It also allows additional content beyond physical shape to be grouped with CADAssembly and CADPart nodes. This additional content may include:

- Text nodes containing annotations and dimension information.
- Shape nodes representing abstract geometric relations such as tolerance data and features.

## 32.2.4 Quad nodes

Quad nodes represent collections of planar quadrilateral polygons. The IndexedQuadSet node specifies the vertices using indices while the QuadSet node specifies the vertices directly.

## 32.2.5 Common geometry fields

Several 3D CADGeometry nodes share common fields to describe attributes. These fields that specify the vertex ordering and whether the shape is solid are named ccw and solid respectively. Common 3D geometry fields are described in 11.2.3 Common geometry fields.

# 32.3 Abstract types

## 32.3.1 X3DProductStructureChildNode

    X3DProductStructureChildNode : X3DChildNode {
      SFNode   [in,out] metadata NULL [X3DMetadataObject]
      SFString [in,out] name     ""
    }

The X3DProductStructureChildNode abstract node type marks nodes that are valid product structure children.

# 32.4 Node reference

## 32.4.1 CADAssembly

    CADAssembly : X3DGroupingNode, X3DProductStructureChildNode {
      MFNode   [in]     addChildren
      MFNode   [in]     removeChildren
      MFNode   [in,out] children       []       [X3DProductStructureChildNode, X3DGroupingNodeX3DChildNode]
      SFBool   [in out] bboxDisplay    FALSE
      SFNode   [in,out] metadata       NULL     [X3DMetadataObject]
      SFString [in,out] name           ""
      SFBool   [in out] visible        TRUE
      SFVec3f  []       bboxCenter     0 0 0    (-∞,∞)
      SFVec3f  []       bboxSize       -1 -1 -1 [0,∞) or −1 −1 −1
    }

The CADAssembly node holds a set of assemblies or parts grouped together.

The children field can contain X3DProductStructureChildNode types. Each child will be either a sub-assembly or a part.

The children field can contain X3DChildNode types.

The name field specifies the name of the CADAssembly.

## 32.4.2 CADFace

    CADFace : X3DProductStructureChildNode, X3DBoundedObject {
      SFNode   [in,out] metadata    NULL     [X3DMetadataObject]
      SFBool   [in out] bboxDisplay FALSE
      SFString [in,out] name        ""
      SFNode   [in,out] shape       NULL     [X3DShapeNode, LODShape|LOD|Transform]
      SFBool   [in out] visible     TRUE
      SFVec3f  []       bboxCenter  0 0 0    (-∞, ∞)
      SFVec3f  []       bboxSize    -1 -1 -1 [0, ∞) or -1 -1 -1
    }

The CADFace node holds the geometry representing a face of a part.

The name field specifies the name of the CADFace.

The shape field contains the Shape node providing the geometry and appearance for the face or an LOD node containing different detail levels of the shape. If an LOD node is provided, each child of the LOD node shall be a single Shape of varying complexity.

The shape field contains the Shape node providing the geometry and appearance for the face, or a Transform node relocating its children, or an LOD node containing different detail levels of the shape. If an LOD node is provided, each child of the LOD node shall be a single Shape of varying complexity or another Transform node. If a Transform node is provided, each child of the Transform node shall be a single Shape or another Transform or LOD node. In any case, only zero or one Shape under the CADFace node shall be active at any time.

## 32.4.3 CADLayer

    CADLayer : X3DGroupingNode {
      MFNode   [in]     addChildren
      MFNode   [in]     removeChildren
      MFNode   [in,out] children       []       [X3DChildNode]
      SFBool   [in out] bboxDisplay    FALSE
      SFNode   [in,out] metadata       NULL     [X3DMetadataObject]
      SFString [in,out] name           ""
      MFBool   [in,out] visible        []
      SFBool   [in out] visible        TRUE
      SFVec3f  []       bboxCenter     0 0 0    (-∞,∞)
      SFVec3f  []       bboxSize       -1 -1 -1 [0,∞) or −1 −1 −1
    }

The CADLayer node defines a hierarchy of nodes used for showing layer structure for the CAD model.

The name field describes the content of the layer.

The children field contains all nodes defined for this layer.

The visible field specifies whether a particular child and its sub-children are visible. If the number of values is less than the number of children, the remaining children shall be visible.

## 32.4.4 CADPart

    CADPart : X3DGroupingNode, X3DProductStructureChildNode {
      MFNode     [in]     addChildren
      MFNode     [in]     removeChildren
      SFVec3f    [in,out] center           0 0 0    (-∞,∞)
      MFNode     [in,out] children         []       [CADFace]
      SFBool     [in out] bboxDisplay      FALSE
      SFNode     [in,out] metadata         NULL     [X3DMetadataObject]
      SFString   [in,out] name             ""
      SFRotation [in,out] rotation         0 0 1 0  [-1,1] or (-∞,∞)
      SFVec3f    [in,out] scale            1 1 1    (0,∞)
      SFRotation [in,out] scaleOrientation 0 0 1 0  [-1,1] or (-∞,∞)
      SFVec3f    [in,out] translation      0 0 0    (-∞,∞)
      SFBool     [in out] visible          TRUE
      SFVec3f    []       bboxCenter       0 0 0    (-∞,∞)
      SFVec3f    []       bboxSize         -1 -1 -1 [0,∞) or −1 −1 −1
    }

The CADPart node is a grouping node that defines a coordinate system for its children that is relative to the coordinate systems of its ancestors. See 4.3.5 Transformation hierarchy and 4.3.6 Standard units and coordinate system for a description of coordinate systems and transformations.

The CADPart node represents the location and faces that constitute a part in the CAD model.

10.2.1 Grouping and children node types provides a description of the children, addChildren, and removeChildren fields.

The bboxCenter and bboxSize fields specify a bounding box that encloses the children of the Part node. This is a hint that may be used for optimization purposes. The results are undefined if the specified bounding box is smaller than the actual bounding box of the children at any time. A default bboxSize value, (-1, -1, -1), implies that the bounding box is not specified and, if needed, shall be calculated by the browser. The bounding box shall be large enough at all times to enclose the union of the group's children's bounding boxes; it shall not include any transformations performed by the group itself (i.e., the bounding box is defined in the local coordinate system of the children).

The translation, rotation, scale, scaleOrientation and center fields define a geometric 3D transformation consisting of (in order):

1. a (possibly) non-uniform scale about an arbitrary point;
2. a rotation about an arbitrary point and axis;
3. a translation.

The center field specifies a translation offset from the origin of the local coordinate system (0,0,0). The rotation field specifies a rotation of the coordinate system. The scale field specifies a non-uniform scale of the coordinate system. The scale field may have values that are positive, negative (indicating a reflection), or zero. A value of zero indicates that any child geometry shall not be displayed. The scaleOrientation specifies a rotation of the coordinate system before the scale (to specify scales in arbitrary orientations). The scaleOrientation applies only to the scale operation. The translation field specifies a translation to the coordinate system.

Given a 3-dimensional point P and Part node, P is transformed into point P' in its parent's coordinate system by a series of intermediate transformations. In matrix transformation notation, where C (center), SR (scaleOrientation), T (translation), R (rotation), and S (scale) are the equivalent transformation matrices,

      P' = T * C * R * SR * S * -SR * -C * P

The following Part node:

    CADPart {
      center           C
      rotation         R
      scale            S
      scaleOrientation SR
      translation      T
      children         [...]
    }

is equivalent to the nested sequence of:

    CADPart {
      translation T
      children CADPart {
        translation C
        children CADPart {
          rotation R
          children CADPart {
            rotation SR
            children CADPart {
              scale S
              children CADPart {
                rotation -SR
                children CADPart {
                  translation -C
                  children [...]
    }}}}}}}

The name field documents the name of this part.

## 32.4.5 IndexedQuadSet

    IndexedQuadSet : X3DComposedGeometryNode {
      MFInt32 [in]     set_index       []   [0,∞)
      MFNode  [in,out] attrib          []   [X3DVertexAttributeNode]
      SFNode  [in,out] color           NULL [X3DColorNode]
      SFNode  [in,out] coord           NULL [X3DCoordinateNode]
      SFNode  [in,out] fogCoord        NULL [FogCoordinate]
      SFNode  [in,out] metadata        NULL [X3DMetadataObject]
      SFNode  [in,out] normal          NULL [X3DNormalNode]
      SFNode  [in,out] texCoord        NULL [X3DTextureCoordinateNode]
      SFBool  []       ccw             TRUE
      SFBool  []       colorPerVertex  TRUE
      SFBool  []       normalPerVertex TRUE
      SFBool  []       solid           TRUE
      MFInt32 []       index           []   [0,∞)
    }

The IndexedQuadSet node represents a 3D shape composed of a collection of individual quadrilaterals (quads) as depicted in Figure 32.1. IndexedQuadSet uses the indices in its index field to specify the vertices of each quad from the coord field. Each quad is formed from a set of four vertices of the X3DCoordinateNode node identified by four consecutive indices from the index field If the index field does not contain a multiple of four coordinate values, the remaining vertices shall be ignored.

The IndexedQuadSet node is specified in the local coordinate system and is affected by the transformations of its ancestors. Descriptions of the color, coord, normal, and texCoord fields are provided in the X3DColorNode, X3DCoordinateNode, X3DNormalNode, and X3DTextureCoordinateNode nodes, respectively. If values are provided for the color, normal and texCoord fields, the values are applied in the same manner as the values from the coord field and there shall be at least as many values as are present in the coord field. The value of the colorPerVertex field is ignored and always treated as TRUE. If the normal field is not supplied, normals shall be generated as follows:

- If normalPerVertex is TRUE, the normal at each vertex shall be the average of the normals for all quads that share that vertex.
- If normalPerVertex is FALSE, the normal at each vertex shall be perpendicular to the face for that quad.

The solid field determines whether the IndexedQuadSet is visible when viewed from the inside. 11.2.3 Common geometry fields provides a complete description of the solid field.

## 32.4.6 QuadSet

    QuadSet : X3DComposedGeometryNode {
      MFNode  [in,out] attrib          []   [X3DVertexAttributeNode]
      SFNode  [in,out] color           NULL [X3DColorNode]
      SFNode  [in,out] coord           NULL [X3DCoordinateNode]
      SFNode  [in,out] fogCoord        NULL [FogCoordinate]
      SFNode  [in,out] metadata        NULL [X3DMetadataObject]
      SFNode  [in,out] normal          NULL [X3DNormalNode]
      SFNode  [in,out] texCoord        NULL [X3DTextureCoordinateNode]
      SFBool  []       ccw             TRUE
      SFBool  []       colorPerVertex  TRUE
      SFBool  []       normalPerVertex TRUE
      SFBool  []       solid           TRUE
    }

The QuadSet node represents a 3D shape that represents a collection of individual planar quadrilaterals.

The coord field contains an X3DCoordinateNode node that defines the 3D vertices that define the quad. Each quad is formed from a consecutive set of four vertices of the coordinate node. If the coordinate node does not contain a multiple of four coordinate values, the remaining vertices shall be ignored.

Figure 32.1 depicts a QuadSet node with two quads. The ordering of the vertices is also shown.

Figure 32.1 — QuadSet node

The QuadSet node is specified in the local coordinate system and is affected by the transformations of its ancestors. Descriptions of the color, coord, normal, and texCoord fields are provided in the X3DColorNode, X3DCoordinateNode, X3DNormalNode, and X3DTextureCoordinateNode nodes, respectively. If values are provided for the color, normal, and texCoord fields, there shall be at least as many values as are present in the coord field. The value of the colorPerVertex field is ignored and always treated as TRUE. If the normal field is not supplied, the normal shall be generated as perpendicular to the face for either version of normalPerVertex.

The solid field determines whether the QuadSet is visible when viewed from the inside. 11.2.3 Common geometry fields provides a complete description of the solid field.

# 32.5 Support levels

The CADGeometry component provides two levels of support as specified in Table 32.2. Level 1 provides quad support. Level 2 adds support to describe product structure and layers.

Table 32.2 — CADGeometry component support levels

Level | Prerequisites | Nodes/Features | Support
--- | --- | --- | ---
1 | Core 1 Grouping 1 Rendering 1 Shape 1 |  |
|  | IndexedQuadSet | All fields fully supported.
|  | QuadSet | All fields fully supported.
2 | Core 1 Grouping 1 Rendering 1 Shape 1 |  |
|  | CADAssembly | All fields fully supported.
|  | CADFace | All fields fully supported.
|  | CADLayer | All fields fully supported.
|  | CADPart | All fields fully supported.