diff --git a/README.txt b/README.txt old mode 100755 new mode 100644 diff --git a/SRIP/Libraries/New Text Document.txt b/SRIP/Libraries/New Text Document.txt new file mode 100644 index 000000000..e69de29bb diff --git a/SRIP/codes/New Text Document.txt b/SRIP/codes/New Text Document.txt new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/backup b/scripts/backup old mode 100755 new mode 100644 diff --git a/scripts/init.sh b/scripts/init.sh old mode 100755 new mode 100644 diff --git a/scripts/restore b/scripts/restore old mode 100755 new mode 100644 diff --git a/scripts/shutdown.sh b/scripts/shutdown.sh old mode 100755 new mode 100644 diff --git a/scripts/startup b/scripts/startup old mode 100755 new mode 100644 diff --git a/scripts/startup.sh b/scripts/startup.sh old mode 100755 new mode 100644 diff --git a/scripts/stop b/scripts/stop old mode 100755 new mode 100644 diff --git a/scripts/test b/scripts/test old mode 100755 new mode 100644 diff --git a/scripts/test-to-deploy.sh b/scripts/test-to-deploy.sh old mode 100755 new mode 100644 diff --git a/scripts/transfer.sh b/scripts/transfer.sh old mode 100755 new mode 100644 diff --git a/search-result.html b/search-result.html old mode 100755 new mode 100644 diff --git a/src/help/help.html b/src/help/help.html old mode 100755 new mode 100644 diff --git a/src/help/images/Sitemap.png b/src/help/images/Sitemap.png old mode 100755 new mode 100644 diff --git a/src/help/images/newsitemap.png b/src/help/images/newsitemap.png old mode 100755 new mode 100644 diff --git a/src/help/images/sections.png b/src/help/images/sections.png old mode 100755 new mode 100644 diff --git a/src/help/index.html b/src/help/index.html old mode 100755 new mode 100644 diff --git a/src/lab/Courses Aligned.html b/src/lab/Courses Aligned.html old mode 100755 new mode 100644 diff --git a/src/lab/Courses Aligned.html?domain=Computer Science~ b/src/lab/Courses Aligned.html?domain=Computer Science~ deleted file mode 100755 index 6db8ec268..000000000 --- a/src/lab/Courses Aligned.html?domain=Computer Science~ +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - - - - Welcome to Virtual Labs - A MHRD Govt of india Initiative - - - - - - - - - - - - - - - - - -
-
- - -
- -
-
-
-
-
-
- - - -
-

Computer Science & Engineering

- -
- - -
- -

Computer Graphics

-

- The basic concepts of CG are alignd with courses such as Linear Algebra, Matrix Theory, Projective Geometry and the like. The experiments touch on most topics covered in such courses in most curricula. -

-
- -
- - - -
-
- - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/src/lab/Courses Aligned.html~ b/src/lab/Courses Aligned.html~ old mode 100755 new mode 100644 diff --git a/src/lab/Feedback.html b/src/lab/Feedback.html deleted file mode 100755 index 8990ce5a9..000000000 --- a/src/lab/Feedback.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - Welcome to Virtual Labs - A MHRD Govt of india Initiative - - - - - - - - - - - - - - - - - - -
-
- - -
- -
-
-
-
-
-
- - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - diff --git a/src/lab/Feedback.html~ b/src/lab/Feedback.html~ old mode 100755 new mode 100644 diff --git a/src/lab/Introduction.html b/src/lab/Introduction.html deleted file mode 100755 index bc9b9a8ff..000000000 --- a/src/lab/Introduction.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - Welcome to Virtual Labs - A MHRD Govt of india Initiative - - - - - - - - - - - - - - - - - - -
-
- - -
- -
-
-
-
-
-
- - - -
-

Computer Science & Engineering

- -
- - -
- - -

Computer Graphics

-

- Welcome to the Computer Graphics lab ! Here , we will try some - virtual experiments to understand the different concepts of - graphics. We will go through understanding the concepts of 3D - Coordinate systems, Transformations, Hierarchical modelling - and Cameras. Later we will be visualising some basic algorithms - used to render the graphics. -

-
-
-
- - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - diff --git a/src/lab/List of experiments.html b/src/lab/List of experiments.html old mode 100755 new mode 100644 diff --git a/src/lab/List of experiments.html~ b/src/lab/List of experiments.html~ old mode 100755 new mode 100644 diff --git a/src/lab/Prerequisites.html b/src/lab/Prerequisites.html deleted file mode 100755 index b2ecc5412..000000000 --- a/src/lab/Prerequisites.html +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - Welcome to Virtual Labs - A MHRD Govt of india Initiative - - - - - - - - - - - - - - - - - -
-
- - -
- -
-
-
-
-
-
- - - -
-

Computer Science & Engineering

- -
- - -
- -
- Prerequisite S/W -
-

-

-

-
- -
- - - -
-
- - - - - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/src/lab/Prerequisites.html~ b/src/lab/Prerequisites.html~ old mode 100755 new mode 100644 diff --git a/src/lab/Target Audience.html b/src/lab/Target Audience.html old mode 100755 new mode 100644 diff --git a/src/lab/VirtualLabGraphics.zip b/src/lab/VirtualLabGraphics.zip old mode 100755 new mode 100644 diff --git a/src/lab/VirtualLabGraphics/Experiment.sh b/src/lab/VirtualLabGraphics/Experiment.sh old mode 100755 new mode 100644 diff --git a/src/lab/VirtualLabGraphics/META-INF/MANIFEST.MF b/src/lab/VirtualLabGraphics/META-INF/MANIFEST.MF index d42c656c0..924cfe885 100644 --- a/src/lab/VirtualLabGraphics/META-INF/MANIFEST.MF +++ b/src/lab/VirtualLabGraphics/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ -Manifest-Version: 1.0 -Rsrc-Class-Path: ./ newt.all.jar gluegen-rt.jar nativewindow.all.jar j - ogl.all.jar -Class-Path: . -Rsrc-Main-Class: experiments.experiment1.Experiment1 -Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader - +Manifest-Version: 1.0 +Rsrc-Class-Path: ./ newt.all.jar gluegen-rt.jar nativewindow.all.jar j + ogl.all.jar +Class-Path: . +Rsrc-Main-Class: experiments.experiment1.Experiment1 +Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader + diff --git a/src/lab/VirtualLabGraphics/Start.jar b/src/lab/VirtualLabGraphics/Start.jar old mode 100755 new mode 100644 diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/1.html index 282eb7d98..3d2e1b95f 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/1.html @@ -1,23 +1,23 @@ -Points and Co-ordinate Systems
-Introduction to the interface -
Next -

-This experiment is designed to teach how points and co-ordinate systems are represented in computer graphics. -The display on your left shows the world with each shape and co-ordinate system that you create. -The absolute co-ordinate system and XY grid is displayed for reference. -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. -Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Points and Co-ordinate Systems
+Introduction to the interface +
Next +

+This experiment is designed to teach how points and co-ordinate systems are represented in computer graphics. +The display on your left shows the world with each shape and co-ordinate system that you create. +The absolute co-ordinate system and XY grid is displayed for reference. +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. +Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/2.html index a541c764f..dfb2725ea 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/2.html @@ -1,14 +1,14 @@ -Points and Co-ordinate Systems
-The Set-up -
Previous | Next -

-This experiment starts with a single point and a co-ordinate system. -The absolute co-ordinates of this point are displayed below the tree. -

-

-Drag with the left mouse button to move this point around and see how the co-ordinates are updated. -

-

-You can also edit the co-ordinates manually and see how the point moves to the correct place. -

+Points and Co-ordinate Systems
+The Set-up +
Previous | Next +

+This experiment starts with a single point and a co-ordinate system. +The absolute co-ordinates of this point are displayed below the tree. +

+

+Drag with the left mouse button to move this point around and see how the co-ordinates are updated. +

+

+You can also edit the co-ordinates manually and see how the point moves to the correct place. +


Previous | Next \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/3.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/3.html index 09040577d..4934556df 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/3.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/3.html @@ -1,15 +1,15 @@ -Points and Co-ordinate Systems
-Co-ordinate Trackers -
Previous | Next -

-To see how the co-ordinates are interpreted using the co-ordinate system, double-click Shape 1, followed by Vertices. -The vertices shown between '[' and ']' are the homogeneous co-ordinates of this point. -Clicking on this node makes it editable. -You can change the co-ordinates of this point, which are then interpreted in terms of the co-ordinate system. -

-

-To see how the co-ordinates are calculated, click on the Tracking checkbox next to the editable co-ordinates of this point. -You will see two co-ordinate trackers parallel to the axes intersecting them at certain distances. -These distances are the co-ordinates of this point. -

+Points and Co-ordinate Systems
+Co-ordinate Trackers +
Previous | Next +

+To see how the co-ordinates are interpreted using the co-ordinate system, double-click Shape 1, followed by Vertices. +The vertices shown between '[' and ']' are the homogeneous co-ordinates of this point. +Clicking on this node makes it editable. +You can change the co-ordinates of this point, which are then interpreted in terms of the co-ordinate system. +

+

+To see how the co-ordinates are calculated, click on the Tracking checkbox next to the editable co-ordinates of this point. +You will see two co-ordinate trackers parallel to the axes intersecting them at certain distances. +These distances are the co-ordinates of this point. +


Previous | Next \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/4.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/4.html index 7d5659a8d..d40fe353c 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/4.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/4.html @@ -1,22 +1,22 @@ -Points and Co-ordinate Systems
-Non-orthogonal co-ordinate systems -
Previous | Next -

-Until now, we have been using a co-ordinate system with axes that are perpendicular to each other. -Such a co-ordinate system is called an Orthogonal Co-ordinate System. -

-

-To make this co-ordinate system Non-orthogonal, double click on Co-ordinate System 1. -The nodes X, Y and Z are the direction vectors of the axes of this co-ordinate system in a Global reference frame. -Edit them to make the angles between them other than 90 degrees. -

-

-The Global reference frame is always fixed and has Orthogonal Co-ordinate system which can never be changed. -

-

-The Axes Size defines how many units of the axis to be drawn each side. -

-

-The Show Units option is used to show or hide the units drawn on the co-ordinate trackers. -

-
Previous | Next +Points and Co-ordinate Systems
+Non-orthogonal co-ordinate systems +
Previous | Next +

+Until now, we have been using a co-ordinate system with axes that are perpendicular to each other. +Such a co-ordinate system is called an Orthogonal Co-ordinate System. +

+

+To make this co-ordinate system Non-orthogonal, double click on Co-ordinate System 1. +The nodes X, Y and Z are the direction vectors of the axes of this co-ordinate system in a Global reference frame. +Edit them to make the angles between them other than 90 degrees. +

+

+The Global reference frame is always fixed and has Orthogonal Co-ordinate system which can never be changed. +

+

+The Axes Size defines how many units of the axis to be drawn each side. +

+

+The Show Units option is used to show or hide the units drawn on the co-ordinate trackers. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/5.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/5.html index ebf86fa86..2a3ea155e 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/5.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/5.html @@ -1,13 +1,13 @@ -Points and Co-ordinate Systems
-Homogeneous co-ordinates -
Previous | Next -

-Each co-ordinate shown between [ and ] has an extra component which acts as a scaling factor. -These co-ordinates are called Homogeneous Co-ordinates. -E.g. [4,3,-1,2] represents the location (2,1.5,-0.5) in Cartesian space. -This factor, usually represented by w, is a useful tool for applying certain transformations, which will be introduced in later experiments. -

-Edit the fourth component of the co-ordinates of the current point to see its effect. -The Homogeneous and Cartesian co-ordinates of this point are always shown at the bottom. -

-
Previous | Next +Points and Co-ordinate Systems
+Homogeneous co-ordinates +
Previous | Next +

+Each co-ordinate shown between [ and ] has an extra component which acts as a scaling factor. +These co-ordinates are called Homogeneous Co-ordinates. +E.g. [4,3,-1,2] represents the location (2,1.5,-0.5) in Cartesian space. +This factor, usually represented by w, is a useful tool for applying certain transformations, which will be introduced in later experiments. +

+Edit the fourth component of the co-ordinates of the current point to see its effect. +The Homogeneous and Cartesian co-ordinates of this point are always shown at the bottom. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/6.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/6.html index e481ad55b..562a76c95 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/6.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/6.html @@ -1,10 +1,10 @@ -Points and Co-ordinate Systems
-Working in 3D and Loading Shapes -
Previous | Next -

-• The experiment starts in 2D for simplicity but you can switch to 3D at any point by going to the Display tab and clicking the 3D checkbox. -

-

• Instead of working with a single point, you can load new shapes. Click on New and choose a shape from the drop-down. -It has been pre-loaded with a few shapes but you can supply your own PLY file for a shape. -

-
Previous | Next +Points and Co-ordinate Systems
+Working in 3D and Loading Shapes +
Previous | Next +

+• The experiment starts in 2D for simplicity but you can switch to 3D at any point by going to the Display tab and clicking the 3D checkbox. +

