@prefix :        <https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/ParallelepipedPrototype.ttl#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema:  <http://schema.org/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix x3d:     <https://www.web3d.org/specifications/x3d-4.0.xsd#> .
@prefix x3do:    <https://www.web3d.org/specifications/X3dOntology4.0#> .

:X3D a owl:NamedIndividual, x3do:X3D ;
  x3do:hasHead :head ;
  x3do:hasScene :Scene ;
  x3do:profile 'Immersive' ;
  x3do:version '3.3' ;
  x3do:noNamespaceSchemaLocation 'https://www.web3d.org/specifications/x3d-3.3.xsd' .
:head a owl:NamedIndividual, x3do:head ;
  x3do:hasParent :X3D ;
  x3do:hasMeta :meta_1_1, :meta_1_2, :meta_1_3, :meta_1_4, :meta_1_5, :meta_1_6, :meta_1_7, :meta_1_8, :meta_1_9, :meta_1_10, :meta_1_11, :meta_1_12, :meta_1_13, :meta_1_14, :meta_1_15, :meta_1_16 .
:meta_1_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ParallelepipedPrototype.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Reusable prototype for creating a Parallelepiped, which is a 3D figure formed by six parallelograms; also sometimes referred to as a rhomboid.' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '25 November 2011' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '7 December 2024' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ParallelepipedExamples.x3d' ;
  x3do:name 'reference' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ParallelepipedVertexIndices.png' ;
  x3do:name 'Image' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'GeometricShapes.vsdx' ;
  x3do:name 'drawing' .
:meta_1_9 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://en.wikipedia.org/wiki/Parallelepiped' ;
  x3do:name 'reference' .
:meta_1_10 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'http://upload.wikimedia.org/wikipedia/commons/f/f6/Parallelepiped.svg' ;
  x3do:name 'reference' .
:meta_1_11 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Parallelepiped.svg/500px-Parallelepiped.svg.png' ;
  x3do:name 'reference' .
:meta_1_12 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'parallelepiped rhomboid geometry polyhedron' ;
  x3do:name 'subject' .
:meta_1_13 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/ParallelepipedPrototype.x3d' ;
  x3do:name 'identifier' .
:meta_1_14 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/X3dResources.html' ;
  x3do:name 'reference' .
:meta_1_15 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit' ;
  x3do:name 'generator' .
:meta_1_16 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "ParallelepipedPrototype.x3d" .
:meta dcterms:description "Reusable prototype for creating a Parallelepiped, which is a 3D figure formed by six parallelograms; also sometimes referred to as a rhomboid." .
:meta dcterms:creator "Don Brutzman" .
:meta dcterms:created "25 November 2011" .
:meta dcterms:modified "7 December 2024" .
:meta dcterms:reference "ParallelepipedExamples.x3d" .
:meta dcterms:Image "ParallelepipedVertexIndices.png" .
:meta dcterms:drawing "GeometricShapes.vsdx" .
:meta dcterms:reference "https://en.wikipedia.org/wiki/Parallelepiped" .
:meta dcterms:reference "http://upload.wikimedia.org/wikipedia/commons/f/f6/Parallelepiped.svg" .
:meta dcterms:reference "http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Parallelepiped.svg/500px-Parallelepiped.svg.png" .
:meta dcterms:subject "parallelepiped rhomboid geometry polyhedron" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/ParallelepipedPrototype.x3d" .
:meta dcterms:reference "https://www.web3d.org/x3d/content/examples/X3dResources.html" .
:meta dcterms:generator "X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit" .
:meta dcterms:license "../license.html" .
:Scene a owl:NamedIndividual, x3do:Scene ;
  x3do:hasParent :X3D ;
  x3do:hasChildren :WorldInfo_2_1, :Background_2_3, :Anchor_2_4 ;
  x3do:hasProtoDeclare :ProtoDeclare_2_2 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'ParallelepipedPrototype.x3d' .
