Skip to content

Commit

Permalink
Fix aperture bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetsuro Sakamoto committed Oct 6, 2023
1 parent edf5752 commit 61d9ecd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ <h2>Contacts</h2>

// Draw inner ray
const notHitAperture = -this.effectiveLensRadius < ty && ty < this.effectiveLensRadius
if (notHitAperture) {
if (notHitAperture || !this.options.useIdealLens) {

if (!this.options.showBody) {
drawSegment(ctx, tx, ty, tx + this.maxR * Math.cos(phi), ty + this.maxR * Math.sin(phi));
Expand Down Expand Up @@ -1130,15 +1130,15 @@ <h2>Contacts</h2>
sensorCanvasCtx.reset();
sensorCanvasCtx.fillRect(0, 0, this.sensorCanvas.width, this.sensorCanvas.height); // background
const sensorCanvasScale = this.sensorCanvas.height / (this.sensor.size);
sensorCanvasCtx.transform(1 << 12, 0, 0, sensorCanvasScale, this.sensorCanvas.width / 2, this.sensorCanvas.height / 2);
sensorCanvasCtx.transform((1 << 6) / this.rayWidth, 0, 0, sensorCanvasScale, this.sensorCanvas.width / 2, this.sensorCanvas.height / 2);
sensorCanvasCtx.globalCompositeOperation = 'lighten';

sensorIntersections.forEach((sensorIntersectionsForLight, idx) => {
const color = this.lights[idx].color;
sensorCanvasCtx.fillStyle = color;
sensorIntersectionsForLight.forEach((y) => {
sensorCanvasCtx.beginPath();
sensorCanvasCtx.arc(0, y, this.rayWidth / 16, 0, Math.PI * 2);
sensorCanvasCtx.arc(0, y, this.rayWidth / 2, 0, Math.PI * 2);
sensorCanvasCtx.fill();
});
});
Expand Down

0 comments on commit 61d9ecd

Please sign in to comment.