+

• Instead of working with a single point, you can load new shapes. Click on New and choose a shape from the drop-down. +It has been pre-loaded with a few shapes but you can supply your own PLY file for a shape. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/7.html b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/7.html index 3c9838c8e..0e44a76ef 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/7.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment1/instructions/7.html @@ -1,11 +1,11 @@ -Points and Co-ordinate Systems
-Extra Features of the interface -
Previous -
Some other features of this interface: -

Click on the Display tab to change how the display is drawn. You can show or hide the XY, YZ and ZX grids. Other options will be explained in future experiments.

-

When Lock Vertices under Display tab is unchecked drag with the left mouse button to move the current point around. Press shift to clip the co-ordinates to integer points.

-

Drag with the right mouse button to rotate the display

-

Drag with the middle mouse button to shift the display

-

Use the mouse wheel to zoom in and out of the display

-

Click on Reset View at any time to remove any modifications to the display

-
Previous +Points and Co-ordinate Systems
+Extra Features of the interface +
Previous +
Some other features of this interface: +

Click on the Display tab to change how the display is drawn. You can show or hide the XY, YZ and ZX grids. Other options will be explained in future experiments.

+

When Lock Vertices under Display tab is unchecked drag with the left mouse button to move the current point around. Press shift to clip the co-ordinates to integer points.

+

Drag with the right mouse button to rotate the display

+

Drag with the middle mouse button to shift the display

+

Use the mouse wheel to zoom in and out of the display

+

Click on Reset View at any time to remove any modifications to the display

+
Previous diff --git a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/1.html index 72c1c9e4c..edaa8cc6f 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/1.html @@ -1,21 +1,21 @@ -Translation
-Introduction to the interface -
Next -

-This experiment is designed to teach how the translation transformation works when applied to points and co-ordinate systems. -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. -Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Translation
+Introduction to the interface +
Next +

+This experiment is designed to teach how the translation transformation works when applied to points and co-ordinate systems. +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. +Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/2.html index e4f9969d6..3f83e42e2 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/2.html @@ -1,16 +1,16 @@ -Translation
-The Set-up -
Previous | Next -

-This experiment starts with a single point and co-ordinate system as in the previous experiment. -A translation transformation has been applied to this point. -This translation is animated. -

-

-Drag the slider at the bottom to go forwards or backwards in the animation. -

-

-The translation distances are editable. Double click on Transformation 1, followed by Translation to view the details of the translation applied. -Edit the translation values inside the '<' and '>' brackets and see how it affects the point. -

-
Previous | Next +Translation
+The Set-up +
Previous | Next +

+This experiment starts with a single point and co-ordinate system as in the previous experiment. +A translation transformation has been applied to this point. +This translation is animated. +

+

+Drag the slider at the bottom to go forwards or backwards in the animation. +

+

+The translation distances are editable. Double click on Transformation 1, followed by Translation to view the details of the translation applied. +Edit the translation values inside the '<' and '>' brackets and see how it affects the point. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/3.html b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/3.html index 298f91ec1..4a2f91973 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/3.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/3.html @@ -1,25 +1,25 @@ -Translation
-Vector Addition vs. Matrix Product form -
Previous | Next -

-Translation can be represented in two ways: -

-

-1. Vector Addition Form: translation by (tx,ty,tz) units can be represented as the addition of the vector to the Cartesian co-ordinates of each point. -

-

-2. Matrix Product Form: the same translation may be represented as the product of the Translation Matrix: - - - - - - - -
100tx
010ty
001tz
0001
-and the Homogeneous Vector [x y z w]T -

-

-The Translation Matrix is animated and can be seen under the Translation node. -

-
Previous | Next +Translation
+Vector Addition vs. Matrix Product form +
Previous | Next +

+Translation can be represented in two ways: +

+

+1. Vector Addition Form: translation by (tx,ty,tz) units can be represented as the addition of the vector to the Cartesian co-ordinates of each point. +

+

+2. Matrix Product Form: the same translation may be represented as the product of the Translation Matrix: + + + + + + + +
100tx
010ty
001tz
0001
+and the Homogeneous Vector [x y z w]T +

+

+The Translation Matrix is animated and can be seen under the Translation node. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/4.html b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/4.html index ea38cd018..9df31fbd3 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/4.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/4.html @@ -1,10 +1,10 @@ -Translation
-Interpreting Transformations -
Previous | Next -

-Any transformation can be interpreted either as a modification of each point in the co-ordinate system or the modification of the co-ordinate system itself. -

-

-Switch between the two interpretations at any point using the Transform Co-ordinate Systems checkbox under the Display tab. -

+Translation
+Interpreting Transformations +
Previous | Next +

+Any transformation can be interpreted either as a modification of each point in the co-ordinate system or the modification of the co-ordinate system itself. +

+

+Switch between the two interpretations at any point using the Transform Co-ordinate Systems checkbox under the Display tab. +


Previous | Next \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/5.html b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/5.html index a600bbc71..dba24bc74 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/5.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment2/instructions/5.html @@ -1,10 +1,10 @@ -Translation
-Extra Features -
Previous -

-The world shown starts out in 2D but you can switch to 3D at any point by using the 3D checkbox under the Display tab. -

-

-The duration of animation of each transformation can be edited by clicking on the Duration: node. -

+Translation
+Extra Features +
Previous +

+The world shown starts out in 2D but you can switch to 3D at any point by using the 3D checkbox under the Display tab. +

+

+The duration of animation of each transformation can be edited by clicking on the Duration: node. +


Previous \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/1.html index 577c348f6..812dbede6 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/1.html @@ -1,22 +1,22 @@ -Rotation
-Introduction to the interface -
Next -

-This experiment is designed to teach how the rotation transformation works when applied to points and co-ordinate systems. -This experiment is similar to Experiment 2 (Translation). -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. -Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Rotation
+Introduction to the interface +
Next +

+This experiment is designed to teach how the rotation transformation works when applied to points and co-ordinate systems. +This experiment is similar to Experiment 2 (Translation). +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. +Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/2.html index d11fd7964..a6c49bf56 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/2.html @@ -1,15 +1,15 @@ -Rotation
-The Set-up -
Previous | Next -

-This experiment starts with a rotation transformation applied to a point, which is animated. -

-

-Drag the slider at the bottom to go forwards or backwards in the animation. -

-

-The rotation axis and degree are editable. Double click on Transformation 1, followed by Rotation to view the details of the translation applied. -Edit the rotation angle θ and the axis of rotation (x,y,z or custom) and see how it affects the point. -Note that rotation about some axes will take the point out of the 2D plane so you should check the 3D box under Display tab before proceeding. -

-
Previous | Next +Rotation
+The Set-up +
Previous | Next +

+This experiment starts with a rotation transformation applied to a point, which is animated. +

+

+Drag the slider at the bottom to go forwards or backwards in the animation. +

+

+The rotation axis and degree are editable. Double click on Transformation 1, followed by Rotation to view the details of the translation applied. +Edit the rotation angle θ and the axis of rotation (x,y,z or custom) and see how it affects the point. +Note that rotation about some axes will take the point out of the 2D plane so you should check the 3D box under Display tab before proceeding. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/3.html b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/3.html index 77efbfe0d..797af8464 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/3.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/3.html @@ -1,32 +1,32 @@ -Rotation
-Matrix Product form -
Previous | Next -

-Rotation is performed by multiplying with a Rotation Matrix. -There are specific matrices for rotation about the X, Y and Z axes: -

- - - - - - -
RX(θ) = 1000
0cos(θ)-sin(θ)0
0sin(θ)cos(θ)0
0001
- - - - - -
RY(θ) = cos(θ)0sin(θ)0
0100
-sin(θ)0cos(θ)0
0001
- - - - - -
RZ(θ) = cos(θ)-sin(θ)00
sin(θ)cos(θ)00
0010
0001
-
-

-

-The Rotation Matrix is animated (using θ) and can be seen under the Rotation node. -

+Rotation
+Matrix Product form +
Previous | Next +

+Rotation is performed by multiplying with a Rotation Matrix. +There are specific matrices for rotation about the X, Y and Z axes: +

+ + + + + + +
RX(θ) = 1000
0cos(θ)-sin(θ)0
0sin(θ)cos(θ)0
0001
+ + + + + +
RY(θ) = cos(θ)0sin(θ)0
0100
-sin(θ)0cos(θ)0
0001
+ + + + + +
RZ(θ) = cos(θ)-sin(θ)00
sin(θ)cos(θ)00
0010
0001
+
+

+

+The Rotation Matrix is animated (using θ) and can be seen under the Rotation node. +


Previous | Next \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/4.html b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/4.html index 8fc8168bc..5ead8d555 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/4.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/4.html @@ -1,17 +1,17 @@ -Rotation
-About an arbitrary axis -
Previous | Next -

-Rotation about an arbitrary axis is done in the following manner:
-1. Rotate the arbitrary axis about one of the co-ordinate axes, say Y, to align it to one of the co-ordinate planes, say XY.
-2. Rotate this axis about the Z axis to align it to the Y axis.
-3. Perform the required rotation about the Y axis using RY.
-4. Reverse the steps 2 and 1 to put the axis back in its original alignment.
-

-

-To rotate the point about an arbitrary axis double click on Transformation 1, followed by Rotation to view the details of the translation applied. -Set the axis of rotation to custom from the drop down list and specify the axis vector in the space provided. -Edit the rotation angle θ and visualise the effect of rotation about the arbitrary axis on the point. -Note that rotation about some axes will take the point out of the 2D plane so you should check the 3D box under Display tab before proceeding. -

-
Previous | Next +Rotation
+About an arbitrary axis +
Previous | Next +

+Rotation about an arbitrary axis is done in the following manner:
+1. Rotate the arbitrary axis about one of the co-ordinate axes, say Y, to align it to one of the co-ordinate planes, say XY.
+2. Rotate this axis about the Z axis to align it to the Y axis.
+3. Perform the required rotation about the Y axis using RY.
+4. Reverse the steps 2 and 1 to put the axis back in its original alignment.
+

+

+To rotate the point about an arbitrary axis double click on Transformation 1, followed by Rotation to view the details of the translation applied. +Set the axis of rotation to custom from the drop down list and specify the axis vector in the space provided. +Edit the rotation angle θ and visualise the effect of rotation about the arbitrary axis on the point. +Note that rotation about some axes will take the point out of the 2D plane so you should check the 3D box under Display tab before proceeding. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/5.html b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/5.html index 0c55b08e2..5a4c6d1d1 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/5.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment3/instructions/5.html @@ -1,17 +1,17 @@ -Rotation
-About a point -
Previous -

-Rotation matrices rotate all points about an axis passing through the origin. -In order to rotate about a particular point, the point must be translated to origin first. -Once the rotation is performed, the point must be translated back to its original location. -

-

-Thus the matrix for rotating about a particular point <x,y,z> is:
-M = T-1RT
-where T translates the point to origin and R is the rotation matrix. -

-

-Use the New button to add new instance with transformations to perform rotation about a point. -

-
Previous +Rotation
+About a point +
Previous +

+Rotation matrices rotate all points about an axis passing through the origin. +In order to rotate about a particular point, the point must be translated to origin first. +Once the rotation is performed, the point must be translated back to its original location. +

+

+Thus the matrix for rotating about a particular point <x,y,z> is:
+M = T-1RT
+where T translates the point to origin and R is the rotation matrix. +

+

+Use the New button to add new instance with transformations to perform rotation about a point. +

+
Previous diff --git a/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/1.html index 9273bbb50..48b07d34a 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/1.html @@ -1,22 +1,22 @@ -Scaling
-Introduction to the interface -
Next -

-This experiment is designed to teach how the scaling transformation works when applied to traingles and co-ordinate systems. -This experiment is similar to Experiment 3 (Rotation). -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. -Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Scaling
+Introduction to the interface +
Next +

+This experiment is designed to teach how the scaling transformation works when applied to traingles and co-ordinate systems. +This experiment is similar to Experiment 3 (Rotation). +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. +Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/2.html index 84bdd4d1f..e4c04bbc7 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/2.html @@ -1,19 +1,19 @@ -Scaling
-The Set-up -
Previous | Next -

-This experiment starts with a scaling transformation applied to the triangle, which is animated. -

-

-A scaling of Sx=3 is applied along X axis and Sy=2 along Y axis -

- -

-Drag the slider at the bottom to go forwards or backwards in the animation. -

-

-The scaling about each axis are editable. Double click on Transformation 1, followed by Scaling to view the details of the transformation applied. -Edit the scale values and notice the effect on the triangle. -Note that scaling about z axis will will be visible only if check the 3D box under Display tab before proceeding. -

-
Previous | Next +Scaling
+The Set-up +
Previous | Next +

+This experiment starts with a scaling transformation applied to the triangle, which is animated. +

+

+A scaling of Sx=3 is applied along X axis and Sy=2 along Y axis +

+ +

