<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Immersive'  version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.0.xsd ' >
<head>
<meta name='titlecontent=' Geometry2dComponentPrototypes.x3d '/>
<meta name='descriptioncontent='X3D Geometry2D component nodes, implemented as prototypes for developmental use to provide backwards compatibility with VRML 97. Arc2D specifies a 2D linear circular arc. ArcClose2D specifies a portion of a circle. Circle2D specifies a 2D circular line. Disk2D specifies a 2D circular disk. Polyline2D specifies 2D line segments. Polypoint2D specifies 2D point array. Rectangle2D specifies a 2D rectangle. TriangleSet2D specifies 2D triangles. 2D nodes are considered particularly helpful for CADPart geometry and building user interfaces such as Heads-Up Displays (HUDs).'/>
<meta name='creatorcontent='Christos Kalogrias, Don Brutzman, Ken Curtin, Duane Davis'/>
<meta name='createdcontent='14 November 2003'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name=' warning content=' These examples are complete but only used for developmental testing, not regular X3D authoring. '/>
<meta name='referencecontent=' Geometry2dComponentExternProtos.x3d '/>
<meta name='referencecontent=' Geometry2dComponentExamples.x3d '/>
<meta name='referencecontent=' https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/geometry2D.html '/>
<meta name='subjectcontent='Geometry2D component nodes (Arc2D ArcClose2D Circle2D Disk2D Polyline2D Polypoint2D Rectangle2D TriangleSet2D)'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypes.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<!-- ==================== -->
<WorldInfo title='Geometry2dComponentPrototypes.x3d'/>
<ProtoDeclare name='Arc2D'>
<ProtoInterface>
<field name='startAngletype='SFFloatvalue='0accessType='initializeOnly'/>
<field name='endAngletype='SFFloatvalue='1.5707963265accessType='initializeOnly'/>
<field name='radiustype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<!-- Only the first node counts as the node type of a prototype. This node must be a geometry node. -->
<!-- ROUTE information for ArcIndexPoints node:  [from Arc2dToFaceSet3d.arcIndexSet3d to set_coordIndex ] -->
<IndexedLineSet DEF='ArcIndexPoints'>
<!-- ROUTE information for Arc3DPoints node:  [from Arc2dToFaceSet3d.arcSet3d to point ] -->
<Coordinate DEF='Arc3DPoints'/>
</IndexedLineSet>
<!-- Any nodes after initial node in a ProtoBody is not rendered. -->
<Group>
<IS>
<connect nodeField='metadataprotoField='metadata'/>
</IS>
<!-- ROUTE information for Arc2dToFaceSet3d node:  [from arcSet3d to Arc3DPoints.point ] [from arcIndexSet3d to ArcIndexPoints.set_coordIndex ] -->
<Script DEF='Arc2dToFaceSet3d'>
<field name='startAngletype='SFFloataccessType='initializeOnly'/>
<field name='endAngletype='SFFloataccessType='initializeOnly'/>
<field name='radiustype='SFFloataccessType='initializeOnly'/>
<field name='arcSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='arcIndexSet3dtype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='startAngleprotoField='startAngle'/>
<connect nodeField='endAngleprotoField='endAngle'/>
<connect nodeField='radiusprotoField='radius'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   numOfPoints = 100;

   if (radius < 0)
   {
      Browser.println ('[Arc2D] Warning:  invalid value, radius=' + value + ' must instead be >= 0');
   }

   if ((startAngle < 0) || (startAngle >= 2 * Math.PI))
   {
	Browser.println ('[Arc2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); // (]
   }

   if ((endAngle < 0) || (endAngle >= 2 * Math.PI))
   {
	Browser.println ('[Arc2D] Warning: endAngle=' + endAngle + ' must be within range [0..2pi)'); // (]
   }

   // equal startAngle, endAngle means draw full circle.
   // high out-of-range endAngle is OK for local computation.
   if (startAngle >= endAngle)
      endAngle = endAngle + 2 * Math.PI;

   differAng = Math.abs((endAngle - startAngle)) / numOfPoints;

   for (i = 0; i <= numOfPoints; i++)
   {
	arcSet3d[i] = new SFVec3f (radius * Math.cos(startAngle + i * differAng), radius * Math.sin(startAngle + i * differAng), 0.0);
        arcIndexSet3d[i] = i;
   }

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' Arc2dToFaceSet3d' fromField='arcSet3d' toNode=' Arc3DPoints' toField='point'/>
< ROUTE  fromNode=' Arc2dToFaceSet3d' fromField='arcIndexSet3d' toNode=' ArcIndexPoints' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='ArcClose2D'>
<ProtoInterface>
<field name='startAngletype='SFFloatvalue='0accessType='initializeOnly'/>
<field name='endAngletype='SFFloatvalue='1.5707963265accessType='initializeOnly'/>
<field name='radiustype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='closureTypetype='SFStringvalue='PIEaccessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for ArcPointFaceIndex node:  [from ArcClose2dToFaceSet3d.pointIndex to set_coordIndex ] -->
<IndexedFaceSet DEF='ArcPointFaceIndex'>
<!-- ROUTE information for ArcClose2DFaceCoordinate node:  [from ArcClose2dToFaceSet3d.arcSet3d to point ] -->
<Coordinate DEF='ArcClose2DFaceCoordinate'/>
</IndexedFaceSet>
<Group>
<!-- ROUTE information for ArcClose2dToFaceSet3d node:  [from arcSet3d to ArcClose2DFaceCoordinate.point ] [from pointIndex to ArcPointFaceIndex.set_coordIndex ] -->
<Script DEF='ArcClose2dToFaceSet3d'>
<field name='closureTypetype='SFStringaccessType='initializeOnly'/>
<field name='startAngletype='SFFloataccessType='initializeOnly'/>
<field name='endAngletype='SFFloataccessType='initializeOnly'/>
<field name='radiustype='SFFloataccessType='initializeOnly'/>
<field name='arcSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='pointIndextype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='closureTypeprotoField='closureType'/>
<connect nodeField='startAngleprotoField='startAngle'/>
<connect nodeField='endAngleprotoField='endAngle'/>
<connect nodeField='radiusprotoField='radius'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   if (radius < 0)
   {
      Browser.println ('[ArcClose2D] Warning:  invalid value, radius=' + value + ' must instead be >= 0');
   }

   if ((startAngle < 0) || (startAngle >= 2 * Math.PI))
   {
	Browser.println ('[ArcClose2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); //(]
   }

   if ((endAngle< 0) || (endAngle>= 2 * Math.PI))
   {
	Browser.println ('[ArcClose2D] Warning: endAngle=' + endAngle+ ' must be within range [0..2pi)'); // (]
    }

    // equal startAngle, endAngle means draw full circle.
    // high out-of-range endAngle is OK for local computation.
   if (startAngle >= endAngle)
      endAngle = endAngle + 2*Math.PI;

   numOfPoints = 100;
   differAng = Math.abs((endAngle - startAngle))/numOfPoints;

   for ( i=0 ; i<=numOfPoints ; i++)
   {
	if ( i == numOfPoints)
             arcSet3d[i] = new SFVec3f (0.0, 0.0, 0.0);
        else
             arcSet3d[i] = new SFVec3f ( radius*Math.cos(startAngle + i*differAng), radius*Math.sin(startAngle + i*differAng), 0.0 );
   }

   k=0;
   if (closureType =='PIE')
       for ( i=0 ; i<numOfPoints ; i++)
       {
        	pointIndex[k]   = numOfPoints;
        	pointIndex[k+1] = i;
        	pointIndex[k+2] = i + 1;
        	pointIndex[k+3]   = numOfPoints;
        	pointIndex[k+4] = -1;
        k=k+5;
	}
   else
       for ( i=0 ; i<numOfPoints-1 ; i++)
       {
              pointIndex[k]   = 0;
              pointIndex[k+1] = i;
              pointIndex[k+2] = i + 1;
              pointIndex[k+3]   = 0;
              pointIndex[k+4] = -1;
        k=k+5;
	}

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' ArcClose2dToFaceSet3d' fromField='arcSet3d' toNode=' ArcClose2DFaceCoordinate' toField='point'/>
< ROUTE  fromNode=' ArcClose2dToFaceSet3d' fromField='pointIndex' toNode=' ArcPointFaceIndex' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ArcClose2DUnfilled also provided since FillProperties not available in VRML 97 -->
<ProtoDeclare name='ArcClose2DUnfilled'>
<ProtoInterface>
<field name='startAngletype='SFFloatvalue='0accessType='initializeOnly'/>
<field name='endAngletype='SFFloatvalue='1.5707963265accessType='initializeOnly'/>
<field name='radiustype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='closureTypetype='SFStringvalue='PIEaccessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for ArcPointLineIndex node:  [from ArcClose2dToLineSet3d.pointIndex to set_coordIndex ] -->
<IndexedLineSet DEF='ArcPointLineIndex'>
<!-- ROUTE information for ArcClose2DLineCoordinate node:  [from ArcClose2dToLineSet3d.arcSet3d to point ] -->
<Coordinate DEF='ArcClose2DLineCoordinate'/>
</IndexedLineSet>
<Group>
<!-- ROUTE information for ArcClose2dToLineSet3d node:  [from arcSet3d to ArcClose2DLineCoordinate.point ] [from pointIndex to ArcPointLineIndex.set_coordIndex ] -->
<Script DEF='ArcClose2dToLineSet3d'>
<field name='closureTypetype='SFStringaccessType='initializeOnly'/>
<field name='startAngletype='SFFloataccessType='initializeOnly'/>
<field name='endAngletype='SFFloataccessType='initializeOnly'/>
<field name='radiustype='SFFloataccessType='initializeOnly'/>
<field name='arcSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='pointIndextype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='closureTypeprotoField='closureType'/>
<connect nodeField='startAngleprotoField='startAngle'/>
<connect nodeField='endAngleprotoField='endAngle'/>
<connect nodeField='radiusprotoField='radius'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{

   if (radius < 0)
   {
      Browser.println ('[ArcCloseUnfilled2D] Warning:  invalid value, radius=' + value + ' must instead be >= 0');
   }

   if ((startAngle < 0) || (startAngle >= 2 * Math.PI))
   {
	Browser.println ('[ArcCloseUnfilled2D] Warning: startAngle=' + startAngle + ' must be within range [0..2pi)'); //(]
   }

   if ((endAngle< 0) || (endAngle>= 2 * Math.PI))
   {
	Browser.println ('[ArcCloseUnfilled2D] Warning: endAngle=' + endAngle+ ' must be within range [0..2pi)'); //(]
    }

    // equal startAngle, endAngle means draw full circle.
    // high out-of-range endAngle is OK for local computation.
   if (startAngle >= endAngle)
      endAngle = endAngle + 2*Math.PI;

   numOfPoints = 100;
   differAng = Math.abs((endAngle - startAngle))/numOfPoints;

   for ( i=0 ; i<=numOfPoints +1 ; i++)
   {
	if ( i == numOfPoints +1)
             arcSet3d[i] = new SFVec3f (0.0, 0.0, 0.0);
        else
             arcSet3d[i] = new SFVec3f ( radius*Math.cos(startAngle + i*differAng), radius*Math.sin(startAngle + i*differAng), 0.0 );
   }

   if (closureType =='CHORD')
   {
	for ( i=0 ; i<=numOfPoints +1 ; i++)
	{
        	if ( i == numOfPoints +1)
             		pointIndex[i] = 0.0;
        	else
             		pointIndex[i] = i;
	}
   }
   else
   {
	for ( i=0 ; i<=numOfPoints +1 ; i++)
	{
         pointIndex[i] = i;
	}
         pointIndex[i] = 0.0;
   }

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' ArcClose2dToLineSet3d' fromField='arcSet3d' toNode=' ArcClose2DLineCoordinate' toField='point'/>
< ROUTE  fromNode=' ArcClose2dToLineSet3d' fromField='pointIndex' toNode=' ArcPointLineIndex' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='Circle2D'>
<ProtoInterface>
<field name='radiustype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for Circ3DPointsIndex node:  [from Circ2dToLineSet3d.circIndexSet3d to set_coordIndex ] -->
<IndexedLineSet DEF='Circ3DPointsIndex'>
<!-- ROUTE information for Circ3DPoints node:  [from Circ2dToLineSet3d.circSet3d to point ] -->
<Coordinate DEF='Circ3DPoints'/>
</IndexedLineSet>
<Group>
<!-- ROUTE information for Circ2dToLineSet3d node:  [from circSet3d to Circ3DPoints.point ] [from circIndexSet3d to Circ3DPointsIndex.set_coordIndex ] -->
<Script DEF='Circ2dToLineSet3d'>
<field name='radiustype='SFFloataccessType='initializeOnly'/>
<field name='circSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='circIndexSet3dtype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='radiusprotoField='radius'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
    if (radius < 0)
   {
      Browser.println ('[Circle2D] Warning:  invalid value, radius=' + value + ' must instead be >= 0');
   }


   numOfPoints = 100;
   differAng = 2*Math.PI/numOfPoints;

   for ( i=0 ; i<=numOfPoints ; i++)
   {
	circSet3d[i] = new SFVec3f ( radius*Math.cos(i*differAng), radius*Math.sin(i*differAng), 0.0 );
        circIndexSet3d[i] = i;
   }

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' Circ2dToLineSet3d' fromField='circSet3d' toNode=' Circ3DPoints' toField='point'/>
< ROUTE  fromNode=' Circ2dToLineSet3d' fromField='circIndexSet3d' toNode=' Circ3DPointsIndex' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='Disk2D'>
<ProtoInterface>
<field name='innerRadiustype='SFFloatvalue='0accessType='initializeOnly'/>
<field name='outerRadiustype='SFFloatvalue='1accessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for DiskPointsIndex node:  [from Disk2dToFaceSet3d.diskIndexSet3d to set_coordIndex ] -->
<IndexedFaceSet DEF='DiskPointsIndex'>
<!-- ROUTE information for Disk3DPoints node:  [from Disk2dToFaceSet3d.diskSet3d to point ] -->
<Coordinate DEF='Disk3DPoints'/>
</IndexedFaceSet>
<Group>
<!-- ROUTE information for Disk2dToFaceSet3d node:  [from diskSet3d to Disk3DPoints.point ] [from diskIndexSet3d to DiskPointsIndex.set_coordIndex ] -->
<Script DEF='Disk2dToFaceSet3d'>
<field name='innerRadiustype='SFFloataccessType='initializeOnly'/>
<field name='outerRadiustype='SFFloataccessType='initializeOnly'/>
<field name='diskSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='diskIndexSet3dtype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='innerRadiusprotoField='innerRadius'/>
<connect nodeField='outerRadiusprotoField='outerRadius'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   if (innerRadius < 0)
   {
      Browser.println ('[Disk2D] Warning:  invalid value, innerRadius=' + value + ' must instead be >= 0');
   }

   if (outerRadius < 0)
   {
      Browser.println ('[Disk2D] Warning:  invalid value, outerRadius=' + value + ' must instead be >= 0');
   }



   numOfPoints    = 100.0;
   diskSet3d      = new MFVec3f();
   diskIndexSet3d = new MFInt32();
   differAng = 2 * Math.PI/numOfPoints;


   for ( i=0 ; i<2*numOfPoints ; i++)
   {
        if ( i<numOfPoints)
	     diskSet3d[i] = new SFVec3f ( innerRadius*Math.cos(i*differAng), innerRadius*Math.sin(i*differAng), 0.0 );
        else
             diskSet3d[i] = new SFVec3f ( outerRadius*Math.cos((i-numOfPoints-1.0)*differAng), outerRadius*Math.sin((i-numOfPoints-1.0)*differAng), 0.0 );
   }


   k=0;
   for (i=0 ; i<numOfPoints ; i++)
   {
        diskIndexSet3d[k]   = i;
        diskIndexSet3d[k+1] = i + numOfPoints;
        diskIndexSet3d[k+2] = i + numOfPoints + 1;
        diskIndexSet3d[k+3]   = i;
        diskIndexSet3d[k+4] = -1;
        diskIndexSet3d[k+5] = i+1;
        diskIndexSet3d[k+6] = i ;
        diskIndexSet3d[k+7] = i + numOfPoints +1;
        diskIndexSet3d[k+8] = i +1;
        diskIndexSet3d[k+9] = -1;

        if (i == numOfPoints-1)
        {
        diskIndexSet3d[k]   = i;
        diskIndexSet3d[k+1] = i + numOfPoints;
        diskIndexSet3d[k+2] = numOfPoints;
        diskIndexSet3d[k+3]   = i;
        diskIndexSet3d[k+4] = -1;
        diskIndexSet3d[k+5] = 0;
        diskIndexSet3d[k+6] = i;
        diskIndexSet3d[k+7] = numOfPoints;
        diskIndexSet3d[k+8] = 0;
        diskIndexSet3d[k+9] = -1;
        }
   k=k+10;
   }

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' Disk2dToFaceSet3d' fromField='diskSet3d' toNode=' Disk3DPoints' toField='point'/>
< ROUTE  fromNode=' Disk2dToFaceSet3d' fromField='diskIndexSet3d' toNode=' DiskPointsIndex' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='Polyline2D'>
<ProtoInterface>
<field name='lineSegmentstype='MFVec2faccessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' />
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for LinesSegmentsIndexPoints node:  [from LineSegments2dToLineSet3d.lineSegmentsIndex to set_coordIndex ] -->
<IndexedLineSet DEF='LinesSegmentsIndexPoints'>
<!-- ROUTE information for LineSegments3DPoints node:  [from LineSegments2dToLineSet3d.lineSegments3D to point ] -->
<Coordinate DEF='LineSegments3DPoints'/>
</IndexedLineSet>
<Group>
<field name='lineSegmentstype='MFVec2faccessType='initializeOnly'/>
<field name='lineSegments3Dtype='MFVec3faccessType='outputOnly'/>
<field name='lineSegmentsIndextype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='lineSegmentsprotoField='lineSegments'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   for ( i=0 ; i<lineSegments.length ; i++)
   {
          lineSegments3D[i] = new SFVec3f ( lineSegments[i].x, lineSegments[i].y, 0.0 );
          lineSegmentsIndex[i] = i;
   }

     lineSegmentsIndex[i] = -1;

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' LineSegments2dToLineSet3d' fromField='lineSegments3D' toNode=' LineSegments3DPoints' toField='point'/>
< ROUTE  fromNode=' LineSegments2dToLineSet3d' fromField='lineSegmentsIndex' toNode=' LinesSegmentsIndexPoints' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='Polypoint2D'>
<ProtoInterface>
<field name='pointtype='MFVec2faccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<PointSet>
<!-- ROUTE information for Points3D node:  [from Points2dToLineSet3d.points3D to point ] -->
<Coordinate DEF='Points3D'/>
</PointSet>
<Group>
<!-- ROUTE information for Points2dToLineSet3d node:  [from points3D to Points3D.point ] -->
<Script DEF='Points2dToLineSet3d'>
<field name='pointtype='MFVec2faccessType='initializeOnly'/>
<field name='points3Dtype='MFVec3faccessType='outputOnly'/>
<IS>
<connect nodeField='pointprotoField='point'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{

   for ( i=0 ; i<point.length ; i++)
   {
          points3D[i] = new SFVec3f ( point[i].x, point[i].y, 0.0 );
   }

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' Points2dToLineSet3d' fromField='points3D' toNode=' Points3D' toField='point'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='Rectangle2Dappinfo='Default filled matching default FillProperties filled=true.' >
<ProtoInterface>
<field name='sizetype='SFVec2fvalue='2 2accessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<IndexedFaceSet solid='falsecoordIndex='0 1 2 0 -1 2 3 0 2'>
<!-- ROUTE information for RectanglePoints node:  [from Rect2dToFaceSet3d.pointSet3d to point ] -->
<Coordinate DEF='RectanglePoints'/>
</IndexedFaceSet>
<Group>
<!-- ROUTE information for Rect2dToFaceSet3d node:  [from pointSet3d to RectanglePoints.point ] -->
<Script DEF='Rect2dToFaceSet3d'>
<field name='sizetype='SFVec2faccessType='initializeOnly'/>
<field name='pointSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='fillNoFillSelectiontype='SFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='sizeprotoField='size'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   xDim = size[0];
   yDim = size[1];

   pointSet3d[0] = new SFVec3f ( (-xDim / 2.0), (yDim / 2.0), 0.0 );
   pointSet3d[1] = new SFVec3f ( (-xDim / 2.0), (-yDim / 2.0), 0.0 );
   pointSet3d[2] = new SFVec3f ( (xDim / 2.0), (-yDim / 2.0), 0.0 );
   pointSet3d[3] = new SFVec3f ( (xDim / 2.0), (yDim / 2.0), 0.0 );

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' Rect2dToFaceSet3d' fromField='pointSet3d' toNode=' RectanglePoints' toField='point'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- Rectangle2DUnfilled also provided since FillProperties not available in VRML 97 -->
<ProtoDeclare name='Rectangle2DUnfilled'>
<ProtoInterface>
<field name='sizetype='SFVec2fvalue='2 2accessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<IndexedLineSet coordIndex='0 1 2 3 0'>
<!-- ROUTE information for RectanglePointsLine node:  [from Rect2dToLineSet3d.pointSet3d to point ] -->
<Coordinate DEF='RectanglePointsLine'/>
</IndexedLineSet>
<Group>
<!-- ROUTE information for Rect2dToLineSet3d node:  [from pointSet3d to RectanglePointsLine.point ] -->
<Script DEF='Rect2dToLineSet3d'>
<field name='sizetype='SFVec2faccessType='initializeOnly'/>
<field name='pointSet3dtype='MFVec3faccessType='outputOnly'/>
<field name='fillNoFillSelectiontype='SFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='sizeprotoField='size'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   xDim = size[0];
   yDim = size[1];

   pointSet3d[0] = new SFVec3f ( (-xDim / 2.0), (yDim / 2.0), 0.0 );
   pointSet3d[1] = new SFVec3f ( (-xDim / 2.0), (-yDim / 2.0), 0.0 );
   pointSet3d[2] = new SFVec3f ( (xDim / 2.0), (-yDim / 2.0), 0.0 );
   pointSet3d[3] = new SFVec3f ( (xDim / 2.0), (yDim / 2.0), 0.0 );

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' Rect2dToLineSet3d' fromField='pointSet3d' toNode=' RectanglePointsLine' toField='point'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<ProtoDeclare name='TriangleSet2D'>
<ProtoInterface>
<field name='verticestype='MFVec2faccessType='initializeOnly'/>
<field name='solidtype='SFBoolvalue='falseaccessType='initializeOnly'/>
<field name='metadatatype='SFNodeaccessType='inputOutput'
 appinfo='Metadata node only' >
<!-- default NULL -->
</field>
</ProtoInterface>
<ProtoBody>
<!-- ROUTE information for TriangleSetIndexPoints node:  [from TriangleSet2dToLineSet3d.triangleSetIndex to set_coordIndex ] -->
<IndexedFaceSet DEF='TriangleSetIndexPointssolid='false'>
<!-- ROUTE information for TriangleSet3DPoints node:  [from TriangleSet2dToLineSet3d.triangleSet3D to point ] -->
<Coordinate DEF='TriangleSet3DPoints'/>
</IndexedFaceSet>
<Group>
<field name='verticestype='MFVec2faccessType='initializeOnly'/>
<field name='triangleSet3Dtype='MFVec3faccessType='outputOnly'/>
<field name='triangleSetIndextype='MFInt32accessType='outputOnly'/>
<IS>
<connect nodeField='verticesprotoField='vertices'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
   numbOfTriangles = Math.floor(vertices.length/3);

   for ( i=0 ; i<3*numbOfTriangles ; i++)
   {
          triangleSet3D[i] = new SFVec3f ( vertices[i].x, vertices[i].y, 0.0 );
   }

   k=0;
   for (i=0; i<numbOfTriangles; i++)
   {
        triangleSetIndex[k] = k - i ;
        triangleSetIndex[k+1] = k - i + 1 ;
        triangleSetIndex[k+2] = k - i + 2 ;
        triangleSetIndex[k+3] = -1 ;

        k=k+4;
    }

} // initialize

          
]]>
</Script>
< ROUTE  fromNode=' TriangleSet2dToLineSet3d' fromField='triangleSet3D' toNode=' TriangleSet3DPoints' toField='point'/>
< ROUTE  fromNode=' TriangleSet2dToLineSet3d' fromField='triangleSetIndex' toNode=' TriangleSetIndexPoints' toField='set_coordIndex'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<Background groundColor='0.25 0.25 0.25skyColor='0.25 0.25 0.25'/>
<Anchor DEF='LinkToExamplesdescription='link to examples'
  url=' Geometry2dComponentExternProtos.x3d"https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentExternProtos.x3d" "Geometry2dComponentExamples.wrl" "https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentExamples.wrl" ' >
