Skip to content

Commit c8846a8

Browse files
Merge pull request #18 from virtual-labs/testing
Testing to main
2 parents 20aa805 + 08086a3 commit c8846a8

File tree

6 files changed

+307
-145
lines changed

6 files changed

+307
-145
lines changed

experiment/procedure.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,25 @@
55
3. **Proceed to the Experiment**: Click on **Submit** to begin the experiment with the defined parameters for the clipping window and the line coordinates.
66

77
4. **Navigate Through the Experiment**:
8-
- Use **Next Iteration** to advance to the next step of the Cohen-Sutherland algorithm, which clips the line segment according to the defined clipping window.
9-
- Use **Previous Iteration** to move back to the previous step if needed, allowing you to review each stage of the clipping process.
10-
- Use the **Reset** button to clear the current experiment and start new with default parameters for the clipping window and line coordinates.
8+
- Use **Next Iteration** to advance through the Cohen-Sutherland algorithm steps:
9+
- The algorithm will check if points are inside the clipping window
10+
- Compute intersection points with window boundaries
11+
- Draw the clipped line segments
12+
- Use **Previous Iteration** to move back to the previous step, allowing you to review:
13+
- The state of the line at each step
14+
- Intersection points computed
15+
- Clipping decisions made
16+
- Use the **Reset** button to clear the current experiment and start new with default parameters
1117

12-
5. **End of Experiment**: Upon completion of the experiment, you can:
13-
- Start a new experiment with different starting and ending coordinates for the line within the same clipping window.
14-
- Adjust the parameters of the clipping window to experiment with different clipping scenarios.
18+
5. **Monitor the Experiment Progress**:
19+
- Watch the **Observations** column on the right side for:
20+
- Current step message explaining what's happening
21+
- Logic text showing the current clipping operation
22+
- Point status showing which point is being processed
23+
- Line status showing which boundary is being checked
24+
- Table showing coordinates of points and intersections
25+
26+
6. **End of Experiment**: Upon completion of the experiment, you can:
27+
- Start a new experiment with different starting and ending coordinates for the line within the same clipping window
28+
- Adjust the parameters of the clipping window to experiment with different clipping scenarios
29+
- Review the final clipped line and all intermediate steps using the Previous Iteration button

experiment/simulation/Vlabs.jar

-62.9 KB
Binary file not shown.

experiment/simulation/css/main.css

Lines changed: 64 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.page {
32
overflow: hidden;
43
margin: 1rem;
@@ -7,21 +6,26 @@
76
.text {
87
text-align: center;
98
}
10-
.columns{
9+
10+
.columns {
1111
margin: 0.1vw;
1212
}
13+
1314
.table-body {
1415
overflow: auto;
1516
height: 100%;
1617
}
18+
1719
.error-text {
1820
color: red;
1921
display: none;
2022
font-size: 12px;
2123
}
24+
2225
#canvas-wrap {
2326
position: relative;
24-
} /* Make this a positioned parent */
27+
}
28+
2529
.point-div {
2630
position: absolute;
2731
display: none;
@@ -33,9 +37,11 @@
3337
padding: 4px;
3438
margin: 2px;
3539
}
40+
3641
.error {
3742
border: 2px solid red;
3843
}
44+
3945
.v-canvas-container {
4046
width: 100%;
4147
height: 100%;
@@ -67,6 +73,7 @@
6773
.left {
6874
order: 1;
6975
}
76+
7077
.right {
7178
order: 3;
7279
}
@@ -84,9 +91,6 @@
8491
}
8592

8693
.v-datalist-title {
87-
/* background-color: #2C9AD1; */
88-
/* background-blend-mode: overlay; */
89-
/* border-radius: 1rem; */
9094
border-bottom: 0;
9195
}
9296

@@ -111,33 +115,52 @@
111115

112116
@media screen and (max-width: 768px) {
113117
/* Adjust columns for mobile screens */
118+
.workspace {
119+
width: 98%; /* Match instructions div width */
120+
margin: 0 auto;
121+
padding: 0 1%; /* Add small padding on sides */
122+
}
123+
114124
.workspace .column {
115125
margin-bottom: 1rem;
116126
padding: 0.5rem;
117127
}
118128

129+
/* Specific adjustments for left and right columns */
130+
#left.column.is-10-mobile {
131+
width: 100%; /* Full width within workspace */
132+
margin: 0; /* Remove auto margins */
133+
}
134+
135+
.right.column.is-10-mobile {
136+
width: 100%; /* Full width within workspace */
137+
margin: 0; /* Remove auto margins */
138+
}
139+
140+
/* Ensure canvas column maintains its width */
141+
#canvas-wrap.column.is-12-mobile {
142+
width: 100%; /* Full width within workspace */
143+
padding: 0; /* Remove padding to maximize canvas space */
144+
}
145+
119146
/* Specific adjustments */
120147
#left {
121-
order: 1; /* Ensure correct order for mobile layout */
148+
order: 1;
122149
}
123150