+Drag the slider at the bottom to go forwards or backwards in the animation. +

+

+The scaling about each axis are editable. Double click on Transformation 1, followed by Scaling to view the details of the transformation applied. +Edit the scale values and notice the effect on the triangle. +Note that scaling about z axis will will be visible only if check the 3D box under Display tab before proceeding. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/3.html b/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/3.html index d4a3d66b6..c3b7e472b 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/3.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment4/instructions/3.html @@ -1,19 +1,19 @@ -Scaling
-Matrix Product form -
Previous -

-Scaling is performed by multiplying with a Scaling Matrix. -

- - - - - - -
S = Sx000
0Sy00
00Sz0
0001
-
-

-

-The Scaling Matrix is animated (using Sx, Sy, Sz) and can be seen under the Scaling node. -

+Scaling
+Matrix Product form +
Previous +

+Scaling is performed by multiplying with a Scaling Matrix. +

+ + + + + + +
S = Sx000
0Sy00
00Sz0
0001
+
+

+

+The Scaling Matrix is animated (using Sx, Sy, Sz) and can be seen under the Scaling node. +


Previous \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/1.html index b49cc3a04..f58fe84a5 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/1.html @@ -1,21 +1,21 @@ -Hierarchical Transformations
-Introduction to the interface -
Next -

-This experiment is designed to teach how a sequence of transformations work when applied to a geometry. -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. -Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Hierarchical Transformations
+Introduction to the interface +
Next +

+This experiment is designed to teach how a sequence of transformations work when applied to a geometry. +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. +Transformation is the set of transformations applied to the shape or instance wrt local coordinate system. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/2.html index 913936b34..d1a90710a 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/2.html @@ -1,20 +1,20 @@ -Hierarchical Transformations
-2D Demo -
Previous | Next -

-This experiment shows the effect of a series of transformations applied on a triangle. -

-

-We start with a scaling transformation applied to the triangle followed by a translation, rotation and another translation. -All these transformations are animated. -

- -

-Drag the slider at the bottom to go forwards or backwards in the animation. -

-

-The order of transformations can be edited from the transformation edit panel. New transformations could be added as well as edited. -Double click on Transformation 1, followed by the corresponding transformation to view the details of the transformation applied. -Note that transformations about z axis will be visible only if you check the 3D box under Display tab before proceeding. -

-
Previous | Next +Hierarchical Transformations
+2D Demo +
Previous | Next +

+This experiment shows the effect of a series of transformations applied on a triangle. +

+

+We start with a scaling transformation applied to the triangle followed by a translation, rotation and another translation. +All these transformations are animated. +

+ +

+Drag the slider at the bottom to go forwards or backwards in the animation. +

+

+The order of transformations can be edited from the transformation edit panel. New transformations could be added as well as edited. +Double click on Transformation 1, followed by the corresponding transformation to view the details of the transformation applied. +Note that transformations about z axis will be visible only if you check the 3D box under Display tab before proceeding. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/3.html b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/3.html index 4ba4dee55..18816693f 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/3.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/3.html @@ -1,18 +1,18 @@ -Hierarchical Transformations
-2D Demo : Order of Trasnformations -
Previous | Next -

-The order of transformations is always important to acheive the proper transformation. A translation followed by rotation is not the same as rotation followed by translation. Similarly, scaling followed by translation is not the same as translation followed by scaling. However, rotation and scaling can be used in any order resulting in the same transformation. -

-

-This experiment shows a scaling transformation applied to the triangle followed by a translation, rotation and another translation. -All these transformations are animated. -

- -

-Select Transformation 1 and click Edit button to open the transformation edit panel. -The order of transformations can be edited from this transformation edit panel. New transformations could be added as well as edited. -Select a tranformation and Use the up and down arrowed buttons to change the order of the transformation. -Note that transformations about z axis will be visible only if you check the 3D box under Display tab before proceeding. -

-
Previous | Next +Hierarchical Transformations
+2D Demo : Order of Trasnformations +
Previous | Next +

+The order of transformations is always important to acheive the proper transformation. A translation followed by rotation is not the same as rotation followed by translation. Similarly, scaling followed by translation is not the same as translation followed by scaling. However, rotation and scaling can be used in any order resulting in the same transformation. +

+

+This experiment shows a scaling transformation applied to the triangle followed by a translation, rotation and another translation. +All these transformations are animated. +

+ +

+Select Transformation 1 and click Edit button to open the transformation edit panel. +The order of transformations can be edited from this transformation edit panel. New transformations could be added as well as edited. +Select a tranformation and Use the up and down arrowed buttons to change the order of the transformation. +Note that transformations about z axis will be visible only if you check the 3D box under Display tab before proceeding. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/4.html b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/4.html index 921d3dfd0..25fdb5644 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/4.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment5a/instructions/4.html @@ -1,23 +1,23 @@ -Hierarchical Transformations
-2D Demo : Adding more Trasnformations -
Previous -

-More transformations can be added, edited or deleted for the current instance. The order of these transformations determines the final transformation of the instance. -

-

-Select Transformation 1 and click Edit button to open the transformation edit panel. -Transformations can be added, edited, deleted and ordered here. -To Add a new transformation click Add to open the add transformation panel. -Select the respective transformation to be applied and provide the required parameters. Set the Duration value to the number of frames over which this transformation is animated. Click OK to add this transformation to the list. -A Custom transformation can be applied by specifying a custom tranformation matrix in the fields provided. -Set the Starting Frame to the specify the frame from which these transformations are applied. -

- -

-Select a transformation and use Edit to edit an existing transformation and Delete to delete one. -Select a tranformation and Use the up and down arrowed buttons to change the order of the transformation. -Click Done to apply the transformations or close this panel to cancel the changes. - -Note that transformations about z axis will be visible only if you check the 3D box under Display tab before proceeding. -

-
Previous +Hierarchical Transformations
+2D Demo : Adding more Trasnformations +
Previous +

+More transformations can be added, edited or deleted for the current instance. The order of these transformations determines the final transformation of the instance. +

+

+Select Transformation 1 and click Edit button to open the transformation edit panel. +Transformations can be added, edited, deleted and ordered here. +To Add a new transformation click Add to open the add transformation panel. +Select the respective transformation to be applied and provide the required parameters. Set the Duration value to the number of frames over which this transformation is animated. Click OK to add this transformation to the list. +A Custom transformation can be applied by specifying a custom tranformation matrix in the fields provided. +Set the Starting Frame to the specify the frame from which these transformations are applied. +

+ +

+Select a transformation and use Edit to edit an existing transformation and Delete to delete one. +Select a tranformation and Use the up and down arrowed buttons to change the order of the transformation. +Click Done to apply the transformations or close this panel to cancel the changes. + +Note that transformations about z axis will be visible only if you check the 3D box under Display tab before proceeding. +

+
Previous diff --git a/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/1.html index bcb0e6bc9..1f1be23ec 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/1.html @@ -1,21 +1,21 @@ -Hierarchical Transformations
-The Set-up: Articulated Arm -
Next -

-This experiment is designed to teach a hierarchical transformation model. -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. Multiple shapes and child instances can be added where the child instance is again a node. -Transformation is the set of transformations applied to the shape or instance w.r.t the local coordinate system. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Hierarchical Transformations
+The Set-up: Articulated Arm +
Next +

+This experiment is designed to teach a hierarchical transformation model. +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. Multiple shapes and child instances can be added where the child instance is again a node. +Transformation is the set of transformations applied to the shape or instance w.r.t the local coordinate system. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/2.html index ea9affb6d..f61b2612f 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment5b/instructions/2.html @@ -1,22 +1,22 @@ -Hierarchical Transformations
-The Set-up: Articulated Arm -
Previous -

-This experiment shows the effect of transformations in a hierarchical model. -

-

-We constructed a hierarchical articulated arm model where each node/part follows a series of transformations from the root node to its current position. The top-most object in this hierarchy is the Shoulder followed by Elbow, Forearm, Wrist and Palm. -

-

-We applied a rotation transformation to the wrist where only the wrist and palm moves. The coordinate system of the wrist is set at (6,0,0) wrt the elbow's frame of reference. -This is followed by a rotation applied to elbow which moves the forearm, wrist and palm. The coordinate system of the elbow is set at (1,-4,0) wrt the shoulder's frame of reference. -And finally a rotation at the shoulder which is at the top-most level of the hierarchy moves all nodes/parts. The coordinate system of the shoulder is coincided with the Global fixed coordinate system by setting the origin at (0,0,0) -Each node in this heirarchical model has a Shape and a child node. -

-

-Drag the slider at the bottom to go forwards or backwards in the animation. -

-

-The transformations at each level of hierarchy can be edited by double clicking on the Transformation node of the corresponding level. -

-
Previous +Hierarchical Transformations
+The Set-up: Articulated Arm +
Previous +

+This experiment shows the effect of transformations in a hierarchical model. +

+

+We constructed a hierarchical articulated arm model where each node/part follows a series of transformations from the root node to its current position. The top-most object in this hierarchy is the Shoulder followed by Elbow, Forearm, Wrist and Palm. +

+

+We applied a rotation transformation to the wrist where only the wrist and palm moves. The coordinate system of the wrist is set at (6,0,0) wrt the elbow's frame of reference. +This is followed by a rotation applied to elbow which moves the forearm, wrist and palm. The coordinate system of the elbow is set at (1,-4,0) wrt the shoulder's frame of reference. +And finally a rotation at the shoulder which is at the top-most level of the hierarchy moves all nodes/parts. The coordinate system of the shoulder is coincided with the Global fixed coordinate system by setting the origin at (0,0,0) +Each node in this heirarchical model has a Shape and a child node. +

+

+Drag the slider at the bottom to go forwards or backwards in the animation. +

+

+The transformations at each level of hierarchy can be edited by double clicking on the Transformation node of the corresponding level. +

+
Previous diff --git a/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/1.html b/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/1.html index 7e935ea8f..15c4b9bb5 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/1.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/1.html @@ -1,28 +1,28 @@ -Projections and Cameras
-The Set-up: Bunny through a Camera -
Next -

-This experiment is designed to teach the orthographic and perspective projections using cameras and a bunny. -

-

-The world represented as a tree is shown below. -Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. -Coordinate system is the local coordinate system of the instance. -Shape/Instance is the geometry or a child instance of the cuurent instance. Multiple shapes and child instances can be added where the child instance is again a node. -Transformation is the set of transformations applied to the shape or instance w.r.t the local coordinate system. -

-

-A Camera node is similar to an instance. -It has a Coordinate system which is a local coordinate system coordinate system wrt the Global fixed coordinate system. The camera is always placed at the origin of this Coordinate system looking towards -ve Z-axis. -The Transformation section is the same as the other nodes. -Camera node doesnt have a Shape/Instance section and hence no children can be added. -The rest of the parameters define the camera. -

-

-All the values being shown can be edited by clicking on them. -Any changes to the tree are reflected on the display and vice-versa. -

-

-These instructions are in a series of steps. Use the Next and Previous buttons to navigate. -

-
Next +Projections and Cameras
+The Set-up: Bunny through a Camera +
Next +

+This experiment is designed to teach the orthographic and perspective projections using cameras and a bunny. +

+

+The world represented as a tree is shown below. +Each node is an instance. Each instance has 3 sections: Coodinate system, shape/instance, Transformation. +Coordinate system is the local coordinate system of the instance. +Shape/Instance is the geometry or a child instance of the cuurent instance. Multiple shapes and child instances can be added where the child instance is again a node. +Transformation is the set of transformations applied to the shape or instance w.r.t the local coordinate system. +

+

+A Camera node is similar to an instance. +It has a Coordinate system which is a local coordinate system coordinate system wrt the Global fixed coordinate system. The camera is always placed at the origin of this Coordinate system looking towards -ve Z-axis. +The Transformation section is the same as the other nodes. +Camera node doesnt have a Shape/Instance section and hence no children can be added. +The rest of the parameters define the camera. +

+

+All the values being shown can be edited by clicking on them. +Any changes to the tree are reflected on the display and vice-versa. +

+

+These instructions are in a series of steps. Use the Next and Previous buttons to navigate. +

+
Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/2.html b/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/2.html index bd6e0b920..7015ca64f 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/2.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/2.html @@ -1,16 +1,16 @@ -Projections and Cameras
-The Set-up: Bunny through a Camera -
Previous | Next -

-A bunny model and a perspective camera are preloaded into this experiment. -

-

-A series of transformations are applied to the bunny model which are animated over a period of time. -

-

-Similarly a rotation transformation has been applied for the camera that is animated. -

-

-Drag the slider at the bottom to go forwards or backwards in the animation. -

-
Previous | Next +Projections and Cameras
+The Set-up: Bunny through a Camera +
Previous | Next +

+A bunny model and a perspective camera are preloaded into this experiment. +

+

+A series of transformations are applied to the bunny model which are animated over a period of time. +

+

+Similarly a rotation transformation has been applied for the camera that is animated. +

+