<Shape>
<Appearance>
<Material diffuseColor='0.8 0.6 0.2'/>
</Appearance>
<Text string='"Geometry2dComponentPrototypes" "is a developmental file." "Click this text to view" "Geometry2dComponentExamples"'>
<FontStyle justify='"MIDDLE" "MIDDLE"size='0.75'/>
</Text>
</Shape>
</Anchor>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: Arc2dToFaceSet3d, Arc3DPoints, ArcClose2DFaceCoordinate, ArcClose2DLineCoordinate, ArcClose2dToFaceSet3d, ArcClose2dToLineSet3d, ArcIndexPoints, ArcPointFaceIndex, ArcPointLineIndex, Circ2dToLineSet3d, Circ3DPoints, Circ3DPointsIndex, Disk2dToFaceSet3d, Disk3DPoints, DiskPointsIndex, LineSegments2dToLineSet3d, LineSegments3DPoints, LinesSegmentsIndexPoints, LinkToExamples, Points2dToLineSet3d, Points3D, Rect2dToFaceSet3d, Rect2dToLineSet3d, RectanglePoints, RectanglePointsLine, TriangleSet2dToLineSet3d, TriangleSet3DPoints, TriangleSetIndexPoints

Index for ProtoDeclare definitions: Arc2D, ArcClose2D, ArcClose2DUnfilled, Circle2D, Disk2D, Polyline2D, Polypoint2D, Rectangle2D, Rectangle2DUnfilled, TriangleSet2D
-->

