### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.4_camera_lighting.html Initializes the 3DHOP presenter and sets up the scene with meshes and model instances. This is the primary setup function for the 3D viewer. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Sphere" : { url: "models/sphere.ply" }, "Cube" : { url: "models/cube.ply" } }, modelInstances : { "Gargo" : { mesh : "Gargoyle", transform : { translation : [-60.0, 0.0, 0.0] }, }, "S1" : { mesh : "Sphere", transform : { translation : [0.0, 20.0, 0.0], scale : [20.0, 20.0, 20.0] }, color : [ 1.0, 0.2, 0.2 ], useSolidColor : true, useLighting : false }, "S2" : { mesh : "Sphere", transform : { translation : [0.0, 60.0, 0.0], scale : [20.0, 20.0, 20.0] }, color : [ 0.2, 1.0, 0.2 ], useSolidColor : true }, "S3" : { mesh : "Sphere", transform : { translation : [0.0, 100.0, 0.0], scale : [20.0, 20.0, 20.0] }, color : [ 0.2, 0.2, 1.0 ], useSolidColor : true, useLighting : false }, "Box" : { mesh : "Cube", transform : { translation : [60.0, 20.0, 0.0], rotation : [0.0, 20.0, 0.0], scale : [0.8, 0.8, 0.8] }, color : [ 0.5, 0.7, 0.8 ], useSolidColor : true }, "Base" : { mesh : "Cube", transform : { translation : [0.0, -5.0, 0.0], scale : [5.0, 0.2, 3.0] }, } }, trackball: { type : TurntablePanTrackball, trackOptions : { startDistance : 1.0, minMaxDist : [0.1, 3.0], startPanY : 0.2 } }, space: { centerMode : "scene", radiusMode : "scene", cameraFOV : 60.0, cameraNearFar : [0.01, 10.0], cameraType : "perspective", sceneLighting : true } }); } ``` -------------------------------- ### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.6_screenshot_tool.html Initializes the 3DHOP presenter and sets up the 3D scene with meshes and model instances. This code should be run after the document is ready. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Cube" : { url: "models/cube.ply" } }, modelInstances : { "Gargo" : { mesh : "Gargoyle" }, "Base" : { mesh : "Cube", transform : { translation : [0.0, -5.0, 0.0], scale : [3.0, 0.2, 3.0] } }, }, trackball: { type : TurnTableTrackball, trackOptions : { startDistance: 3.0, minMaxDist: [1.0, 5.0], minMaxPhi: [-180, 180], minMaxTheta: [-30.0, 70.0] } } }); } $(document).ready(function(){ init3dhop(); setup3dhop(); }); ``` -------------------------------- ### Initialize 3DHOP Presenter and Setup Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_sphere.html Initializes the 3DHOP presenter and configures the scene, including mesh loading and trackball settings. Use this to set up the 3D environment. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Laurana" : { url: "models/laurana.ply" } }, modelInstances : { "Model1" : { mesh : "Laurana" } }, trackball: { type : SphereTrackball, trackOptions : { startDistance: 2.5, minMaxDist: [0.5, 3.0] } } }); } ``` -------------------------------- ### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_1.3_models_loading.html Initializes the 3DHOP presenter and sets up the scene with specified 3D models. Ensure the 'draw-canvas' element exists in your HTML. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Cage" : { url: "models/cage.ply" } }, modelInstances : { "Model1" : { mesh : "Cage" }, "Model2" : { mesh : "Gargoyle" } } }); } ``` -------------------------------- ### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_1.1_viewer_initialization.html This code initializes the 3DHOP presenter and sets up the scene with a mesh and model instance. It should be called after the DOM is ready. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.ply" } }, modelInstances : { "Model1" : { mesh : "Gargoyle" } } }); } $(document).ready(function(){ init3dhop(); setup3dhop(); }); ``` -------------------------------- ### 3DHOP Initialization and Setup on DOM Ready Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_1.2_interface_dimensioning.html Ensures 3DHOP is initialized, the scene is set up, and the canvas is resized and positioned correctly once the HTML document is fully loaded. ```javascript $(document).ready(function(){ init3dhop(); setup3dhop(); resizeCanvas(800,600); moveToolbar(20,20); }); ``` -------------------------------- ### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.2_complex_scene.html Initializes the 3DHOP presenter and sets up the 3D scene with meshes, model instances, and scene space configuration. This code should be run after the DOM is ready. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Laurana" : { url: "models/laurana.ply" }, "Gargoyle" : { url: "models/gargo.nxz" }, "Box" : { url: "models/cube.ply", transform : { matrix: SglMat4.scaling( [13.0, 0.5, 10.0] ) }, } }, modelInstances : { "Base" : { mesh : "Box" }, "Center" : { mesh : "Laurana", transform : { matrix: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 250.0, -50.0, 1.0] }, }, "Left" : { mesh : "Gargoyle", transform : { translation : [-120.0, 12.5, 150.0], rotation : [0.0, 90, 0.0], scale : [1.5, 1.5, 1.5] } }, "Right" : { mesh : "Gargoyle", transform : { matrix: SglMat4.mul(SglMat4.translation([120.0, 12.5, 150.0]), SglMat4.rotationAngleAxis(sglDegToRad(-90.0), [0.0, 1.0, 0.0])) } } }, space : { centerMode : "explicit", explicitCenter : [0.0, 100.0, 0.0], radiusMode : "specific", whichInstanceRadius : "Base" } }); } ``` -------------------------------- ### Setup 3D Presenter with Trackball Controls Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_turntablepan.html Initializes the 3DHOP presenter and configures the scene with a mesh and trackball controls. Use this to set up the initial state of the 3D viewer, including camera constraints. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Laurana" : { url: "models/laurana.ply" } }, modelInstances : { "Model1" : { mesh : "Laurana" } }, trackball: { type: TurntablePanTrackball, trackOptions: { startPhi : 0.0, startTheta : 0.0, startDistance : 2.5, startPanX : 0.0, startPanY : 0.0, startPanZ : 0.0, minMaxPhi : [-180, 180], minMaxTheta : [-10.0, 50.0], minMaxDist : [0.5, 3.0], minMaxPanX : [-0.5, 0.5], minMaxPanY : [-0.6, 0.6], minMaxPanZ : [-0.3, 0.3], } } }); } ``` -------------------------------- ### getCameraType Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Returns the current setup of the virtual camera, specifically the projection mode. ```APIDOC ## getCameraType() ### Description Returns the current setup of the virtual camera (projection mode). ### Returns - **string** - The projection mode name ("perspective" or "orthographic", "perspective" is selected by default). ``` -------------------------------- ### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/minimal/3DHOP_no_tools.html Sets up the 3DHOP presenter with a specific canvas and configures the scene, including meshes, model instances, and trackball controls. This is typically called on document ready. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "mesh_1" : { url: "models/gargo.nxz" } }, modelInstances : { "model_1" : { mesh : "mesh_1" } }, trackball: { type : TurnTableTrackball, trackOptions : { startPhi: 35.0, startTheta: 15.0, startDistance: 2.5, minMaxPhi: [-180, 180], minMaxTheta: [-30.0, 70.0], minMaxDist: [0.5, 3.0] } } }); } ``` -------------------------------- ### Initialize 3DHOP Presenter and Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.1_animations.html Sets up the 3DHOP presenter with a canvas and defines scene elements including meshes, model instances, and trackball configuration. This is the initial setup for the 3D viewer. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Box" : { url: "models/cube.ply", transform : { matrix: SglMat4.scaling(\[ 3.0, 0.2, 3.0\]) } } }, modelInstances : { "Gargo" : { mesh : "Gargoyle" }, "Base" : { mesh : "Box", transform : { matrix: SglMat4.translation(\[0.0, -5.0, 0.0\]) } } }, trackball: { type : TurnTableTrackball, trackOptions : { startDistance : 3.0, minMaxDist : \[1.5, 3.0\] , minMaxTheta : \[-10.0, 70.0\] } } }); } ``` -------------------------------- ### Initialize 3DHOP Presenter and Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.5_planes_sections.html Sets up the 3DHOP presenter with a canvas and configures the 3D scene, including meshes, model instances, camera trackball, and clipping plane settings. This is the primary setup function for the presenter. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz", }, "Cube" : { url: "models/cube.ply" } }, modelInstances : { "Gargo" : { mesh : "Gargoyle" }, "Base" : { mesh : "Cube", transform : { translation : [0.0, -5.0, 0.0], scale : [3.0, 0.2, 3.0] }, clippable : false } }, trackball: { type : TurnTableTrackball, trackOptions : { startDistance : 1.3, minMaxDist : [0.8, 2.5], minMaxTheta : [-30.0, 70.0] } }, space: { centerMode: "scene", radiusMode: "scene" }, config : { showClippingPlanes : true, showClippingBorder : true, clippingBorderSize : 0.5, clippingBorderColor : [0.0, 1.0, 1.0] } }); } ``` -------------------------------- ### Initialize and Setup 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.3_visibility_color_transparency.html Initializes the 3DHOP presenter and configures the scene with meshes, model instances, transformations, and camera settings. Use this to define the initial state of your 3D scene. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Cube" : { url: "models/cube.ply" }, "Cage" : { url: "models/cage.ply" }, "Laurana" : { url: "models/laurana.ply" }, "GargoyleSingle" : { url: "models/gargo.ply" }, "GargoyleMulti" : { url: "models/gargo.nxz" } }, modelInstances : { "Base" : { mesh : "Cube", transform : { matrix: SglMat4.scaling([ 4.0, 0.2, 4.0]) }, useSolidColor : true, color : [0.5, 0.7, 0.7] }, "Cage" : { mesh : "Cage", transform : { matrix: SglMat4.mul(SglMat4.translation([0.0, 7.0, 0.0]), SglMat4.scaling([ 0.9, 1.0, 0.9])) }, useTransparency : true, alpha : 0.5 }, "Lady" : { mesh : "Laurana", transform : { matrix: SglMat4.mul(SglMat4.translation([0.0, 75.0, 0.0]), SglMat4.scaling([ 0.3, 0.3, 0.3])) }, tags: ["Group"], visible: false }, "GargoSingle" : { mesh : "GargoyleSingle", transform : { matrix: SglMat4.translation([0.0, 117.0, 0.0]) }, tags: ["Group"] }, "GargoMulti" : { mesh : "GargoyleMulti", transform : { matrix: SglMat4.translation([0.0, 5.0, 0.0]) }, tags: ["Group"], visible: false } }, trackball: { type : TurnTableTrackball, trackOptions : { startDistance : 2.0, minMaxDist : [1.25, 4.0], minMaxTheta : [-30.0, 80.0] } }, space : { centerMode : "explicit", radiusMode : "specific", whichInstanceRadius : "Base", explicitCenter : [0.0, 70.0, 0.0] } }); } ``` -------------------------------- ### getClippingRendermode Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Returns the current rendering setup of the sectioning tool, including plane visibility, edge visibility, edge size, and edge color. ```APIDOC ## getClippingRendermode() ### Description Returns the current rendering setup of the sectioning tool (sectioning planes and edges visibility state, edges size and color values). ### Returns - **array** - A 4-dimensional array containing the sectioning tool setup values: sectioning planes visibility (true if rendered, false if not), sectioning edges visibility (true if rendered, false if not), sectioning edges size value (expressed in scene space absolute value), sectioning edges color 3-dimensional array (expressed in RGB arithmetic notation, from 0 to 1, with any fractional value in between). ``` -------------------------------- ### setClippingRendermode(state, state, *size, *color) Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Customizes the rendering setup of the sectioning tool, including plane and edge visibility, size, and color. ```APIDOC ## setClippingRendermode(state, state, *size, *color) ### Description Customizes the rendering setup of the sectioning tool (sectioning planes and edges visibility state, and optionally edges size and color values). ### Parameters #### Path Parameters - **state** (boolean) - Required - true to render the sectioning planes (if any), false to not render (true by default). - **state** (boolean) - Required - true to render the sectioning edges (if any), false to not render (false by default). - **size** (number) - Optional - The size value (expressed in scene space absolute value) of the sectioning edges (if rendered). Accepts values greater than 0.0. (default sectioning edges size is 0.5). - **color** (array) - Optional - The 3-dimensional array containing color values of the sectioning edges (if rendered). Accepts values expressed in RGB arithmetic notation (from 0 to 1, with any fractional value in between). (default sectioning edges color is [0.0, 1.0, 1.0]). ``` -------------------------------- ### getNexusMinFps Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Returns the minimum frames-per-second value specified in the NEXUS progressive rendering setup. ```APIDOC ## getNexusMinFps() ### Description Returns the minimum frames-per-second value specified in the NEXUS progressive rendering setup. ### Returns - **number** - The frame rate value below which NEXUS should not go during the interactive rendering. ``` -------------------------------- ### Document Ready Initialization Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/minimal/3DHOP_all_tools.html Initializes the 3DHOP environment and sets up the presenter when the document is fully loaded. ```javascript $(document).ready(function(){ init3dhop(); setup3dhop(); }); ``` -------------------------------- ### getGeometricError Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Retrieves the target geometric-error value used in the NEXUS progressive rendering setup. ```APIDOC ## getGeometricError ### Description Returns the target geometric-error value specified in the NEXUS progressive rendering setup. This value is used by NEXUS as a reference for view-dependent refinement. ### Returns - `[number]`: The target geometric-error value. ``` -------------------------------- ### Initialize 3DHOP Presenter and Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_1.2_interface_dimensioning.html Sets up the 3DHOP presenter and defines the scene with meshes and model instances. Call this after the DOM is ready. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" } }, modelInstances : { "Model1" : { mesh : "Gargoyle" } } }); } ``` -------------------------------- ### getNexusTargetError Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Returns the target error value specified in the NEXUS progressive rendering setup. ```APIDOC ## getNexusTargetError() ### Description Returns the target error value specified in the NEXUS progressive rendering setup. ### Returns - **number** - The target error value which NEXUS should aim to achieve during the interactive rendering. ``` -------------------------------- ### getNexusMaxCacheSize Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Returns the maximum cache-size value specified in the NEXUS progressive rendering setup. ```APIDOC ## getNexusMaxCacheSize() ### Description Returns the maximum cache-size value specified in the NEXUS progressive rendering setup. ### Returns - **number** - The cache limit value (expressed in megabytes) which NEXUS should not exceed during the interactive rendering. ``` -------------------------------- ### Initialize 3DHOP Presenter and Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.3_measurement_tool.html Sets up the 3DHOP presenter and defines the scene with meshes and model instances. Configure trackball options for camera control. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Cube" : { url: "models/cube.ply" } }, modelInstances : { "Gargo" : { mesh : "Gargoyle" }, "Base" : { mesh : "Cube", transform : { translation : [0.0, -5.0, 0.0], scale : [3.0, 0.2, 3.0] }, } }, trackball: { type : TurntablePanTrackball, trackOptions : { startDistance: 1.3, startPhi: 40.0, startTheta: 20.0, minMaxDist: [0.8, 2.5], minMaxPhi: [-180, 180], minMaxTheta: [-30.0, 70.0] } }, space: { centerMode: "scene", radiusMode: "scene" } }); presenter._onEndMeasurement = onEndMeasure; } ``` -------------------------------- ### Initialize 3DHOP Presenter and Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_pantilt.html Sets up the 3DHOP presenter and configures the scene, including mesh loading and trackball options for PanTilt interaction. Ensure the 'draw-canvas' element exists in your HTML. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Laurana" : { url: "models/laurana.ply" } }, modelInstances : { "Model1" : { mesh : "Laurana" } }, trackball: { type : PanTiltTrackball, trackOptions : { startPanX: 0.0, startPanY: 0.0, startAngleX: 0.0, startAngleY: 0.0, startDistance: 2.5, minMaxPanX: [-0.7, 0.7], minMaxPanY: [-0.7, 0.7], minMaxAngleX: [-70.0, 70.0], minMaxAngleY: [-70.0, 70.0], minMaxDist: [0.5, 3.0] } } }); } ``` -------------------------------- ### Initialize 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/minimal/3DHOP_all_tools.html Sets up the 3DHOP presenter with scene configuration, including meshes, model instances, and trackball options. It also initializes measurement and point picking callbacks. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "mesh_1" : { url: "models/gargo.nxz" } }, modelInstances : { "model_1" : { mesh : "mesh_1", color : [0.8, 0.7, 0.75] } }, trackball: { type : TurntablePanTrackball, trackOptions : { startPhi: 35.0, startTheta: 15.0, startDistance: 2.5, minMaxPhi: [-180, 180], minMaxTheta: [-30.0, 70.0], minMaxDist: [0.5, 3.0] } } }); //--MEASURE-- presenter._onEndMeasurement = onEndMeasure; //--MEASURE-- //--POINT PICKING-- presenter._onEndPickingPoint = onEndPick; //--POINT PICKING-- //--SECTIONS-- sectiontoolInit(); //--SECTIONS-- } ``` -------------------------------- ### Initialize 3DHOP Presenter and Scene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.2_hotspots_events.html Sets up the 3DHOP presenter, defines scene elements including meshes, model instances, and hotspots with their transformations and properties. Also configures trackball behavior. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Cube" : { url: "models/cube.ply" }, "Sphere" : { url: "models/sphere.ply" }, "Wing" : { url: "models/wing.ply" } }, modelInstances : { "Gargo" : { mesh : "Gargoyle" }, "Base" : { mesh : "Cube", transform : { matrix: SglMat4.mul(SglMat4.translation([0.0, -5.0, 0.0]), SglMat4.scaling([ 3.0, 0.2, 3.0])) } } }, spots : { "Wing" : { mesh : "Wing", transform : { matrix: SglMat4.mul(SglMat4.translation([ 3.3, 110.0, -7.0]), SglMat4.rotationAngleAxis(sglDegToRad(-5.0), [0.0, 0.0, 1.0])) }, color : [0.0, 0.25, 1.0] }, "Sphere" : { mesh : "Sphere", transform : { matrix: SglMat4.mul(SglMat4.translation([-2.0, 12.0, 25.0]), SglMat4.scaling([ 30.0, 15.0, 15.0])) }, color : [0.1, 0.25, 0.7], alpha : 0.2, alphaHigh : 0.5 } }, trackball: { type : TurnTableTrackball, trackOptions : { startDistance : 3.0, minMaxDist : [2.0, 5.0], minMaxTheta : [-10.0, 70.0] } } }); presenter.setSpotVisibility(HOP_ALL, false, true); presenter._onPickedSpot = onPickedSpot; presenter._onPickedInstance = onPickedInstance; } ``` -------------------------------- ### Initialize and Configure 3DHOP Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.4_point_picking.html Sets up the 3DHOP presenter with scene geometry, model instances, and trackball controls. Ensure the 'draw-canvas' element exists in your HTML. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Gargoyle" : { url: "models/gargo.nxz" }, "Cube" : { url: "models/cube.ply" } }, modelInstances : { "Gargo" : { mesh : "Gargoyle" }, "Base" : { mesh : "Cube", transform : { translation : [0.0, -5.0, 0.0], scale : [3.0, 0.2, 3.0] } }, }, trackball: { type : TurntablePanTrackball, trackOptions : { startDistance: 1.3, startPhi: 40.0, startTheta: 20.0, minMaxDist: [0.8, 2.5], minMaxPhi: [-180, 180], minMaxTheta: [-30.0, 70.0] } }, space: { centerMode: "scene", radiusMode: "scene" } }); presenter._onEndPickingPoint = onEndPick; } ``` -------------------------------- ### sectiontoolInit() Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Initializes the components within the planes section tool output box. ```APIDOC ## sectiontoolInit() ### Description Initialize the components in the planes section tool output box; ### Method APIDOC ### Endpoint N/A ### Parameters None ### Request Example ``` sectiontoolInit() ``` ### Response None ``` -------------------------------- ### Initialize 3DHOP on Document Ready Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_1.3_models_loading.html Ensures that the 3DHOP presenter is initialized and the scene is set up once the HTML document is fully loaded and parsed. This is a standard practice for JavaScript execution on page load. ```javascript $(document).ready(function(){ init3dhop(); setup3dhop(); }); ``` -------------------------------- ### Initialize and Configure 3DHOP with Turntable Trackball Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_turntable.html Sets up the 3DHOP presenter and configures a turntable trackball with custom options for camera movement. Ensure the 'draw-canvas' element exists in your HTML. ```javascript var presenter = null; function setup3dhop() { presenter = new Presenter("draw-canvas"); presenter.setScene({ meshes: { "Laurana" : { url: "models/laurana.ply" } }, modelInstances : { "Model1" : { mesh : "Laurana" } }, trackball: { type : TurnTableTrackball, trackOptions : { startPhi: 0.0, startTheta: 0.0, startDistance: 2.5, minMaxPhi: [-180, 180], minMaxTheta: [-10.0, 50.0], minMaxDist: [0.5, 3.0] } } }); } ``` -------------------------------- ### helpSwitch() Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Switches the help button icon in the toolbar between on and off states. ```APIDOC ## helpSwitch() ### Description Switches between on/off toolbar related help button icon. ### Method APIDOC ### Endpoint N/A ### Parameters None ### Request Example ``` helpSwitch() ``` ### Response None ``` -------------------------------- ### Initialize 3DHOP on Document Ready Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.5_planes_sections.html Ensures that 3DHOP is initialized and the scene is set up after the DOM is fully loaded. It also calls initialization functions for the section tool. ```javascript $(document).ready(function(){ init3dhop(); setup3dhop(); sectiontoolInit(); }); ``` -------------------------------- ### Initialize 3DHOP on Document Ready Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.1_animations.html Ensures that the 3DHOP initialization functions are called after the DOM is fully loaded. It initializes the 3DHOP system, sets up the scene, and resizes the canvas. ```javascript $(document).ready(function(){ init3dhop(); setup3dhop(); resizeCanvas(800,600); }); ``` -------------------------------- ### _onEnterSpot Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Binds an event handler to be fired when the mouse pointer enters a spot. It provides the name of the spot. ```APIDOC ## _onEnterSpot(id) ### Description Binds an event handler to be fired when the mouse enters a spot. ### Parameters - **id** (string) - The spot name specified in the "spots" field of "setScene". ``` -------------------------------- ### _onEnterInstance Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Binds an event handler to be fired when the mouse pointer enters an instance. It provides the name of the instance. ```APIDOC ## _onEnterInstance(id) ### Description Binds an event handler to be fired when the mouse enters an instance. ### Parameters - **id** (string) - The instance name specified in the "modelInstance" field of "setScene". ``` -------------------------------- ### _onLeaveSpot Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Binds an event handler to be fired when the mouse pointer leaves a spot. It provides the name of the spot. ```APIDOC ## _onLeaveSpot(id) ### Description Binds an event handler to be fired when the mouse leaves a spot. ### Parameters - **id** (string) - The spot name specified in the "spots" field of "setScene". ``` -------------------------------- ### Handle User Actions in Toolbar Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.4_camera_lighting.html Processes user actions from a toolbar, such as zooming, toggling lighting, and switching camera perspectives. Requires the presenter object to be initialized. ```javascript function actionsToolbar(action) { if(action=='home') presenter.resetTrackball(); else if(action=='zoomin') presenter.zoomIn(); else if(action=='zoomout') presenter.zoomOut(); else if(action=='lighting' || action=='lighting_off') { presenter.enableSceneLighting(!presenter.isSceneLightingEnabled()); lightingSwitch(); } else if(action=='perspective' || action=='orthographic') { presenter.toggleCameraType(); cameraSwitch(); } else if(action=='full' || action=='full_on') fullscreenSwitch(); } ``` -------------------------------- ### setScene Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html The main 3DHOP method to set the 3D scene with specified options. ```APIDOC ## setScene(options) ### Description 3DHOP main method, set the 3D scene. ### Parameters #### Path Parameters - **options** - (type not specified in source) ``` -------------------------------- ### setInstanceLighting Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Sets the lighting for a specific model instance identified by its tag. ```APIDOC ## setInstanceLighting(tag, state, redraw) ### Description Sets the lighting for the model instance specified by tag. ### Parameters #### Path Parameters - **tag** (string) - Required - The tag keyword specified in the "tags" field of "modelInstance" (in "setScene") that refers the instance of the model on which the lighting command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the models instances. - **state** (boolean) - Required - true to active the instance lighting, false to not active. - **redraw** (boolean) - Required - true to redraw the 3D scene, false to not redraw. ``` -------------------------------- ### Handle Toolbar Actions in 3DHOP Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.1_animations.html Defines functions to handle user interactions from a toolbar, including navigating to home position, zooming, toggling light control, and switching fullscreen mode. It also includes a callback for when the trackball arrives at a position. ```javascript function actionsToolbar(action) { if(action=='home') presenter.setTrackballPosition(\[ 0.0, 0.0, 3.0\]); else if(action=='zoomin') presenter.zoomIn(); else if(action=='zoomout') presenter.zoomOut(); else if(action=='light' || action=='light\_on') { presenter.enableLightTrackball(!presenter.isLightTrackballEnabled()); lightSwitch(); } else if(action=='full' || action=='full\_on') fullscreenSwitch(); } ``` ```javascript function onTrackballArrived(state){ log(state); } ``` -------------------------------- ### lightSwitch() Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Switches the light control button icon in the toolbar between on and off states. Turning on this icon also activates the lighting button if present and off. ```APIDOC ## lightSwitch() ### Description Switches between on/off toolbar related light control button icon. Turning on the light control button icon also turns on the lighting button icon (if present and off); ### Method APIDOC ### Endpoint N/A ### Parameters None ### Request Example ``` lightSwitch() ``` ### Response None ``` -------------------------------- ### cameraSwitch() Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Switches the camera projection button icon in the toolbar between on and off states. ```APIDOC ## cameraSwitch() ### Description Switches between on/off toolbar related camera projection button icon. ### Method APIDOC ### Endpoint N/A ### Parameters None ### Request Example ``` cameraSwitch() ``` ### Response None ``` -------------------------------- ### isInstanceLightingEnabledByName Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Checks the lighting activation status for a specific model instance identified by its name. ```APIDOC ## isInstanceLightingEnabledByName(name) ### Description Returns the lighting activation status in the 3D scene of the model instance specified by name. ### Parameters #### Path Parameters - **name** (`string`): The instance name specified in "modelInstance" (in "setScene") that refers the instance of the model on which the lighting command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the models instances ("HOP_ALL is the default name value"). ### Returns - `[boolean]`: `true` if active, `false` if not active. If tag is "HOP_ALL", the function returns `true` if at least one of all the instances enables lighting. ``` -------------------------------- ### Handle Toolbar Actions in 3DHOP Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_sphere.html Defines functions to handle user interactions from a toolbar, such as resetting the camera, zooming, and controlling lights or fullscreen mode. Ensure the presenter object is initialized before calling these actions. ```javascript function actionsToolbar(action) { if(action=='home') presenter.resetTrackball(); else if(action=='zoomin') presenter.zoomIn(); else if(action=='zoomout') presenter.zoomOut(); else if(action=='light' || action=='light_on') { presenter.enableLightTrackball(!presenter.isLightTrackballEnabled()); lightSwitch(); } else if(action=='full' || action=='full_on') fullscreenSwitch(); } ``` -------------------------------- ### version Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Checks the 3DHOP version. ```APIDOC ## version() ### Description Check the _3DHOP_ version. ### Returns - **constant** (constant) - The constant value that refers to the framework version number (expressed in "version major" dot "version minor" dot "version revision" format). ``` -------------------------------- ### Document Ready Initialization for 3DHOP Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_sphere.html Ensures that 3DHOP initialization functions are called only after the DOM is fully loaded. This is a standard jQuery pattern for safe DOM manipulation. ```javascript $(document).ready(function(){ init3dhop(); setup3dhop(); }); ``` -------------------------------- ### _onPickedInstance Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Binds an event handler to be fired when an instance is clicked. It provides the name of the clicked instance. ```APIDOC ## _onPickedInstance(id) ### Description Binds an event handler to be fired when the mouse clicks an instance. ### Parameters - **id** (string) - The instance name specified in the "modelInstance" field of "setScene". ``` -------------------------------- ### movePickpointbox(left, top) Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Moves the 3DHOP point picking output box around the screen. ```APIDOC ## movePickpointbox(left, top) ### Description Move the _3DHOP_ point picking output box around the screen; ### Method APIDOC ### Endpoint N/A ### Parameters #### Path Parameters - **left** (number) - Optional - point picking box left space in px (relative to _3DHOP_ container, due to anchorage default value is related to toolbar position). Accepts the CSS positioning syntax too (enclosed in quotes); - **top** (number) - Optional - point picking box top space in px (relative to _3DHOP_ container, due to anchorage default value is related to toolbar position). Accepts the CSS positioning syntax too (enclosed in quotes); ### Request Example ``` movePickpointbox(10, 10) ``` ### Response None ``` -------------------------------- ### supportsWebGL Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Checks if the system supports the WebGL API. ```APIDOC ## supportsWebGL() ### Description Checks if the system supports the WebGL API. ### Returns - **boolean** - True if supported, false otherwise. ``` -------------------------------- ### pickpointSwitch() Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Switches the point picking tool button icon in the toolbar between on and off states. ```APIDOC ## pickpointSwitch() ### Description Switches between on/off toolbar related point picking tool button icon; ### Method APIDOC ### Endpoint N/A ### Parameters None ### Request Example ``` pickpointSwitch() ``` ### Response None ``` -------------------------------- ### enableSceneLighting Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Enables or disables the 3D scene lighting system. ```APIDOC ## enableSceneLighting(state) ### Description Enables or disables the 3D scene lighting system. Disabling the scene lighting also disables the interactive light trackball control (if enabled). ### Parameters #### Path Parameters - **state** (boolean) - Required - true to enable, false to disable (scene lighting is enabled by default). ``` -------------------------------- ### Handle Toolbar Actions in 3DHOP Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.4_camera_lighting_combined.html Defines functions to handle user interactions from a toolbar, such as zooming, toggling lighting, changing camera perspective, and entering fullscreen. This function maps actions to presenter methods. ```javascript function actionsToolbar(action) { if(action=='home') presenter.resetTrackball(); else if(action=='zoomin') presenter.zoomIn(); else if(action=='zoomout') presenter.zoomOut(); else if(action=='lighting' || action=='lighting_off') { presenter.enableSceneLighting(!presenter.isSceneLightingEnabled()); lightingSwitch(); } else if(action=='light' || action=='light_on') { presenter.enableLightTrackball(!presenter.isLightTrackballEnabled()); lightSwitch(); } else if(action=='perspective' || action=='orthographic') { presenter.toggleCameraType(); cameraSwitch(); } else if(action=='full' || action=='full_on') fullscreenSwitch(); } ``` -------------------------------- ### Handle Toolbar Actions in 3DHOP Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_3.3_measurement_tool.html Manages actions triggered from the toolbar, such as resetting the camera, zooming, toggling light control, enabling the measurement tool, and switching fullscreen mode. ```javascript function actionsToolbar(action) { if(action=='home') presenter.resetTrackball(); else if(action=='zoomin') presenter.zoomIn(); else if(action=='zoomout') presenter.zoomOut(); else if(action=='light' || action=='light_on') { presenter.enableLightTrackball(!presenter.isLightTrackballEnabled()); lightSwitch(); } else if(action=='measure' || action=='measure_on') { presenter.enableMeasurementTool(!presenter.isMeasurementToolEnabled()); measureSwitch(); } else if(action=='full' || action=='full_on') fullscreenSwitch(); } ``` -------------------------------- ### toggleInstanceLighting Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Toggles the lighting for a specific model instance. ```APIDOC ## toggleInstanceLighting(tag, redraw) ### Description Toggles the lighting in the 3D scene of the model instance specified by tag. ### Parameters #### Path Parameters - **tag** (string) - Required - The tag keyword of the model instance. Accepts "HOP_ALL" for all instances. - **redraw** (boolean) - Required - True to redraw the scene, false otherwise. ``` -------------------------------- ### Handle Toolbar Actions for 3D Presenter Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/examples/HOWTO_2.1_trackball_turntablepan.html Manages user interactions from a toolbar, such as resetting the camera, zooming, toggling light controls, and switching to fullscreen mode. This function should be called when a toolbar button is clicked. ```javascript function actionsToolbar(action) { if(action=='home') presenter.resetTrackball(); else if(action=='zoomin') presenter.zoomIn(); else if(action=='zoomout') presenter.zoomOut(); else if(action=='light' || action=='light_on') { presenter.enableLightTrackball(!presenter.isLightTrackballEnabled()); lightSwitch(); } else if(action=='full' || action=='full_on') fullscreenSwitch(); } ``` -------------------------------- ### colorSwitch() Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Switches the color mode button icon in the toolbar between on and off states. ```APIDOC ## colorSwitch() ### Description Switches between on/off toolbar related color mode button icon. ### Method APIDOC ### Endpoint N/A ### Parameters None ### Request Example ``` colorSwitch() ``` ### Response None ``` -------------------------------- ### _onPickedSpot Source: https://github.com/cnr-isti-vclab/3dhop/blob/master/documentation/docs.html Binds an event handler to be fired when a spot is clicked. It provides the name of the clicked spot. ```APIDOC ## _onPickedSpot(id) ### Description Binds an event handler to be fired when the mouse clicks a spot. ### Parameters - **id** (string) - The spot name specified in the "spots" field of "setScene". ```