@prefix :        <https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_6DonutPrototype.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.0' ;
  x3do:noNamespaceSchemaLocation 'https://www.web3d.org/specifications/x3d-3.0.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_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Figure31_6DonutPrototype.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Figure 31.6, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland' ;
  x3do:name 'creator' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'http://www.wiley.com/legacy/compbooks/vrml2sbk/ch31/31fig06.htm' ;
  x3do:name 'reference' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman' ;
  x3do:name 'translator' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '30 March 2001' ;
  x3do:name 'created' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '20 October 2019' ;
  x3do:name 'modified' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'A donut (torus) node prototype. Also see Figures 30.5 and 31.7 for comparison.' ;
  x3do:name 'description' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_6DonutPrototype.x3d' ;
  x3do:name 'identifier' .
:meta_1_9 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_10 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "Figure31_6DonutPrototype.x3d" .
:meta dcterms:creator "Figure 31.6, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland" .
:meta dcterms:reference "http://www.wiley.com/legacy/compbooks/vrml2sbk/ch31/31fig06.htm" .
:meta dcterms:translator "Don Brutzman" .
:meta dcterms:created "30 March 2001" .
:meta dcterms:modified "20 October 2019" .
:meta dcterms:description "A donut (torus) node prototype. Also see Figures 30.5 and 31.7 for comparison." .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_6DonutPrototype.x3d" .
: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, :Anchor_2_3 ;
  x3do:hasProtoDeclare :ProtoDeclare_2_2 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'Figure31_6DonutPrototype.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:name 'Donut' .
: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_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'crossSectionRadius' ;
  x3do:type 'SFFloat' ;
  x3do:value 1 .
:field_2_2_1_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'spineRadius' ;
  x3do:type 'SFFloat' ;
  x3do:value 2 .
:field_2_2_1_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'crossSectionResolution' ;
  x3do:type 'SFInt32' ;
  x3do:value 16 .
:field_2_2_1_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'spineResolution' ;
  x3do:type 'SFInt32' ;
  x3do:value 16 .
:field_2_2_1_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'set_crossSectionRadius' ;
  x3do:type 'SFFloat' .
:field_2_2_1_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :ProtoInterface_2_2_1 ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'set_spineRadius' ;
  x3do:type 'SFFloat' .
:ProtoBody_2_2_2 a owl:NamedIndividual, x3do:ProtoBody ;
  x3do:hasParent :ProtoDeclare_2_2 ;
  x3do:hasGeometry :DonutExtrusion ;
  x3do:hasChildren :DonutMakerInternalScript ;
  x3do:hasROUTE :ROUTE_2_2_2_3, :ROUTE_2_2_2_4 .
:DonutExtrusion a owl:NamedIndividual, x3do:Extrusion ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:DEF 'DonutExtrusion' ;
  x3do:beginCap false ;
  x3do:creaseAngle 1.57 ;
  x3do:endCap false .
:DonutMakerInternalScript a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:hasField :field_2_2_2_2_1, :field_2_2_2_2_2, :field_2_2_2_2_3, :field_2_2_2_2_4, :field_2_2_2_2_5, :field_2_2_2_2_6, :field_2_2_2_2_7, :field_2_2_2_2_8 ;
  x3do:hasIS :IS_2_2_2_2_9 ;
  x3do:DEF 'DonutMakerInternalScript' ;
  x3do:sourceCode """
ecmascript:

function initialize( ) {
    generateCrossSection( );
    generateSpine( );
}

function set_crossSectionRadius( csr, ts )
{
    crossSectionRadius = csr;
//  Browser.println ('crossSectionRadius =' + crossSectionRadius);
    generateCrossSection( );
}

function set_spineRadius( sr, ts )
{
    spineRadius = sr;
//  Browser.println ('spineRadius =' + spineRadius);
    generateSpine( );
}

function generateCrossSection( )
{
    newCrossSection = new MFVec2f(); // temporary hold variable
    angle = 0.0;
    delta = 6.28 / crossSectionResolution;
    for ( i = 0; i <= crossSectionResolution + 1; i++ ) {
        newCrossSection[i][0] =  crossSectionRadius * Math.cos( angle );
        newCrossSection[i][1] = -crossSectionRadius * Math.sin( angle );
        angle += delta;
    }
    // make ends meet
    newCrossSection[crossSectionResolution + 1][0] = newCrossSection[0][0];
    newCrossSection[crossSectionResolution + 1][1] = newCrossSection[0][1];

    crossSection_changed = newCrossSection;
}

function generateSpine( )
{
    newSpine = new MFVec3f(); // temporary hold variable
    angle = 0.0;
    delta = (2 * 3.141592653) / spineResolution;
    for ( i = 0; i <= spineResolution; i++ ) {
        newSpine[i][0] = spineRadius * Math.cos( angle );
        newSpine[i][1] = 0.0;
        newSpine[i][2] = -spineRadius * Math.sin( angle );
        angle += delta;
    }
    // make ends meet
    newSpine[spineResolution + 1][0] = newSpine[0][0];
    newSpine[spineResolution + 1][1] = 0.0;
    newSpine[spineResolution + 1][2] = newSpine[0][2];

    spine_changed = newSpine;
}
""" .
:field_2_2_2_2_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'crossSectionRadius' ;
  x3do:type 'SFFloat' .