:ProtoDeclare_2_2 a owl:NamedIndividual, x3do:ProtoDeclare ;
  x3do:hasParent :Scene ;
  x3do:hasProtoInterface :ProtoInterface_2_2_1 ;
  x3do:hasProtoBody :ProtoBody_2_2_2 ;
  x3do:appinfo 'Parallelepiped is a 3D figure formed by six parallelograms; also sometimes referred to as a rhomboid' ;
  x3do:name 'Parallelepiped' .
:ProtoInterface_2_2_1 a owl:NamedIndividual, x3do:ProtoInterface ;
  x3do:hasParent :ProtoDeclare_2_2 ;
  x3do:hasField :field_2_2_1_1, :field_2_2_1_2, :field_2_2_1_3, :field_2_2_1_4, :field_2_2_1_5, :field_2_2_1_6, :field_2_2_1_7, :field_2_2_1_8, :field_2_2_1_9 .
:field_2_2_1_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'point' ;
  x3do:type 'MFVec3f' ;
  x3do:value ( 0 1 0 1 1 0 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 ) .
:field_2_2_1_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'colorPerVertex' ;
  x3do:type 'SFBool' ;
  x3do:value true .
:field_2_2_1_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'normalPerVertex' ;
  x3do:type 'SFBool' ;
  x3do:value true .
:field_2_2_1_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'colorIndex' ;
  x3do:type 'MFInt32' .
:field_2_2_1_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'normalIndex' ;
  x3do:type 'MFInt32' .
:field_2_2_1_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'texCoordIndex' ;
  x3do:type 'MFInt32' .
:field_2_2_1_7 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:hasColor :DefaultColor ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'colorNode' ;
  x3do:type 'SFNode' .
:DefaultColor a owl:NamedIndividual, x3do:Color ;
  x3do:hasParent :field_2_2_1_7 ;
  x3do:DEF 'DefaultColor' .
:field_2_2_1_8 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:hasNormal :DefaultNormal ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'normalNode' ;
  x3do:type 'SFNode' .
:DefaultNormal a owl:NamedIndividual, x3do:Normal ;
  x3do:hasParent :field_2_2_1_8 ;
  x3do:DEF 'DefaultNormal' .
:field_2_2_1_9 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:hasTexCoord :DefaultTextureCoordinate ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'texCoordNode' ;
  x3do:type 'SFNode' .
:DefaultTextureCoordinate a owl:NamedIndividual, x3do:TextureCoordinate ;
  x3do:hasParent :field_2_2_1_9 ;
  x3do:DEF 'DefaultTextureCoordinate' .
:ProtoBody_2_2_2 a owl:NamedIndividual, x3do:ProtoBody ;
  x3do:hasParent :ProtoDeclare_2_2 ;
  x3do:hasGeometry :IFS ;
  x3do:hasChildren :ParallelepipedScript .
:IFS a owl:NamedIndividual, x3do:IndexedFaceSet ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:hasIS :IS_2_2_2_1_1 ;
  x3do:hasCoord :Coordinate_2_2_2_1_2 ;
  x3do:DEF 'IFS' ;
  x3do:convex false ;
  x3do:coordIndex ( 0 3 2 1 -1 4 5 6 7 -1 0 1 5 4 -1 1 2 6 5 -1 2 3 7 6 -1 3 0 4 7 -1 ) ;
  x3do:solid false .
:IS_2_2_2_1_1 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :IFS ;
  x3do:hasConnect :connect_2_2_2_1_1_1, :connect_2_2_2_1_1_2, :connect_2_2_2_1_1_3, :connect_2_2_2_1_1_4, :connect_2_2_2_1_1_5, :connect_2_2_2_1_1_6, :connect_2_2_2_1_1_7, :connect_2_2_2_1_1_8 .
:connect_2_2_2_1_1_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'colorPerVertex' ;
  x3do:protoField 'colorPerVertex' .
:connect_2_2_2_1_1_2 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'normalPerVertex' ;
  x3do:protoField 'normalPerVertex' .
:connect_2_2_2_1_1_3 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'colorIndex' ;
  x3do:protoField 'colorIndex' .
:connect_2_2_2_1_1_4 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'normalIndex' ;
  x3do:protoField 'normalIndex' .