+Drag the slider at the bottom to go forwards or backwards in the animation. +

+
Previous | Next diff --git a/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/3.html b/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/3.html index 97200d179..f2f19c9db 100644 --- a/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/3.html +++ b/src/lab/VirtualLabGraphics/experiments/experiment6/instructions/3.html @@ -1,24 +1,24 @@ -Projections and Cameras
-The Set-up: Bunny through a Camera -
Previous -

-The camera view, which in this case is a perspective view, is shown in the popup window. -This window can be toggled using the Show View checkbox in the corresponding camera node. -

-

-The parameters for the camera define the clipping planes for the view. These define the left, right, bottom, top, near and far clipping planes. -

-

-The type of camera (orthographic/perspective) can be changed in the camera properties. -

-

-The Switch Axis to Camera button aligns the coordinate system of the editing space to the cameras coordinate system. The Switch to Global Coordinate System button reverts to the default coordinate system alignment. -

-

-Cameras can be added using New Cam button at the bottom. Cameras are always added at the highest level of the hierarchy. -

-

-Edit the camera type and other parameters and notice the how the camera view changes. -Drag the slider at the bottom to go forwards or backwards in the animation. -

-
Previous +Projections and Cameras
+The Set-up: Bunny through a Camera +
Previous +

+The camera view, which in this case is a perspective view, is shown in the popup window. +This window can be toggled using the Show View checkbox in the corresponding camera node. +

+

+The parameters for the camera define the clipping planes for the view. These define the left, right, bottom, top, near and far clipping planes. +

+

+The type of camera (orthographic/perspective) can be changed in the camera properties. +

+

+The Switch Axis to Camera button aligns the coordinate system of the editing space to the cameras coordinate system. The Switch to Global Coordinate System button reverts to the default coordinate system alignment. +

+

+Cameras can be added using New Cam button at the bottom. Cameras are always added at the highest level of the hierarchy. +

+

+Edit the camera type and other parameters and notice the how the camera view changes. +Drag the slider at the bottom to go forwards or backwards in the animation. +

+
Previous diff --git a/src/lab/VirtualLabGraphics/ply/dodecahedron.ply b/src/lab/VirtualLabGraphics/ply/dodecahedron.ply index 525065fdb..889f4ee48 100644 --- a/src/lab/VirtualLabGraphics/ply/dodecahedron.ply +++ b/src/lab/VirtualLabGraphics/ply/dodecahedron.ply @@ -1,42 +1,42 @@ -ply -format ascii 1.0 -comment created by platoply -element vertex 20 -property float32 x -property float32 y -property float32 z -element face 12 -property list uint8 int32 vertex_indices -end_header --0.57735 -0.57735 0.57735 -0.934172 0.356822 0 -0.934172 -0.356822 0 --0.934172 0.356822 0 --0.934172 -0.356822 0 -0 0.934172 0.356822 -0 0.934172 -0.356822 -0.356822 0 -0.934172 --0.356822 0 -0.934172 -0 -0.934172 -0.356822 -0 -0.934172 0.356822 -0.356822 0 0.934172 --0.356822 0 0.934172 -0.57735 0.57735 -0.57735 -0.57735 0.57735 0.57735 --0.57735 0.57735 -0.57735 --0.57735 0.57735 0.57735 -0.57735 -0.57735 -0.57735 -0.57735 -0.57735 0.57735 --0.57735 -0.57735 -0.57735 -5 1 2 18 11 14 -5 1 13 7 17 2 -5 3 4 19 8 15 -5 3 16 12 0 4 -5 3 15 6 5 16 -5 1 14 5 6 13 -5 2 17 9 10 18 -5 4 0 10 9 19 -5 7 8 19 9 17 -5 6 15 8 7 13 -5 5 14 11 12 16 +ply +format ascii 1.0 +comment created by platoply +element vertex 20 +property float32 x +property float32 y +property float32 z +element face 12 +property list uint8 int32 vertex_indices +end_header +-0.57735 -0.57735 0.57735 +0.934172 0.356822 0 +0.934172 -0.356822 0 +-0.934172 0.356822 0 +-0.934172 -0.356822 0 +0 0.934172 0.356822 +0 0.934172 -0.356822 +0.356822 0 -0.934172 +-0.356822 0 -0.934172 +0 -0.934172 -0.356822 +0 -0.934172 0.356822 +0.356822 0 0.934172 +-0.356822 0 0.934172 +0.57735 0.57735 -0.57735 +0.57735 0.57735 0.57735 +-0.57735 0.57735 -0.57735 +-0.57735 0.57735 0.57735 +0.57735 -0.57735 -0.57735 +0.57735 -0.57735 0.57735 +-0.57735 -0.57735 -0.57735 +5 1 2 18 11 14 +5 1 13 7 17 2 +5 3 4 19 8 15 +5 3 16 12 0 4 +5 3 15 6 5 16 +5 1 14 5 6 13 +5 2 17 9 10 18 +5 4 0 10 9 19 +5 7 8 19 9 17 +5 6 15 8 7 13 +5 5 14 11 12 16 5 10 0 12 11 18 \ No newline at end of file diff --git a/src/lab/VirtualLabGraphics/ply/icosahedron.ply b/src/lab/VirtualLabGraphics/ply/icosahedron.ply index 310a4e8a6..3ece72c93 100644 --- a/src/lab/VirtualLabGraphics/ply/icosahedron.ply +++ b/src/lab/VirtualLabGraphics/ply/icosahedron.ply @@ -1,42 +1,42 @@ -ply -format ascii 1.0 -comment created by platoply -element vertex 12 -property float32 x -property float32 y -property float32 z -element face 20 -property list uint8 int32 vertex_indices -end_header -0 -0.525731 0.850651 -0.850651 0 0.525731 -0.850651 0 -0.525731 --0.850651 0 -0.525731 --0.850651 0 0.525731 --0.525731 0.850651 0 -0.525731 0.850651 0 -0.525731 -0.850651 0 --0.525731 -0.850651 0 -0 -0.525731 -0.850651 -0 0.525731 -0.850651 -0 0.525731 0.850651 -3 6 2 1 -3 2 7 1 -3 5 4 3 -3 8 3 4 -3 11 5 6 -3 10 6 5 -3 2 10 9 -3 3 9 10 -3 9 8 7 -3 0 7 8 -3 1 0 11 -3 4 11 0 -3 10 2 6 -3 11 6 1 -3 10 5 3 -3 11 4 5 -3 9 7 2 -3 0 1 7 -3 8 9 3 +ply +format ascii 1.0 +comment created by platoply +element vertex 12 +property float32 x +property float32 y +property float32 z +element face 20 +property list uint8 int32 vertex_indices +end_header +0 -0.525731 0.850651 +0.850651 0 0.525731 +0.850651 0 -0.525731 +-0.850651 0 -0.525731 +-0.850651 0 0.525731 +-0.525731 0.850651 0 +0.525731 0.850651 0 +0.525731 -0.850651 0 +-0.525731 -0.850651 0 +0 -0.525731 -0.850651 +0 0.525731 -0.850651 +0 0.525731 0.850651 +3 6 2 1 +3 2 7 1 +3 5 4 3 +3 8 3 4 +3 11 5 6 +3 10 6 5 +3 2 10 9 +3 3 9 10 +3 9 8 7 +3 0 7 8 +3 1 0 11 +3 4 11 0 +3 10 2 6 +3 11 6 1 +3 10 5 3 +3 11 4 5 +3 9 7 2 +3 0 1 7 +3 8 9 3 3 0 8 4 \ No newline at end of file diff --git a/src/lab/Vlabs.jar b/src/lab/Vlabs.jar old mode 100755 new mode 100644 diff --git a/src/lab/Vlabs/META-INF/MANIFEST.MF b/src/lab/Vlabs/META-INF/MANIFEST.MF index 58630c02e..59499bce4 100644 --- a/src/lab/Vlabs/META-INF/MANIFEST.MF +++ b/src/lab/Vlabs/META-INF/MANIFEST.MF @@ -1,2 +1,2 @@ -Manifest-Version: 1.0 - +Manifest-Version: 1.0 + diff --git a/src/lab/analyticstracking.php b/src/lab/analyticstracking.php old mode 100755 new mode 100644 diff --git a/src/lab/connecttodata.php b/src/lab/connecttodata.php old mode 100755 new mode 100644 diff --git a/src/lab/content.html b/src/lab/content.html old mode 100755 new mode 100644 diff --git a/src/lab/counter.php b/src/lab/counter.php old mode 100755 new mode 100644 diff --git a/src/lab/countlog.txt b/src/lab/countlog.txt old mode 100755 new mode 100644 diff --git a/src/lab/countlog.txt~ b/src/lab/countlog.txt~ old mode 100755 new mode 100644 diff --git a/src/lab/courses_aligned.html b/src/lab/courses_aligned.html old mode 100755 new mode 100644 diff --git a/src/lab/data.txt b/src/lab/data.txt old mode 100755 new mode 100644 diff --git a/src/lab/default.html b/src/lab/default.html old mode 100755 new mode 100644 diff --git a/src/lab/exp/content.html b/src/lab/exp/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp/content.html~ b/src/lab/exp/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp/index.html.bak b/src/lab/exp/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp/index.php b/src/lab/exp/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp/index.php +++ b/src/lab/exp/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp1/Experiment1.java b/src/lab/exp1/Experiment1.java index 3893585cd..5da738548 100644 --- a/src/lab/exp1/Experiment1.java +++ b/src/lab/exp1/Experiment1.java @@ -1,59 +1,59 @@ -package experiments.experiment1; - -import java.awt.Container; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; - -import engine.CoordSystem; -import engine.Shape; -import engine.Transformation; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment1 extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment1/instructions/1.html"); - } - - public Experiment1() { - world = new World(); - - world.display.is3D = false; - world.display.transformCoordSystems = false; - lockVertices = false; - - // Load PLY files - try { - world.addMesh("ply"+File.separator+"cube.ply"); - world.addMesh("ply"+File.separator+"dodecahedron.ply"); - world.addMesh("ply"+File.separator+"icosahedron.ply"); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - Shape s1 = world.addPoint(new Vector(5, 5, 3)); - CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(-1, -1, 0)); - Transformation t1 = world.addTransformation(0); - world.associate(s1, c1, t1, true, true); - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment1()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 1"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment1; + +import java.awt.Container; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; + +import engine.CoordSystem; +import engine.Shape; +import engine.Transformation; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment1 extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment1/instructions/1.html"); + } + + public Experiment1() { + world = new World(); + + world.display.is3D = false; + world.display.transformCoordSystems = false; + lockVertices = false; + + // Load PLY files + try { + world.addMesh("ply"+File.separator+"cube.ply"); + world.addMesh("ply"+File.separator+"dodecahedron.ply"); + world.addMesh("ply"+File.separator+"icosahedron.ply"); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + Shape s1 = world.addPoint(new Vector(5, 5, 3)); + CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(-1, -1, 0)); + Transformation t1 = world.addTransformation(0); + world.associate(s1, c1, t1, true, true); + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment1()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 1"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp1/content.html b/src/lab/exp1/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp1/content.html~ b/src/lab/exp1/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp1/index.html.bak b/src/lab/exp1/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp1/index.php b/src/lab/exp1/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp1/index.php +++ b/src/lab/exp1/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp10/content.html~ b/src/lab/exp10/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp10/index.php b/src/lab/exp10/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp10/index.php +++ b/src/lab/exp10/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp2/Experiment2.java b/src/lab/exp2/Experiment2.java index d702adceb..3c361d209 100644 --- a/src/lab/exp2/Experiment2.java +++ b/src/lab/exp2/Experiment2.java @@ -1,61 +1,61 @@ -package experiments.experiment2; - -import java.awt.Container; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; - -import engine.CoordSystem; -import engine.Mesh; -import engine.Transformation; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment2 extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment2/instructions/1.html"); - } - - public Experiment2() { - world = new World(); - - // Load PLY files - try { - world.addMesh("ply"+File.separator+"cube.ply"); - world.addMesh("ply"+File.separator+"dodecahedron.ply"); - world.addMesh("ply"+File.separator+"icosahedron.ply"); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - world.display.is3D = false; - world.display.transformCoordSystems = false; - lockVertices = true; - - Mesh s1 = world.addPoint(new Vector(5, 5, 3)); - CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); - Transformation t1 = world.addTransformation(0); - t1.translate(3, 2, 0, 1000); - world.associate(s1, c1, t1, false, true); - s1.startTracking(0); - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment2()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 2"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment2; + +import java.awt.Container; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; + +import engine.CoordSystem; +import engine.Mesh; +import engine.Transformation; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment2 extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment2/instructions/1.html"); + } + + public Experiment2() { + world = new World(); + + // Load PLY files + try { + world.addMesh("ply"+File.separator+"cube.ply"); + world.addMesh("ply"+File.separator+"dodecahedron.ply"); + world.addMesh("ply"+File.separator+"icosahedron.ply"); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + world.display.is3D = false; + world.display.transformCoordSystems = false; + lockVertices = true; + + Mesh s1 = world.addPoint(new Vector(5, 5, 3)); + CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); + Transformation t1 = world.addTransformation(0); + t1.translate(3, 2, 0, 1000); + world.associate(s1, c1, t1, false, true); + s1.startTracking(0); + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment2()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 2"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp2/content.html b/src/lab/exp2/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp2/content.html~ b/src/lab/exp2/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp2/index.html.bak b/src/lab/exp2/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp2/index.php b/src/lab/exp2/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp2/index.php +++ b/src/lab/exp2/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp3/Experiment3.java b/src/lab/exp3/Experiment3.java index 559022b28..020cf4894 100644 --- a/src/lab/exp3/Experiment3.java +++ b/src/lab/exp3/Experiment3.java @@ -1,64 +1,64 @@ -package experiments.experiment3; - -import java.awt.Container; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; - -import engine.CoordSystem; -import engine.Instance; -import engine.Mesh; -import engine.Transformation; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment3 extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment3/instructions/1.html"); - } - - public Experiment3() { - world = new World(); - - // Load PLY files - try { - world.addMesh("ply"+File.separator+"cube.ply"); - world.addMesh("ply"+File.separator+"dodecahedron.ply"); - world.addMesh("ply"+File.separator+"icosahedron.ply"); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - world.display.is3D = false; - world.display.transformCoordSystems = false; - lockVertices = true; - - Mesh s1 = world.addPoint(new Vector(5, 5, 3)); - CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); - Transformation t1 = world.addTransformation(0); - t1.rotateZ(180, 2000); - Instance si1 = world.associate(s1, c1, t1, true, true); - s1.startTracking(0); - - si1.isActive = false; - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment3()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 3"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment3; + +import java.awt.Container; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; + +import engine.CoordSystem; +import engine.Instance; +import engine.Mesh; +import engine.Transformation; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment3 extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment3/instructions/1.html"); + } + + public Experiment3() { + world = new World(); + + // Load PLY files + try { + world.addMesh("ply"+File.separator+"cube.ply"); + world.addMesh("ply"+File.separator+"dodecahedron.ply"); + world.addMesh("ply"+File.separator+"icosahedron.ply"); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + world.display.is3D = false; + world.display.transformCoordSystems = false; + lockVertices = true; + + Mesh s1 = world.addPoint(new Vector(5, 5, 3)); + CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); + Transformation t1 = world.addTransformation(0); + t1.rotateZ(180, 2000); + Instance si1 = world.associate(s1, c1, t1, true, true); + s1.startTracking(0); + + si1.isActive = false; + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment3()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 3"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp3/content.html b/src/lab/exp3/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp3/content.html~ b/src/lab/exp3/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp3/index.html.bak b/src/lab/exp3/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp3/index.php b/src/lab/exp3/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp3/index.php +++ b/src/lab/exp3/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp4/Experiment4.java b/src/lab/exp4/Experiment4.java index f98a829d6..899e1b034 100644 --- a/src/lab/exp4/Experiment4.java +++ b/src/lab/exp4/Experiment4.java @@ -1,86 +1,86 @@ -package experiments.experiment4; - -import java.awt.Container; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; - -import engine.CoordSystem; -import engine.Instance; -import engine.Mesh; -import engine.Transformation; -import engine.Triangle; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment4 extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment4/instructions/1.html"); - } - - public Experiment4() { - world = new World(); - - world.display.is3D = false; - world.display.transformCoordSystems = false; - lockVertices = true; - - // Load PLY files - try { - world.addMesh("ply" + File.separator + "cube.ply"); - world.addMesh("ply" + File.separator + "dodecahedron.ply"); - world.addMesh("ply" + File.separator + "icosahedron.ply"); - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - Vector points[] = { new Vector(2, 1, 0), new Vector(4, 3, 0), new Vector(0, 4, 0) }; - Triangle triangles[] = { new Triangle(0, 1, 2) }; - Mesh s1 = world.addMesh(points, triangles); - -/* Vector points2[] = { new Vector(2, 1, 3), new Vector(4, 3, 3), new Vector(0, 4, 3) }; - Triangle triangles2[] = { new Triangle(0, 1, 2) }; - Mesh s2 = world.addMesh(points2, triangles2); - - Vector points3[] = { new Vector(2, 1, -3), new Vector(4, 3, -3), new Vector(0, 4, -3) }; - Triangle triangles3[] = { new Triangle(0, 1, 2) }; - Mesh s3 = world.addMesh(points3, triangles3); -*/ - CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); - Transformation t1 = world.addTransformation(0); -// t1.translate(points[0].x, points[0].y, points[0].z, 1000); -// t1.rotateZ(180, 1000); -// t1.translate(-points[0].x, -points[0].y, -points[0].z, 1000); - t1.scale(3, 2, 1, 2000); - Instance si1 = world.associate(s1, c1, t1, true, true); - s1.startTracking(0); - -/* Instance si2 = world.associate(s2, c1, t1, true, true); - Instance si3 = world.associate(s3, c1, t1, true, true); - si2.isActive = false; - si3.isActive = false; -*/ - - si1.isActive = false; - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment4()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 4"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment4; + +import java.awt.Container; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; + +import engine.CoordSystem; +import engine.Instance; +import engine.Mesh; +import engine.Transformation; +import engine.Triangle; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment4 extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment4/instructions/1.html"); + } + + public Experiment4() { + world = new World(); + + world.display.is3D = false; + world.display.transformCoordSystems = false; + lockVertices = true; + + // Load PLY files + try { + world.addMesh("ply" + File.separator + "cube.ply"); + world.addMesh("ply" + File.separator + "dodecahedron.ply"); + world.addMesh("ply" + File.separator + "icosahedron.ply"); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + Vector points[] = { new Vector(2, 1, 0), new Vector(4, 3, 0), new Vector(0, 4, 0) }; + Triangle triangles[] = { new Triangle(0, 1, 2) }; + Mesh s1 = world.addMesh(points, triangles); + +/* Vector points2[] = { new Vector(2, 1, 3), new Vector(4, 3, 3), new Vector(0, 4, 3) }; + Triangle triangles2[] = { new Triangle(0, 1, 2) }; + Mesh s2 = world.addMesh(points2, triangles2); + + Vector points3[] = { new Vector(2, 1, -3), new Vector(4, 3, -3), new Vector(0, 4, -3) }; + Triangle triangles3[] = { new Triangle(0, 1, 2) }; + Mesh s3 = world.addMesh(points3, triangles3); +*/ + CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); + Transformation t1 = world.addTransformation(0); +// t1.translate(points[0].x, points[0].y, points[0].z, 1000); +// t1.rotateZ(180, 1000); +// t1.translate(-points[0].x, -points[0].y, -points[0].z, 1000); + t1.scale(3, 2, 1, 2000); + Instance si1 = world.associate(s1, c1, t1, true, true); + s1.startTracking(0); + +/* Instance si2 = world.associate(s2, c1, t1, true, true); + Instance si3 = world.associate(s3, c1, t1, true, true); + si2.isActive = false; + si3.isActive = false; +*/ + + si1.isActive = false; + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment4()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 4"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp4/content.html b/src/lab/exp4/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp4/content.html~ b/src/lab/exp4/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp4/index.html.bak b/src/lab/exp4/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp4/index.php b/src/lab/exp4/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp4/index.php +++ b/src/lab/exp4/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp5a/Experiment.html b/src/lab/exp5a/Experiment.html index 90b9b89d0..04bf6d617 100644 --- a/src/lab/exp5a/Experiment.html +++ b/src/lab/exp5a/Experiment.html @@ -40,7 +40,7 @@ - + @@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