:field_2_2_2_2_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'spineRadius' ;
  x3do:type 'SFFloat' .
:field_2_2_2_2_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'crossSectionResolution' ;
  x3do:type 'SFInt32' .
:field_2_2_2_2_4 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:name 'spineResolution' ;
  x3do:type 'SFInt32' .
:field_2_2_2_2_5 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'set_crossSectionRadius' ;
  x3do:type 'SFFloat' .
:field_2_2_2_2_6 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'inputOnly' ;
  x3do:name 'set_spineRadius' ;
  x3do:type 'SFFloat' .
:field_2_2_2_2_7 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'crossSection_changed' ;
  x3do:type 'MFVec2f' .
:field_2_2_2_2_8 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:accessType 'outputOnly' ;
  x3do:name 'spine_changed' ;
  x3do:type 'MFVec3f' .
:IS_2_2_2_2_9 a owl:NamedIndividual, x3do:IS ;
  x3do:hasParent :DonutMakerInternalScript ;
  x3do:hasConnect :connect_2_2_2_2_9_1, :connect_2_2_2_2_9_2, :connect_2_2_2_2_9_3, :connect_2_2_2_2_9_4, :connect_2_2_2_2_9_5, :connect_2_2_2_2_9_6 .
:connect_2_2_2_2_9_1 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_9 ;
  x3do:nodeField 'crossSectionRadius' ;
  x3do:protoField 'crossSectionRadius' .
:connect_2_2_2_2_9_2 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_9 ;
  x3do:nodeField 'spineRadius' ;
  x3do:protoField 'spineRadius' .
:connect_2_2_2_2_9_3 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_9 ;
  x3do:nodeField 'crossSectionResolution' ;
  x3do:protoField 'crossSectionResolution' .
:connect_2_2_2_2_9_4 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_9 ;
  x3do:nodeField 'spineResolution' ;
  x3do:protoField 'spineResolution' .
:connect_2_2_2_2_9_5 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_9 ;
  x3do:nodeField 'set_crossSectionRadius' ;
  x3do:protoField 'set_crossSectionRadius' .
:connect_2_2_2_2_9_6 a owl:NamedIndividual, x3do:connect ;
  x3do:hasParent :IS_2_2_2_2_9 ;
  x3do:nodeField 'set_spineRadius' ;
  x3do:protoField 'set_spineRadius' .
:ROUTE_2_2_2_3 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:fromField 'spine_changed' ;
  x3do:fromNode 'DonutMakerInternalScript' ;
  x3do:toField 'set_spine' ;
  x3do:toNode 'DonutExtrusion' .
:ROUTE_2_2_2_4 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :ProtoBody_2_2_2 ;
  x3do:fromField 'crossSection_changed' ;
  x3do:fromNode 'DonutMakerInternalScript' ;
  x3do:toField 'set_crossSection' ;
  x3do:toNode 'DonutExtrusion' .
:Anchor_2_3 a owl:NamedIndividual, x3do:Anchor ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Shape_2_3_1 ;
  x3do:description 'Figure31_7DonutExternalPrototype example' ;
  x3do:parameter '"target=_blank"' ;
  x3do:url '"Figure31_7DonutExternalPrototype.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_7DonutExternalPrototype.x3d" "Figure31_7DonutExternalPrototype.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31Prototypes/Figure31_7DonutExternalPrototype.wrl"' .
:Shape_2_3_1 a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Anchor_2_3 ;
  x3do:hasGeometry :Text_2_3_1_1 ;
  x3do:hasAppearance :Appearance_2_3_1_2 .
:Text_2_3_1_1 a owl:NamedIndividual, x3do:Text ;
  x3do:hasParent :Shape_2_3_1 ;
  x3do:hasFontStyle :FontStyle_2_3_1_1_1 ;
  x3do:string '"Figure31_6DonutPrototype" "contains a prototype definition" "" "Click on text to see a Donut in" "Figure31_7DonutExternalPrototype"' .
:FontStyle_2_3_1_1_1 a owl:NamedIndividual, x3do:FontStyle ;
  x3do:hasParent :Text_2_3_1_1 ;
  x3do:justify '"MIDDLE" "MIDDLE"' ;
  x3do:size 0.8 .
:Appearance_2_3_1_2 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :Shape_2_3_1 ;
  x3do:hasMaterial :Material_2_3_1_2_1 .
:Material_2_3_1_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :Appearance_2_3_1_2 ;
  x3do:diffuseColor ( 0 0.6 0.6 ) .