:connect_2_2_2_1_1_5 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'texCoordIndex' ;
  x3do:protoField 'texCoordIndex' .
:connect_2_2_2_1_1_6 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'colorNode' ;
  x3do:protoField 'colorNode' .
:connect_2_2_2_1_1_7 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'normalNode' ;
  x3do:protoField 'normalNode' .
:connect_2_2_2_1_1_8 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_1 ;
  x3do:nodeField 'texCoordNode' ;
  x3do:protoField 'texCoordNode' .
:Coordinate_2_2_2_1_2 a owl:NamedIndividual, x3do:Coordinate ;
  x3do:hasParent :IFS ;
  x3do:hasIS :IS_2_2_2_1_2_1 .
:IS_2_2_2_1_2_1 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :Coordinate_2_2_2_1_2 ;
  x3do:hasConnect :connect_2_2_2_1_2_1_1 .
:connect_2_2_2_1_2_1_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_1_2_1 ;
  x3do:nodeField 'point' ;
  x3do:protoField 'point' .
:ParallelepipedScript a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:hasField :field_2_2_2_2_1 ;
  x3do:hasIS :IS_2_2_2_2_2 ;
  x3do:DEF 'ParallelepipedScript' ;
  x3do:sourceCode """
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 parallelepiped 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 parallelepiped 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 parallelepiped 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 ();
}
""" .
:field_2_2_2_2_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ParallelepipedScript ;
  x3do:accessType 'inputOutput' ;
  x3do:name 'point' ;
  x3do:type 'MFVec3f' .
:IS_2_2_2_2_2 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :ParallelepipedScript ;
  x3do:hasConnect :connect_2_2_2_2_2_1 .
:connect_2_2_2_2_2_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_2 ;
  x3do:nodeField 'point' ;
  x3do:protoField 'point' .
:Background_2_3 a owl:NamedIndividual, x3do:Background ;
  x3do:hasParent :Scene ;
  x3do:skyColor ( 0.905882 1 0.858824 ) .
:Anchor_2_4 a owl:NamedIndividual, x3do:Anchor ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Shape_2_4_1, :TransparentBox ;
  x3do:description 'Open ParallelepipedExamples scene' ;
  x3do:url '"ParallelepipedExamples.x3d" "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/ParallelepipedExamples.x3d" "ParallelepipedExamples.wrl" "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/ParallelepipedExamples.wrl"' .
:Shape_2_4_1 a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Anchor_2_4 ;
  x3do:hasGeometry :Text_2_4_1_1 ;
  x3do:hasAppearance :BlueAppearance .
:Text_2_4_1_1 a owl:NamedIndividual, x3do:Text ;
  x3do:hasParent :Shape_2_4_1 ;
  x3do:hasFontStyle :FontStyle_2_4_1_1_1 ;
  x3do:string '"This scene defines a" "Parallelepiped prototype" "" "Select this text to open" "ParallelepipedExamples scene"' .
:FontStyle_2_4_1_1_1 a owl:NamedIndividual, x3do:FontStyle ;
  x3do:hasParent :Text_2_4_1_1 ;
  x3do:justify '"MIDDLE" "MIDDLE"' .
:BlueAppearance a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :Shape_2_4_1 ;
  x3do:hasMaterial :Material_2_4_1_2_1 ;
  x3do:DEF 'BlueAppearance' .
:Material_2_4_1_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :BlueAppearance ;
  x3do:diffuseColor ( 0 0.698039 1 ) .
:TransparentBox a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Anchor_2_4 ;
  x3do:hasGeometry :Box_2_4_2_1 ;
  x3do:hasAppearance :Appearance_2_4_2_2 ;
  x3do:DEF 'TransparentBox' .
:Box_2_4_2_1 a owl:NamedIndividual, x3do:Box ;
  x3do:hasParent :TransparentBox ;
  x3do:size ( 11 5 0.1 ) .
:Appearance_2_4_2_2 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :TransparentBox ;
  x3do:hasMaterial :Material_2_4_2_2_1 .
:Material_2_4_2_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :Appearance_2_4_2_2 ;
  x3do:transparency 1 .