Follow us

- +
diff --git a/src/lab/exp5a/Experiment5a.java b/src/lab/exp5a/Experiment5a.java index a87fddd9e..6b6da36a1 100644 --- a/src/lab/exp5a/Experiment5a.java +++ b/src/lab/exp5a/Experiment5a.java @@ -1,72 +1,72 @@ -package experiments.experiment5a; - -import java.awt.Container; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; - -import engine.CoordSystem; -import engine.Instance; -import engine.Mesh; -import engine.Transformation; -import engine.Triangle; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment5a extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment5a/instructions/1.html"); - } - - public Experiment5a() { - world = new World(); - - // Load PLY files - try { - world.addMesh("ply" + File.separator + "cube.ply"); - world.addMesh("ply" + File.separator + "dodecahedron.ply"); - world.addMesh("ply" + File.separator + "icosahedron.ply"); - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - world.display.is3D = false; - world.display.transformCoordSystems = false; - lockVertices = true; - - Vector points[] = { new Vector(2, 1, 0), new Vector(4, 3, 0), new Vector(0, 4, 0) }; - Triangle triangles[] = { new Triangle(0, 1, 2) }; - Mesh s1 = world.addMesh(points, triangles); - - CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); - Transformation t1 = world.addTransformation(0); - t1.translate(points[0].x, points[0].y, points[0].z, 1000); - t1.rotateZ(180, 1000); - t1.translate(-points[0].x, -points[0].y, -points[0].z, 1000); - t1.scale(3, 2, 1, 1000); - Instance si1 = world.associate(s1, c1, t1, true, true); - s1.startTracking(0); - - si1.isActive = false; - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment5a()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 5a"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment5a; + +import java.awt.Container; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; + +import engine.CoordSystem; +import engine.Instance; +import engine.Mesh; +import engine.Transformation; +import engine.Triangle; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment5a extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment5a/instructions/1.html"); + } + + public Experiment5a() { + world = new World(); + + // Load PLY files + try { + world.addMesh("ply" + File.separator + "cube.ply"); + world.addMesh("ply" + File.separator + "dodecahedron.ply"); + world.addMesh("ply" + File.separator + "icosahedron.ply"); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + world.display.is3D = false; + world.display.transformCoordSystems = false; + lockVertices = true; + + Vector points[] = { new Vector(2, 1, 0), new Vector(4, 3, 0), new Vector(0, 4, 0) }; + Triangle triangles[] = { new Triangle(0, 1, 2) }; + Mesh s1 = world.addMesh(points, triangles); + + CoordSystem c1 = world.addCoordSystem(new Vector(1, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 0)); + Transformation t1 = world.addTransformation(0); + t1.translate(points[0].x, points[0].y, points[0].z, 1000); + t1.rotateZ(180, 1000); + t1.translate(-points[0].x, -points[0].y, -points[0].z, 1000); + t1.scale(3, 2, 1, 1000); + Instance si1 = world.associate(s1, c1, t1, true, true); + s1.startTracking(0); + + si1.isActive = false; + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment5a()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 5a"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp5a/Introduction.html b/src/lab/exp5a/Introduction.html index 22dfe4828..507d024c5 100644 --- a/src/lab/exp5a/Introduction.html +++ b/src/lab/exp5a/Introduction.html @@ -40,7 +40,7 @@ - +
@@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

Follow us

- +
diff --git a/src/lab/exp5a/Manual.html b/src/lab/exp5a/Manual.html index 6ddb3a098..e0837322c 100644 --- a/src/lab/exp5a/Manual.html +++ b/src/lab/exp5a/Manual.html @@ -40,7 +40,7 @@ - +
@@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

-

Follow us

+
diff --git a/src/lab/exp5a/Objective.html b/src/lab/exp5a/Objective.html index adea9aa12..e2ada9f35 100644 --- a/src/lab/exp5a/Objective.html +++ b/src/lab/exp5a/Objective.html @@ -40,7 +40,7 @@ - +
@@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

-

Follow us

+
diff --git a/src/lab/exp5a/Procedure.html b/src/lab/exp5a/Procedure.html index a8a43938d..3b71a99dd 100644 --- a/src/lab/exp5a/Procedure.html +++ b/src/lab/exp5a/Procedure.html @@ -40,7 +40,7 @@ - +
@@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

-

Follow us

+
diff --git a/src/lab/exp5a/Quizzes.html b/src/lab/exp5a/Quizzes.html index d692da2d1..78b3286de 100644 --- a/src/lab/exp5a/Quizzes.html +++ b/src/lab/exp5a/Quizzes.html @@ -40,7 +40,7 @@ - +
@@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

-

Follow us

+
diff --git a/src/lab/exp5a/Theory.html b/src/lab/exp5a/Theory.html index 883083788..d909d9483 100644 --- a/src/lab/exp5a/Theory.html +++ b/src/lab/exp5a/Theory.html @@ -40,7 +40,7 @@ - +
@@ -56,7 +56,7 @@ --> @@ -88,7 +88,7 @@
-

Computer Science & EngineeringComputer Graphics →List Of Experiments

+

Computer Science & EngineeringComputer Graphics →List Of Experiments

-

Follow us

