<?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
      
                           <![CDATA[
                        
                        
          
ecmascript:
function initialize ()
{
    checkCoordinatePoints ();
}
function checkCoordinatePoints ()
{
    // A parallelepiped has three sets of four parallel edges; the edges within each set are of equal length.
    // Quality assurance: check that lengths of corresponding sides match.
    
    edge01 = length2(point[0], point[1]); // top
    edge12 = length2(point[1], point[2]);
    edge23 = length2(point[2], point[3]);
    edge30 = length2(point[3], point[0]);
    edge45 = length2(point[4], point[5]); // bottom
    edge56 = length2(point[5], point[6]);
    edge67 = length2(point[6], point[7]);
    edge74 = length2(point[7], point[4]);
    edge04 = length2(point[0], point[4]); // sides
    edge15 = length2(point[1], point[5]);
    edge26 = length2(point[2], point[6]);
    edge37 = length2(point[3], point[7]);
    
    epsilon = edge01 * 0.001;
    
    if      ((Math.abs(edge01 - edge23) > epsilon) ||
             (Math.abs(edge23 - edge67) > epsilon) ||
             (Math.abs(edge67 - edge45) > epsilon) ||
             (Math.abs(edge45 - edge01) > epsilon))
         Browser.println ('Warning, mismatched parallelopiped sides 02/33/45/67');
    else if ((Math.abs(edge30 - edge12) > epsilon) ||
             (Math.abs(edge12 - edge56) > epsilon) ||
             (Math.abs(edge56 - edge74) > epsilon) ||
             (Math.abs(edge74 - edge30) > epsilon))
         Browser.println ('Warning, mismatched parallelopiped sides 30/12/56/74');
    else if ((Math.abs(edge04 - edge15) > epsilon) ||
             (Math.abs(edge15 - edge26) > epsilon) ||
             (Math.abs(edge26 - edge37) > epsilon) ||
             (Math.abs(edge37 - edge04) > epsilon))
         Browser.println ('Warning, mismatched parallelopiped sides 04/15/26/37');
}
function length2 (pointA, pointB)
{    
    return Math.sqrt((pointA.x - pointB.x)*(pointA.x - pointB.x) +
                     (pointA.y - pointB.y)*(pointA.y - pointB.y) +
                     (pointA.z - pointB.z)*(pointA.z - pointB.z));
}
function set_point (eventValue)
{
   // input eventValue received for inputOutput field
    point = eventValue;
    checkCoordinatePoints ();
}
        
                        
                           ]]>
                        
         <!--
Color key: 
<X3dNode
          DEF='idName' field='value'/> 
 matches 
<XmlElement
          DEF='idName' attribute='value'/> 
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
   
<Prototype
         name='ProtoName'>
	<field
         name='fieldName'/> </Prototype>
 -->
      
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources and X3D Scene Authoring Hints. -->