Event Graph ROUTE Table entries with 17 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

Arc2dToFaceSet3d
Script
arcSet3d
MFVec3f

ROUTE
event to
(1)
Arc3DPoints
Coordinate
point
MFVec3f
Arc2dToFaceSet3d
Script
arcIndexSet3d
MFInt32

ROUTE
event to
(1)
ArcIndexPoints
IndexedLineSet
set_coordIndex
MFInt32


ArcClose2dToFaceSet3d
Script
arcSet3d
MFVec3f

ROUTE
event to
(1)
ArcClose2DFaceCoordinate
Coordinate
point
MFVec3f
ArcClose2dToFaceSet3d
Script
pointIndex
MFInt32

ROUTE
event to
(1)
ArcPointFaceIndex
IndexedFaceSet
set_coordIndex
MFInt32


ArcClose2dToLineSet3d
Script
arcSet3d
MFVec3f

ROUTE
event to
(1)
ArcClose2DLineCoordinate
Coordinate
point
MFVec3f
ArcClose2dToLineSet3d
Script
pointIndex
MFInt32

ROUTE
event to
(1)
ArcPointLineIndex
IndexedLineSet
set_coordIndex
MFInt32


Circ2dToLineSet3d
Script
circSet3d
MFVec3f

ROUTE
event to
(1)
Circ3DPoints
Coordinate
point
MFVec3f
Circ2dToLineSet3d
Script
circIndexSet3d
MFInt32