+
diff --git a/src/lab/exp5a/content.html b/src/lab/exp5a/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp5a/content.html~ b/src/lab/exp5a/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp5a/index.html.bak b/src/lab/exp5a/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp5a/index.php b/src/lab/exp5a/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp5a/index.php +++ b/src/lab/exp5a/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp5b/Experiment5b.java b/src/lab/exp5b/Experiment5b.java index d77eb1fd6..121d68c3f 100644 --- a/src/lab/exp5b/Experiment5b.java +++ b/src/lab/exp5b/Experiment5b.java @@ -1,105 +1,105 @@ -package experiments.experiment5b; - -import java.awt.Container; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; -import javax.swing.JOptionPane; - -import engine.CoordSystem; -import engine.Instance; -import engine.Shape; -import engine.Transformation; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment5b extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment5b/instructions/1.html"); - } - - private CoordSystem defaultCoordSystem(double x, double y, double z) { - CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, Vector.Z, new Vector(x,y,z), 5, true, false); - return c; - } - - private CoordSystem defaultCoordSystem() { - CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, Vector.Z, Vector.O, 5, true, false); - return c; - } - - public Experiment5b() { - world = new World(); - - Shape s; - - try { - /* Load PLY files */ - s = world.addMesh("ply" + File.separator + "cube.ply"); -// world.addMesh("ply" + File.separator + "dodecahedron.ply"); - // world.addMesh("ply" + File.separator + "icosahedron.ply"); - // world.addMesh("ply" + File.separator + "bunny.ply"); - - /* Display configuration */ - world.display.is3D = true; - lockVertices = true; - rotation.x = 35; - rotation.y = -30; - - Transformation t = world.addTransformation(0); - t.scale(2, 0.5, 2, 0); - t.translate(1, 1, 0, 0); - Shape palm = world.associate(s, defaultCoordSystem(), t, false, false, "Palm"); - - t = world.addTransformation(800); - t.rotateZ(45, 400); - Instance wrist = world.associate(palm, defaultCoordSystem(6,0,0), t, true, false, "Wrist"); - - t = world.addTransformation(0); - t.scale(3, 0.5, 0.5, 0); - t.translate(1, 1, 0, 0); - Shape forearm = world.associate(s, defaultCoordSystem(), t, false, false, "Fore-arm"); - - t = world.addTransformation(400); - t.rotateZ(45, 400); - Instance elbow = world.associate(forearm, defaultCoordSystem(1,-4,0), t, false, false, "Elbow"); - elbow.addShape(wrist); - - t = world.addTransformation(0); - t.scale(0.5, 2, 0.5, 0); - t.translate(1, -1, 0, 0); - Shape arm = world.associate(s, defaultCoordSystem(), t, false, false, "Arm"); - - CoordSystem c = defaultCoordSystem(); - c.isDrawn = true; - t = world.addTransformation(0); - t.rotateY(90, 400); - Instance shoulder = world.associate(arm, c, t, true, true, "Shoulder"); - shoulder.addShape(elbow); - } catch (FileNotFoundException e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - "A necessary ply file failed to load. The experiment could not be set up.", "Error", - JOptionPane.ERROR_MESSAGE); - } - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment5b()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 5b"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment5b; + +import java.awt.Container; +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; +import javax.swing.JOptionPane; + +import engine.CoordSystem; +import engine.Instance; +import engine.Shape; +import engine.Transformation; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment5b extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment5b/instructions/1.html"); + } + + private CoordSystem defaultCoordSystem(double x, double y, double z) { + CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, Vector.Z, new Vector(x,y,z), 5, true, false); + return c; + } + + private CoordSystem defaultCoordSystem() { + CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, Vector.Z, Vector.O, 5, true, false); + return c; + } + + public Experiment5b() { + world = new World(); + + Shape s; + + try { + /* Load PLY files */ + s = world.addMesh("ply" + File.separator + "cube.ply"); +// world.addMesh("ply" + File.separator + "dodecahedron.ply"); + // world.addMesh("ply" + File.separator + "icosahedron.ply"); + // world.addMesh("ply" + File.separator + "bunny.ply"); + + /* Display configuration */ + world.display.is3D = true; + lockVertices = true; + rotation.x = 35; + rotation.y = -30; + + Transformation t = world.addTransformation(0); + t.scale(2, 0.5, 2, 0); + t.translate(1, 1, 0, 0); + Shape palm = world.associate(s, defaultCoordSystem(), t, false, false, "Palm"); + + t = world.addTransformation(800); + t.rotateZ(45, 400); + Instance wrist = world.associate(palm, defaultCoordSystem(6,0,0), t, true, false, "Wrist"); + + t = world.addTransformation(0); + t.scale(3, 0.5, 0.5, 0); + t.translate(1, 1, 0, 0); + Shape forearm = world.associate(s, defaultCoordSystem(), t, false, false, "Fore-arm"); + + t = world.addTransformation(400); + t.rotateZ(45, 400); + Instance elbow = world.associate(forearm, defaultCoordSystem(1,-4,0), t, false, false, "Elbow"); + elbow.addShape(wrist); + + t = world.addTransformation(0); + t.scale(0.5, 2, 0.5, 0); + t.translate(1, -1, 0, 0); + Shape arm = world.associate(s, defaultCoordSystem(), t, false, false, "Arm"); + + CoordSystem c = defaultCoordSystem(); + c.isDrawn = true; + t = world.addTransformation(0); + t.rotateY(90, 400); + Instance shoulder = world.associate(arm, c, t, true, true, "Shoulder"); + shoulder.addShape(elbow); + } catch (FileNotFoundException e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + "A necessary ply file failed to load. The experiment could not be set up.", "Error", + JOptionPane.ERROR_MESSAGE); + } + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment5b()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 5b"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp5b/content.html b/src/lab/exp5b/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp5b/content.html~ b/src/lab/exp5b/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp5b/index.html.bak b/src/lab/exp5b/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp5b/index.php b/src/lab/exp5b/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp5b/index.php +++ b/src/lab/exp5b/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp6/Experiment6.java b/src/lab/exp6/Experiment6.java index c14c729c8..ca3f3156c 100644 --- a/src/lab/exp6/Experiment6.java +++ b/src/lab/exp6/Experiment6.java @@ -1,70 +1,70 @@ -package experiments.experiment6; - -import java.awt.Container; -import java.io.FileNotFoundException; -import java.net.URL; - -import javax.swing.JFrame; - -import engine.CoordSystem; -import engine.Instance; -import engine.Mesh; -import engine.Transformation; -import engine.Vector; -import engine.World; -import experiments.Experiment; - -public class Experiment6 extends Experiment { - @Override - protected URL getInstructionsURL() { - return Experiment.class.getResource("experiment6/instructions/1.html"); - } - - public Experiment6() { - world = new World(); - //CoordSystem c = world.addCoordSystem(Vector.Z.negate(), Vector.Y, Vector.X.negate(), new Vector(3, 0, -5)); - //CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, new Vector(0,0,1), Vector.O); - //world.addOrthographicCamera(1, 20, -5, 5, -5, 5, c, t); - - CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, new Vector(5,0,-5)); - Transformation t = world.addTransformation(0); - t.rotateY(90, 5000); - world.addPerspectiveCamera(1, 20, -1, 1, -1, 1, c, t); - - rotation.x = 30; - rotation.y = -30; - world.display.is3D = true; - lockVertices = true; - - try { - Mesh m = world.addMesh("ply/bunny.ply"); - //Mesh m = world.addMesh("ply/cube.ply"); - t = world.addTransformation(0); - //t.rotateY(360, 1000); - //Instance bunny = world.associate(m, world.addCoordSystem(Vector.X.multiply(50), Vector.Y.multiply(50), - Instance bunny = world.associate(m, world.addCoordSystem(Vector.X.multiply(50), Vector.Y.multiply(50), - Vector.Z.multiply(50), new Vector(0, -5, -10)), t, true, false); - - t = world.addTransformation(3000); - t.rotateZ(180, 1000); - world.associate(bunny, world.addCoordSystem(Vector.X, Vector.Y, Vector.O), t, true, true); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - - public static void prepare(Container mainContainer) { - prepare(mainContainer, new Experiment6()); - } - - public static void main(String[] args) { - JFrame frame = new JFrame("Experiment 6"); - frame.setSize(1000, 600); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setLocationRelativeTo(null); - - prepare(frame); - frame.setVisible(true); - start(); - } -} +package experiments.experiment6; + +import java.awt.Container; +import java.io.FileNotFoundException; +import java.net.URL; + +import javax.swing.JFrame; + +import engine.CoordSystem; +import engine.Instance; +import engine.Mesh; +import engine.Transformation; +import engine.Vector; +import engine.World; +import experiments.Experiment; + +public class Experiment6 extends Experiment { + @Override + protected URL getInstructionsURL() { + return Experiment.class.getResource("experiment6/instructions/1.html"); + } + + public Experiment6() { + world = new World(); + //CoordSystem c = world.addCoordSystem(Vector.Z.negate(), Vector.Y, Vector.X.negate(), new Vector(3, 0, -5)); + //CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, new Vector(0,0,1), Vector.O); + //world.addOrthographicCamera(1, 20, -5, 5, -5, 5, c, t); + + CoordSystem c = world.addCoordSystem(Vector.X, Vector.Y, new Vector(5,0,-5)); + Transformation t = world.addTransformation(0); + t.rotateY(90, 5000); + world.addPerspectiveCamera(1, 20, -1, 1, -1, 1, c, t); + + rotation.x = 30; + rotation.y = -30; + world.display.is3D = true; + lockVertices = true; + + try { + Mesh m = world.addMesh("ply/bunny.ply"); + //Mesh m = world.addMesh("ply/cube.ply"); + t = world.addTransformation(0); + //t.rotateY(360, 1000); + //Instance bunny = world.associate(m, world.addCoordSystem(Vector.X.multiply(50), Vector.Y.multiply(50), + Instance bunny = world.associate(m, world.addCoordSystem(Vector.X.multiply(50), Vector.Y.multiply(50), + Vector.Z.multiply(50), new Vector(0, -5, -10)), t, true, false); + + t = world.addTransformation(3000); + t.rotateZ(180, 1000); + world.associate(bunny, world.addCoordSystem(Vector.X, Vector.Y, Vector.O), t, true, true); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + public static void prepare(Container mainContainer) { + prepare(mainContainer, new Experiment6()); + } + + public static void main(String[] args) { + JFrame frame = new JFrame("Experiment 6"); + frame.setSize(1000, 600); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + + prepare(frame); + frame.setVisible(true); + start(); + } +} diff --git a/src/lab/exp6/content.html b/src/lab/exp6/content.html old mode 100755 new mode 100644 diff --git a/src/lab/exp6/content.html~ b/src/lab/exp6/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp6/index.html.bak b/src/lab/exp6/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/exp6/index.php b/src/lab/exp6/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp6/index.php +++ b/src/lab/exp6/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp7/content.html~ b/src/lab/exp7/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp7/index.php b/src/lab/exp7/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp7/index.php +++ b/src/lab/exp7/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp8/content.html~ b/src/lab/exp8/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp8/index.php b/src/lab/exp8/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp8/index.php +++ b/src/lab/exp8/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp9/content.html~ b/src/lab/exp9/content.html~ old mode 100755 new mode 100644 diff --git a/src/lab/exp9/index.php b/src/lab/exp9/index.php index c2ea72f06..b93725fe3 100644 --- a/src/lab/exp9/index.php +++ b/src/lab/exp9/index.php @@ -1,51 +1,51 @@ - -getElementById("experiment-header-heading")->innertext; -$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; - - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; -// echo $section."="; -// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - -} -$data['nav'] = $nav; -//print_r($nav); - - - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "../"; -$lab_url = "../index.php"; -$exp_url = "./index.php"; -$base_url = $exp_url; - -include('../exp_template.php'); - -?> - - - + +getElementById("experiment-header-heading")->innertext; +$labarticleheading =$html->getElementById("experiment-article-heading")->innertext; + + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; +// echo $section."="; +// echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + +} +$data['nav'] = $nav; +//print_r($nav); + + + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "../"; +$lab_url = "../index.php"; +$exp_url = "./index.php"; +$base_url = $exp_url; + +include('../exp_template.php'); + +?> + + + diff --git a/src/lab/exp_nav_template.php b/src/lab/exp_nav_template.php old mode 100755 new mode 100644 diff --git a/src/lab/exp_template.php b/src/lab/exp_template.php old mode 100755 new mode 100644 diff --git a/src/lab/experiments.html b/src/lab/experiments.html old mode 100755 new mode 100644 diff --git a/src/lab/feedback.html b/src/lab/feedback.html old mode 100755 new mode 100644 diff --git a/src/lab/feedback.py b/src/lab/feedback.py old mode 100755 new mode 100644 diff --git a/src/lab/feedback.py~ b/src/lab/feedback.py~ old mode 100755 new mode 100644 diff --git a/src/lab/images/Sitemap.png b/src/lab/images/Sitemap.png old mode 100755 new mode 100644 diff --git a/src/lab/images/introduction.jpg b/src/lab/images/introduction.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/manual.jpg b/src/lab/images/manual.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/objective.jpg b/src/lab/images/objective.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/procedure.jpg b/src/lab/images/procedure.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/quizzes.jpg b/src/lab/images/quizzes.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/readings.jpg b/src/lab/images/readings.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/simulation.jpg b/src/lab/images/simulation.jpg old mode 100755 new mode 100644 diff --git a/src/lab/images/theory.jpg b/src/lab/images/theory.jpg old mode 100755 new mode 100644 diff --git a/src/lab/index.html b/src/lab/index.html old mode 100755 new mode 100644 diff --git a/src/lab/index.html.bak b/src/lab/index.html.bak old mode 100755 new mode 100644 diff --git a/src/lab/index.php b/src/lab/index.php old mode 100755 new mode 100644 index 9b94e0667..4e6dd3c93 --- a/src/lab/index.php +++ b/src/lab/index.php @@ -1,57 +1,57 @@ - -getElementById("lab-header-heading")->innertext; - $labarticleheading =$html->getElementById("lab-article-heading")->innertext; - // echo $html->getElementById("experiment-article-section-1-content")->plaintext; - // foreach($html->find('div[id=experiment-article-section-1-content]') as $element) - // echo $element->plaintext . '
'; -// - foreach($html->find('section') as $element) { - $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - -//echo $html->getElementById($element->id."-icon")->innertext->find('section'); - // echo $html->getElementById($element->id."-heading")->plaintext."-"; - // echo $section."="; - // echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; - if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) - { - // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); - $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; - $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; - // echo "Section: ".$element->id . '

'; - // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; - // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; - // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; - } - - - } - $data['nav'] = $nav; - //print_r($nav); - -$vlab_url = "http://virtual-labs.ac.in/"; -$css_js = "./"; -$lab_url = "./index.php"; -$exp_url = "./exp/index.php"; -$base_url = $lab_url; - -include('./exp_template.php'); - -//include('./number_system.php'); - -?> - - - + +getElementById("lab-header-heading")->innertext; + $labarticleheading =$html->getElementById("lab-article-heading")->innertext; + // echo $html->getElementById("experiment-article-section-1-content")->plaintext; + // foreach($html->find('div[id=experiment-article-section-1-content]') as $element) + // echo $element->plaintext . '
'; +// + foreach($html->find('section') as $element) { + $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + +//echo $html->getElementById($element->id."-icon")->innertext->find('section'); + // echo $html->getElementById($element->id."-heading")->plaintext."-"; + // echo $section."="; + // echo strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext)).","; + if(strcasecmp(trim($section),trim($html->getElementById($element->id."-heading")->plaintext))==0) + { + // $nav[] = array('heading' => $html->getElementById($element->id."-heading")->innertext,'img'=> $html->getElementById($element->id."-icon")->innertext); + $data['SubHeading'] =$html->getElementById($element->id."-heading")->innertext; + $data['SubContent'] =$html->getElementById($element->id."-content")->innertext; + // echo "Section: ".$element->id . '

'; + // echo "Icon: ".$html->getElementById($element->id."-icon")->innertext."
"; + // echo "Heading: ".$html->getElementById($element->id."-heading")->innertext."
"; + // echo "Content: ".$html->getElementById($element->id."-content")->innertext."


"; + } + + + } + $data['nav'] = $nav; + //print_r($nav); + +$vlab_url = "http://virtual-labs.ac.in/"; +$css_js = "./"; +$lab_url = "./index.php"; +$exp_url = "./exp/index.php"; +$base_url = $lab_url; + +include('./exp_template.php'); + +//include('./number_system.php'); + +?> + + + diff --git a/src/lab/installJava.html b/src/lab/installJava.html old mode 100755 new mode 100644 diff --git a/src/lab/introduction.html b/src/lab/introduction.html old mode 100755 new mode 100644 diff --git a/src/lab/prerequisites.html b/src/lab/prerequisites.html old mode 100755 new mode 100644 diff --git a/src/lab/save_json.php b/src/lab/save_json.php old mode 100755 new mode 100644 diff --git a/src/lab/save_json.php~ b/src/lab/save_json.php~ old mode 100755 new mode 100644 diff --git a/src/lab/scrap.py b/src/lab/scrap.py old mode 100755 new mode 100644 diff --git a/src/lab/scrap.py~ b/src/lab/scrap.py~ old mode 100755 new mode 100644 diff --git a/src/lab/simple_html_dom.php b/src/lab/simple_html_dom.php old mode 100755 new mode 100644 index 7e5064125..63cb89d39 --- a/src/lab/simple_html_dom.php +++ b/src/lab/simple_html_dom.php @@ -1,1393 +1,1393 @@ -size is the "real" number of bytes the dom was created from. - * but for most purposes, it's a really good estimation. - * Paperg - Added the forceTagsClosed to the dom constructor. Forcing tags closed is great for malformed html, but it CAN lead to parsing errors. - * Allow the user to tell us how much they trust the html. - * Paperg add the text and plaintext to the selectors for the find syntax. plaintext implies text in the innertext of a node. text implies that the tag is a text node. - * This allows for us to find tags based on the text they contain. - * Create find_ancestor_tag to see if a tag is - at any level - inside of another specific tag. - * Paperg: added parse_charset so that we know about the character set of the source document. - * NOTE: If the user's system has a routine called get_last_retrieve_url_contents_content_type availalbe, we will assume it's returning the content-type header from the - * last transfer or curl_exec, and we will parse that and use it in preference to any other method of charset detection. - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @author S.C. Chen - * @author John Schlick - * @author Rus Carroll - * @version 1.11 ($Rev: 184 $) - * @package PlaceLocalInclude - * @subpackage simple_html_dom - */ - -/** - * All of the Defines for the classes below. - * @author S.C. Chen - */ -define('HDOM_TYPE_ELEMENT', 1); -define('HDOM_TYPE_COMMENT', 2); -define('HDOM_TYPE_TEXT', 3); -define('HDOM_TYPE_ENDTAG', 4); -define('HDOM_TYPE_ROOT', 5); -define('HDOM_TYPE_UNKNOWN', 6); -define('HDOM_QUOTE_DOUBLE', 0); -define('HDOM_QUOTE_SINGLE', 1); -define('HDOM_QUOTE_NO', 3); -define('HDOM_INFO_BEGIN', 0); -define('HDOM_INFO_END', 1); -define('HDOM_INFO_QUOTE', 2); -define('HDOM_INFO_SPACE', 3); -define('HDOM_INFO_TEXT', 4); -define('HDOM_INFO_INNER', 5); -define('HDOM_INFO_OUTER', 6); -define('HDOM_INFO_ENDSPACE',7); -define('DEFAULT_TARGET_CHARSET', 'UTF-8'); -define('DEFAULT_BR_TEXT', "\r\n"); -// helper functions -// ----------------------------------------------------------------------------- -// get html dom from file -// $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. -function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT) -{ - // We DO force the tags to be terminated. - $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $defaultBRText); - // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done. - $contents = file_get_contents($url, $use_include_path, $context, $offset); - // Paperg - use our own mechanism for getting the contents as we want to control the timeout. -// $contents = retrieve_url_contents($url); - if (empty($contents)) - { - return false; - } - // The second parameter can force the selectors to all be lowercase. - $dom->load($contents, $lowercase, $stripRN); - return $dom; -} - -// get html dom from string -function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT) -{ - $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $defaultBRText); - if (empty($str)) - { - $dom->clear(); - return false; - } - $dom->load($str, $lowercase, $stripRN); - return $dom; -} - -// dump html dom tree -function dump_html_tree($node, $show_attr=true, $deep=0) -{ - $node->dump($node); -} - -/** - * simple html dom node - * PaperG - added ability for "find" routine to lowercase the value of the selector. - * PaperG - added $tag_start to track the start position of the tag in the total byte index - * - * @package PlaceLocalInclude - */ -class simple_html_dom_node { - public $nodetype = HDOM_TYPE_TEXT; - public $tag = 'text'; - public $attr = array(); - public $children = array(); - public $nodes = array(); - public $parent = null; - public $_ = array(); - public $tag_start = 0; - private $dom = null; - - function __construct($dom) - { - $this->dom = $dom; - $dom->nodes[] = $this; - } - - function __destruct() - { - $this->clear(); - } - - function __toString() - { - return $this->outertext(); - } - - // clean up memory due to php5 circular references memory leak... - function clear() - { - $this->dom = null; - $this->nodes = null; - $this->parent = null; - $this->children = null; - } - - // dump node's tree - function dump($show_attr=true, $deep=0) - { - $lead = str_repeat(' ', $deep); - - echo $lead.$this->tag; - if ($show_attr && count($this->attr)>0) - { - echo '('; - foreach ($this->attr as $k=>$v) - echo "[$k]=>\"".$this->$k.'", '; - echo ')'; - } - echo "\n"; - - foreach ($this->nodes as $c) - $c->dump($show_attr, $deep+1); - } - - - // Debugging function to dump a single dom node with a bunch of information about it. - function dump_node() - { - echo $this->tag; - if (count($this->attr)>0) - { - echo '('; - foreach ($this->attr as $k=>$v) - { - echo "[$k]=>\"".$this->$k.'", '; - } - echo ')'; - } - if (count($this->attr)>0) - { - echo ' $_ ('; - foreach ($this->_ as $k=>$v) - { - if (is_array($v)) - { - echo "[$k]=>("; - foreach ($v as $k2=>$v2) - { - echo "[$k2]=>\"".$v2.'", '; - } - echo ")"; - } else { - echo "[$k]=>\"".$v.'", '; - } - } - echo ")"; - } - - if (isset($this->text)) - { - echo " text: (" . $this->text . ")"; - } - - echo " children: " . count($this->children); - echo " nodes: " . count($this->nodes); - echo " tag_start: " . $this->tag_start; - echo "\n"; - - } - - // returns the parent of node - function parent() - { - return $this->parent; - } - - // returns children of node - function children($idx=-1) - { - if ($idx===-1) return $this->children; - if (isset($this->children[$idx])) return $this->children[$idx]; - return null; - } - - // returns the first child of node - function first_child() - { - if (count($this->children)>0) return $this->children[0]; - return null; - } - - // returns the last child of node - function last_child() - { - if (($count=count($this->children))>0) return $this->children[$count-1]; - return null; - } - - // returns the next sibling of node - function next_sibling() - { - if ($this->parent===null) return null; - $idx = 0; - $count = count($this->parent->children); - while ($idx<$count && $this!==$this->parent->children[$idx]) - ++$idx; - if (++$idx>=$count) return null; - return $this->parent->children[$idx]; - } - - // returns the previous sibling of node - function prev_sibling() - { - if ($this->parent===null) return null; - $idx = 0; - $count = count($this->parent->children); - while ($idx<$count && $this!==$this->parent->children[$idx]) - ++$idx; - if (--$idx<0) return null; - return $this->parent->children[$idx]; - } - - // function to locate a specific ancestor tag in the path to the root. - function find_ancestor_tag($tag) - { - global $debugObject; - if (is_object($debugObject)) - { - $debugObject->debugLogEntry(1); - } - - // Start by including ourselves in the comparison. - $returnDom = $this; - - while (!is_null($returnDom)) - { - if (is_object($debugObject)) - { - $debugObject->debugLog(2, "Current tag is: " . $returnDom->tag); - } - - if ($returnDom->tag == $tag) - { - break; - } - $returnDom = $returnDom->parent; - } - return $returnDom; - } - - // get dom node's inner html - function innertext() - { - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - - $ret = ''; - foreach ($this->nodes as $n) - $ret .= $n->outertext(); - return $ret; - } - - // get dom node's outer text (with tag) - function outertext() - { - global $debugObject; - if (is_object($debugObject)) - { - $text = ''; - if ($this->tag == 'text') - { - if (!empty($this->text)) - { - $text = " with text: " . $this->text; - } - } - $debugObject->debugLog(1, 'Innertext of tag: ' . $this->tag . $text); - } - - if ($this->tag==='root') return $this->innertext(); - - // trigger callback - if ($this->dom && $this->dom->callback!==null) - { - call_user_func_array($this->dom->callback, array($this)); - } - - if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER]; - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - - // render begin tag - if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]) - { - $ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup(); - } else { - $ret = ""; - } - - // render inner text - if (isset($this->_[HDOM_INFO_INNER])) - { - // If it's a br tag... don't return the HDOM_INNER_INFO that we may or may not have added. - if ($this->tag != "br") - { - $ret .= $this->_[HDOM_INFO_INNER]; - } - } else { - if ($this->nodes) - { - foreach ($this->nodes as $n) - { - $ret .= $this->convert_text($n->outertext()); - } - } - } - - // render end tag - if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) - $ret .= 'tag.'>'; - return $ret; - } - - // get dom node's plain text - function text() - { - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; - switch ($this->nodetype) - { - case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - case HDOM_TYPE_COMMENT: return ''; - case HDOM_TYPE_UNKNOWN: return ''; - } - if (strcasecmp($this->tag, 'script')===0) return ''; - if (strcasecmp($this->tag, 'style')===0) return ''; - - $ret = ''; - // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL. - // NOTE: This indicates that there is a problem where it's set to NULL without a clear happening. - // WHY is this happening? - if (!is_null($this->nodes)) - { - foreach ($this->nodes as $n) - { - $ret .= $this->convert_text($n->text()); - } - } - return $ret; - } - - function xmltext() - { - $ret = $this->innertext(); - $ret = str_ireplace('', '', $ret); - return $ret; - } - - // build node's text with tag - function makeup() - { - // text, comment, unknown - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - - $ret = '<'.$this->tag; - $i = -1; - - foreach ($this->attr as $key=>$val) - { - ++$i; - - // skip removed attribute - if ($val===null || $val===false) - continue; - - $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; - //no value attr: nowrap, checked selected... - if ($val===true) - $ret .= $key; - else { - switch ($this->_[HDOM_INFO_QUOTE][$i]) - { - case HDOM_QUOTE_DOUBLE: $quote = '"'; break; - case HDOM_QUOTE_SINGLE: $quote = '\''; break; - default: $quote = ''; - } - $ret .= $key.$this->_[HDOM_INFO_SPACE][$i][1].'='.$this->_[HDOM_INFO_SPACE][$i][2].$quote.$val.$quote; - } - } - $ret = $this->dom->restore_noise($ret); - return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; - } - - // find elements by css selector - //PaperG - added ability for find to lowercase the value of the selector. - function find($selector, $idx=null, $lowercase=false) - { - $selectors = $this->parse_selector($selector); - if (($count=count($selectors))===0) return array(); - $found_keys = array(); - - // find each selector - for ($c=0; $c<$count; ++$c) - { - // The change on the below line was documented on the sourceforge code tracker id 2788009 - // used to be: if (($levle=count($selectors[0]))===0) return array(); - if (($levle=count($selectors[$c]))===0) return array(); - if (!isset($this->_[HDOM_INFO_BEGIN])) return array(); - - $head = array($this->_[HDOM_INFO_BEGIN]=>1); - - // handle descendant selectors, no recursive! - for ($l=0; $l<$levle; ++$l) - { - $ret = array(); - foreach ($head as $k=>$v) - { - $n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k]; - //PaperG - Pass this optional parameter on to the seek function. - $n->seek($selectors[$c][$l], $ret, $lowercase); - } - $head = $ret; - } - - foreach ($head as $k=>$v) - { - if (!isset($found_keys[$k])) - $found_keys[$k] = 1; - } - } - - // sort keys - ksort($found_keys); - - $found = array(); - foreach ($found_keys as $k=>$v) - $found[] = $this->dom->nodes[$k]; - - // return nth-element or array - if (is_null($idx)) return $found; - else if ($idx<0) $idx = count($found) + $idx; - return (isset($found[$idx])) ? $found[$idx] : null; - } - - // seek for given conditions - // PaperG - added parameter to allow for case insensitive testing of the value of a selector. - protected function seek($selector, &$ret, $lowercase=false) - { - global $debugObject; - if (is_object($debugObject)) - { - $debugObject->debugLogEntry(1); - } - - list($tag, $key, $val, $exp, $no_key) = $selector; - - // xpath index - if ($tag && $key && is_numeric($key)) - { - $count = 0; - foreach ($this->children as $c) - { - if ($tag==='*' || $tag===$c->tag) { - if (++$count==$key) { - $ret[$c->_[HDOM_INFO_BEGIN]] = 1; - return; - } - } - } - return; - } - - $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0; - if ($end==0) { - $parent = $this->parent; - while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) { - $end -= 1; - $parent = $parent->parent; - } - $end += $parent->_[HDOM_INFO_END]; - } - - for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) { - $node = $this->dom->nodes[$i]; - - $pass = true; - - if ($tag==='*' && !$key) { - if (in_array($node, $this->children, true)) - $ret[$i] = 1; - continue; - } - - // compare tag - if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;} - // compare key - if ($pass && $key) { - if ($no_key) { - if (isset($node->attr[$key])) $pass=false; - } else { - if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false; - } - } - // compare value - if ($pass && $key && $val && $val!=='*') { - // If they have told us that this is a "plaintext" search then we want the plaintext of the node - right? - if ($key == "plaintext") { - // $node->plaintext actually returns $node->text(); - $nodeKeyValue = $node->text(); - } else { - // this is a normal search, we want the value of that attribute of the tag. - $nodeKeyValue = $node->attr[$key]; - } - if (is_object($debugObject)) {$debugObject->debugLog(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);} - - //PaperG - If lowercase is set, do a case insensitive test of the value of the selector. - if ($lowercase) { - $check = $this->match($exp, strtolower($val), strtolower($nodeKeyValue)); - } else { - $check = $this->match($exp, $val, $nodeKeyValue); - } - if (is_object($debugObject)) {$debugObject->debugLog(2, "after match: " . ($check ? "true" : "false"));} - - // handle multiple class - if (!$check && strcasecmp($key, 'class')===0) { - foreach (explode(' ',$node->attr[$key]) as $k) { - // Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form. - if (!empty($k)) { - if ($lowercase) { - $check = $this->match($exp, strtolower($val), strtolower($k)); - } else { - $check = $this->match($exp, $val, $k); - } - if ($check) break; - } - } - } - if (!$check) $pass = false; - } - if ($pass) $ret[$i] = 1; - unset($node); - } - // It's passed by reference so this is actually what this function returns. - if (is_object($debugObject)) {$debugObject->debugLog(1, "EXIT - ret: ", $ret);} - } - - protected function match($exp, $pattern, $value) { - global $debugObject; - if (is_object($debugObject)) {$debugObject->debugLogEntry(1);} - - switch ($exp) { - case '=': - return ($value===$pattern); - case '!=': - return ($value!==$pattern); - case '^=': - return preg_match("/^".preg_quote($pattern,'/')."/", $value); - case '$=': - return preg_match("/".preg_quote($pattern,'/')."$/", $value); - case '*=': - if ($pattern[0]=='/') { - return preg_match($pattern, $value); - } - return preg_match("/".$pattern."/i", $value); - } - return false; - } - - protected function parse_selector($selector_string) { - global $debugObject; - if (is_object($debugObject)) {$debugObject->debugLogEntry(1);} - - // pattern of CSS selectors, modified from mootools - // Paperg: Add the colon to the attrbute, so that it properly finds like google does. - // Note: if you try to look at this attribute, yo MUST use getAttribute since $dom->x:y will fail the php syntax check. -// Notice the \[ starting the attbute? and the @? following? This implies that an attribute can begin with an @ sign that is not captured. -// This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression. -// farther study is required to determine of this should be documented or removed. -// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; - $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; - preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); - if (is_object($debugObject)) {$debugObject->debugLog(2, "Matches Array: ", $matches);} - - $selectors = array(); - $result = array(); - //print_r($matches); - - foreach ($matches as $m) { - $m[0] = trim($m[0]); - if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue; - // for browser generated xpath - if ($m[1]==='tbody') continue; - - list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false); - if (!empty($m[2])) {$key='id'; $val=$m[2];} - if (!empty($m[3])) {$key='class'; $val=$m[3];} - if (!empty($m[4])) {$key=$m[4];} - if (!empty($m[5])) {$exp=$m[5];} - if (!empty($m[6])) {$val=$m[6];} - - // convert to lowercase - if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);} - //elements that do NOT have the specified attribute - if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;} - - $result[] = array($tag, $key, $val, $exp, $no_key); - if (trim($m[7])===',') { - $selectors[] = $result; - $result = array(); - } - } - if (count($result)>0) - $selectors[] = $result; - return $selectors; - } - - function __get($name) { - if (isset($this->attr[$name])) - { - return $this->convert_text($this->attr[$name]); - } - switch ($name) { - case 'outertext': return $this->outertext(); - case 'innertext': return $this->innertext(); - case 'plaintext': return $this->text(); - case 'xmltext': return $this->xmltext(); - default: return array_key_exists($name, $this->attr); - } - } - - function __set($name, $value) { - switch ($name) { - case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; - case 'innertext': - if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; - return $this->_[HDOM_INFO_INNER] = $value; - } - if (!isset($this->attr[$name])) { - $this->_[HDOM_INFO_SPACE][] = array(' ', '', ''); - $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; - } - $this->attr[$name] = $value; - } - - function __isset($name) { - switch ($name) { - case 'outertext': return true; - case 'innertext': return true; - case 'plaintext': return true; - } - //no value attr: nowrap, checked selected... - return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]); - } - - function __unset($name) { - if (isset($this->attr[$name])) - unset($this->attr[$name]); - } - - // PaperG - Function to convert the text from one character set to another if the two sets are not the same. - function convert_text($text) { - global $debugObject; - if (is_object($debugObject)) {$debugObject->debugLogEntry(1);} - - $converted_text = $text; - - $sourceCharset = ""; - $targetCharset = ""; - if ($this->dom) { - $sourceCharset = strtoupper($this->dom->_charset); - $targetCharset = strtoupper($this->dom->_target_charset); - } - if (is_object($debugObject)) {$debugObject->debugLog(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);} - - if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0)) - { - // Check if the reported encoding could have been incorrect and the text is actually already UTF-8 - if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text))) - { - $converted_text = $text; - } - else - { - $converted_text = iconv($sourceCharset, $targetCharset, $text); - } - } - - return $converted_text; - } - - function is_utf8($string) - { - return (utf8_encode(utf8_decode($string)) == $string); - } - - // camel naming conventions - function getAllAttributes() {return $this->attr;} - function getAttribute($name) {return $this->__get($name);} - function setAttribute($name, $value) {$this->__set($name, $value);} - function hasAttribute($name) {return $this->__isset($name);} - function removeAttribute($name) {$this->__set($name, null);} - function getElementById($id) {return $this->find("#$id", 0);} - function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);} - function getElementByTagName($name) {return $this->find($name, 0);} - function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);} - function parentNode() {return $this->parent();} - function childNodes($idx=-1) {return $this->children($idx);} - function firstChild() {return $this->first_child();} - function lastChild() {return $this->last_child();} - function nextSibling() {return $this->next_sibling();} - function previousSibling() {return $this->prev_sibling();} -} - -/** - * simple html dom parser - * Paperg - in the find routine: allow us to specify that we want case insensitive testing of the value of the selector. - * Paperg - change $size from protected to public so we can easily access it - * Paperg - added ForceTagsClosed in the constructor which tells us whether we trust the html or not. Default is to NOT trust it. - * - * @package PlaceLocalInclude - */ -class simple_html_dom { - public $root = null; - public $nodes = array(); - public $callback = null; - public $lowercase = false; - public $size; - protected $pos; - protected $doc; - protected $char; - protected $cursor; - protected $parent; - protected $noise = array(); - protected $token_blank = " \t\r\n"; - protected $token_equal = ' =/>'; - protected $token_slash = " />\r\n\t"; - protected $token_attr = ' >'; - protected $_charset = ''; - protected $_target_charset = ''; - protected $default_br_text = ""; - - // use isset instead of in_array, performance boost about 30%... - protected $self_closing_tags = array('img'=>1, 'br'=>1, 'input'=>1, 'meta'=>1, 'link'=>1, 'hr'=>1, 'base'=>1, 'embed'=>1, 'spacer'=>1); - protected $block_tags = array('root'=>1, 'body'=>1, 'form'=>1, 'div'=>1, 'span'=>1, 'table'=>1); - // Known sourceforge issue #2977341 - // B tags that are not closed cause us to return everything to the end of the document. - protected $optional_closing_tags = array( - 'tr'=>array('tr'=>1, 'td'=>1, 'th'=>1), - 'th'=>array('th'=>1), - 'td'=>array('td'=>1), - 'li'=>array('li'=>1), - 'dt'=>array('dt'=>1, 'dd'=>1), - 'dd'=>array('dd'=>1, 'dt'=>1), - 'dl'=>array('dd'=>1, 'dt'=>1), - 'p'=>array('p'=>1), - 'nobr'=>array('nobr'=>1), - 'b'=>array('b'=>1), - ); - - function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT) { - if ($str) { - if (preg_match("/^http:\/\//i",$str) || is_file($str)) - $this->load_file($str); - else - $this->load($str, $lowercase, $stripRN, $defaultBRText); - } - // Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html. - if (!$forceTagsClosed) { - $this->optional_closing_array=array(); - } - $this->_target_charset = $target_charset; - } - - function __destruct() { - $this->clear(); - } - - // load html from string - function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT) { - global $debugObject; - - // prepare - $this->prepare($str, $lowercase, $stripRN, $defaultBRText); - // strip out comments - $this->remove_noise("''is"); - // strip out cdata - $this->remove_noise("''is", true); - // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 - // Script tags removal now preceeds style tag removal. - // strip out