124151
.right {
125-
order: 2; /* Ensure correct order for mobile layout */
152+
order: 2;
126153
}
127154

128155
.exp {
129-
order: 3; /* Ensure correct order for mobile layout */
156+
order: 3;
130157
}
131158
}
132159

133-
134-
135-
136160
.v-button {
137161
background-color: #04aa6d;
138162
border-radius: 0.5rem;
139163
font-size: small;
140-
/* width: 30%; */
141164
}
142165

143166
.next-btn {
@@ -155,43 +178,40 @@
155178
border-radius: 0.5rem;
156179
}
157180

158-
159181
#procedure-message {
160-
display: none;
161-
position: fixed;
162-
max-width: 100vw; /* Full width */
163-
max-height: 90vh; /* Prevent overflow */
164-
overflow-y: auto; /* Scroll if content exceeds height */
165-
background: linear-gradient(135deg, #f0f4f8, #d6e1e7); /* Gradient background */
166-
z-index: 1000;
167-
padding: 35px;
168-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); /* Deeper shadow for more depth */
169-
border-radius: 16px; /* Rounded corners for a smoother look */
170-
text-align: left;
171-
top: 40%; /* Center vertically */
172-
left: 50%; /* Center horizontally */
173-
transform: translate(-50%, -50%);
174-
animation: fadeIn 0.5s ease-out; /* Fade-in animation */
175-
border: 2px solid #3498db; /* Border with a light blue color */
176-
}
177-
178-
/* Add a subtle fade-in animation */
182+
display: none;
183+
position: fixed;
184+
max-width: 100vw;
185+
max-height: 90vh;
186+
overflow-y: auto;
187+
background: linear-gradient(135deg, #f0f4f8, #d6e1e7);
188+
z-index: 1000;
189+
padding: 35px;
190+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
191+
border-radius: 16px;
192+
text-align: left;
193+
top: 40%;
194+
left: 50%;
195+
transform: translate(-50%, -50%);
196+
animation: fadeIn 0.5s ease-out;
197+
border: 2px solid #3498db;
198+
}
199+
179200
@keyframes fadeIn {
180-
from {
181-
opacity: 0;
182-
}
183-
to {
184-
opacity: 1;
185-
}
201+
from {
202+
opacity: 0;
203+
}
204+
to {
205+
opacity: 1;
206+
}
186207
}
187208

188-
/* Optional: add hover effect */
189209
#procedure-message:hover {
190-
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); /* Stronger shadow on hover */
191-
transform: translate(-50%, -50%) scale(1.05); /* Slight zoom effect */
210+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
211+
transform: translate(-50%, -50%) scale(1.05);
192212
}
193213

194214
.instr-font {
195-
font-size: 1rem;
196-
color: #000;
215+
font-size: 1rem;
216+
color: #000;
197217
}

experiment/simulation/index.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@
187187
<div class="v-datalist-container components-list">
188188
<div class="v-datalist-title">Observations</div>
189189
<div class="v-datalist-row">
190+
<div id="observation-step-message" style="margin-bottom: 8px; color: #333; font-weight: bold;"></div>
191+
<div id="text"></div>
192+
<div id="logic_text"></div>
193+
<div id="pointstat_text"></div>
194+
<div id="linestat_text"></div>
190195
<div class="v-table-wrap">
191196
<table id="observations-table" class="table is-bordered is-fullwidth">
192197
<thead id="table-head">
@@ -198,16 +203,13 @@
198203
<tbody class="table-body"></tbody>
199204
</table>
200205
</div>
201-
<div id="result"></div>
202206
</div>
203207
</div>
204208
</div>
205209
</div>
206210

207-
</div>
208-
<script src="js/main.js "></script>
209-
<script src="https://cdn.jsdelivr.net/gh/virtual-labs/virtual-style@0.0.8-b/js/script.js "></script>
210-
211+
<script src="js/main.js"></script>
212+
<script src="https://cdn.jsdelivr.net/gh/virtual-labs/virtual-style@0.0.8-b/js/script.js"></script>
211213
</body>
212214

213215
</html>

0 commit comments

Comments
 (0)