ROUTE
event to
(1)
Circ3DPointsIndex
IndexedLineSet
set_coordIndex
MFInt32


Disk2dToFaceSet3d
Script
diskSet3d
MFVec3f

ROUTE
event to
(1)
Disk3DPoints
Coordinate
point
MFVec3f
Disk2dToFaceSet3d
Script
diskIndexSet3d
MFInt32

ROUTE
event to
(1)
DiskPointsIndex
IndexedFaceSet
set_coordIndex
MFInt32


LineSegments2dToLineSet3d
Script
lineSegments3D
MFVec3f

ROUTE
event to
(1)
LineSegments3DPoints
Coordinate
point
MFVec3f
LineSegments2dToLineSet3d
Script
lineSegmentsIndex
MFInt32

ROUTE
event to
(1)
LinesSegmentsIndexPoints
IndexedLineSet
set_coordIndex
MFInt32


Points2dToLineSet3d
Script
points3D
MFVec3f

ROUTE
event to
(1)
Points3D
Coordinate
point
MFVec3f


Rect2dToFaceSet3d
Script
pointSet3d
MFVec3f

ROUTE
event to
(1)
RectanglePoints
Coordinate
point
MFVec3f


Rect2dToLineSet3d
Script
pointSet3d
MFVec3f

ROUTE
event to
(1)
RectanglePointsLine
Coordinate
point
MFVec3f


TriangleSet2dToLineSet3d
Script
triangleSet3D
MFVec3f

ROUTE
event to
(1)
TriangleSet3DPoints
Coordinate
point
MFVec3f
TriangleSet2dToLineSet3d
Script
triangleSetIndex
MFInt32

ROUTE
event to
(1)
TriangleSetIndexPoints
IndexedFaceSet
set_coordIndex
MFInt32


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypesIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/Geometry2dComponentPrototypes.x3d -->

<!-- Color legend: X3D terminology <X3dNode DEF='idName' field='value'/> matches XML terminology <XmlElement DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoDeclare name='ProtoName'> <field name='fieldName'/> </ProtoDeclare> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->