Skip to content

Commit

Permalink
Free move lens groups
Browse files Browse the repository at this point in the history
  • Loading branch information
monman53 committed Jul 8, 2024
1 parent 19aa190 commit 4e843ec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
2 changes: 1 addition & 1 deletion src/Controller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const createSensor = (d: number) => {
<button @click="state.newLightWavelength = wavelength.red">Red</button>
</template>
<template v-if="state.newLightColorComposite">
<input type="range" min="0" max="16" v-model="state.newLightColorCompositeN">
<input type="range" min="0" max="32" v-model="state.newLightColorCompositeN">
</template>
</td>
<td v-if="!state.newLightColorComposite"
Expand Down
18 changes: 0 additions & 18 deletions src/SVG/LensGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,6 @@ const move = (e: any) => {
const x0s = lensGroups.value.map(lensGroup => lensGroup.lenses.map(lens => lens.planes.map(p => p.x)))
return (e: any, d: Vec) => {
// Fix d.x within maxLightX < d.x < sensor.x
const sensorMinX = Math.min(sensor.value.s.x, sensor.value.t.x)
for (let i = 0; i < lensGroups.value.length; i++) {
const lensGroup = lensGroups.value[i];
if (!lensGroup.selected) {
continue
}
for (let j = 0; j < lensGroup.lenses.length; j++) {
const lens = lensGroup.lenses[j]
for (let k = 0; k < lens.planes.length; k++) {
if (x0s[i][j][k] + d.x > sensorMinX) {
if (Math.abs(sensorMinX - x0s[i][j][k]) < Math.abs(d.x)) {
d.x = sensorMinX - x0s[i][j][k]
}
}
}
}
}
// Update position
lensGroups.value.forEach((lensGroup, i) => {
if (!lensGroup.selected) {
Expand Down

0 comments on commit 4e843ec

Please sign in to comment.