Difference between revisions of "CADPart"

From Web3D.org
Jump to: navigation, search
 
Line 41: Line 41:
 
The following Part node:
 
The following Part node:
  
'''CADPart {
+
'''CADPart {'''
  center          C
+
'''  center          C'''
  rotation        R
+
'''  rotation        R'''
  scale            S
+
'''  scale            S'''
  scaleOrientation SR
+
'''  scaleOrientation SR'''
  translation      T
+
'''  translation      T'''
  children        [...]
+
'''  children        [...]'''
}'''
+
'''}'''
  
 
is equivalent to the nested sequence of:
 
is equivalent to the nested sequence of:
  
'''CADPart {
+
'''CADPart {'''
  translation T
+
'''  translation T'''
  children CADPart {
+
'''  children CADPart {'''
    translation C
+
'''    translation C'''
    children CADPart {
+
'''    children CADPart {'''
      rotation R
+
'''      rotation R'''
      children CADPart {
+
'''      children CADPart {'''
        rotation SR
+
'''        rotation SR'''
        children CADPart {
+
'''        children CADPart {'''
          scale S
+
'''          scale S'''
          children CADPart {
+
'''          children CADPart {'''
            rotation -SR
+
'''            rotation -SR'''
            children CADPart {
+
'''            children CADPart {'''
              translation -C
+
'''              translation -C'''
              children [...]
+
'''              children [...]'''
}}}}}}}'''
+
'''}}}}}}}'''
  
 
The ''name'' field documents the name of this part.
 
The ''name'' field documents the name of this part.
  
 
* [[Node Reference]]
 
* [[Node Reference]]

Revision as of 22:25, 1 February 2006

CADPart

CADPart : X3DGroupingNode, X3DProductStructureChildNode {
  MFNode     [in]     addChildren
  MFNode     [in]     removeChildren
  MFNode     [in,out] children       []       [CADFace]
  SFVec3f    [in,out] center           0 0 0    (-∞,∞)
  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    (-∞,∞)
  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 the Transformation hierarchy and Standard units and coordinate system sections of the X3D specification for a description of coordinate systems and transformations.

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

The Grouping and children node types section of the X3D specification 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. scale values may have any value: 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.