Skip to content

CHATGTP generator code for stereoscopic side by side rig stereo 3d photographu

Notifications You must be signed in to change notification settings

openui54u/stereocalculator

Repository files navigation

Initial text ( includgin typo's. From whcih multiple itterations and adjustmenst were asked to be made.

On sterescopic photography there is a formula to calculate disparity. Based on the inter axial base of the 2 camera’s, the distance to the subject , in plane, and the most far object. With a IA ( base ) of 19cm, when the object is at 3m distance , what is the far distance maximum when displaying on a 52” tv? Taking into accpunt max disparity of 2% of screen with. And how mich disparity in cm is on the screen?

V6

stereocalculator

CHATGTP generator code for stereoscopic side by side rig stereo 3d photography

Explanation:

  • Instead of calculating the disparity on the screen as a fixed percentage of the screen width, we now calculate it as a percentage of the screen width using the correct formula: disparityCm / screenWidth.

Instructions:

  1. Copy the updated code above and save it as an HTML file (e.g., stereo_calculator.html).
  2. Open the HTML file in a web browser.
  3. Adjust the sliders to set the values for the interaxial base (IA), distance to the subject, far distance, lens focal length, and TV screen size.
  4. Observe the calculated results update in real-time as you adjust the sliders.

v9 On sterescopic photography there is a formula to calculate disparity. Based on the inter axial base of the 2 camera’s, the distance to the subject , in plane, and the most far object. With a IA ( base ) of 19cm, when the object is at 3m distance , what is the far distance maximum when displaying on a 52” tv? Taking into accpunt max disparity of 2% of screen with. And how mich disparity in cm is on the screen?

Using a logarithmic scale can indeed make it easier to adjust sliders for values that span several orders of magnitude, especially for distances where fine control over smaller values is needed.

Here's how you can implement logarithmic sliders in your code:

  1. Convert the slider values to a logarithmic scale for input.
  2. Convert the logarithmic values back to a linear scale for calculations.

(code)

Explanation:

  1. Logarithmic Scale:

    • For distance and farDistance, the slider values are converted to a logarithmic scale using Math.log10(value).
    • For calculations, these values are converted back to the linear scale using Math.pow(10, value).
  2. Fine Control:

    • This approach allows for finer control over smaller values while still allowing adjustments over a wide range.
  3. Sliders:

    • The step value for the sliders is set to 0.01 for distance and farDistance to ensure smooth adjustments.

Please give this updated code a try and see if it improves the ease of adjusting the distances. Let me know if you have any further requests or need more adjustments.

V10.

Changes made:

  1. Distance Slider:

    • The logarithmic scale is used to make it easier to adjust distances.
    • The range of the slider for the distance to the subject is set from 0.1 to 100 meters.
  2. Far Distance Slider:

    • The range of the slider for the far distance is set from 0.1 to 1000 meters.
  3. Lens Focal Length:

    • Increased the maximum focal length to 800 mm.
  4. Disparity as a Fraction:

    • Added a calculation to display the disparity percentage as a fraction (1/x).

v11.

Explanation:

  1. Logarithmic Scale Adjustments:

    • Ensure the logarithmic scale is correctly set to the required range for distance (0.1 to 100 meters) and far distance (0.1 to 1000 meters).
  2. Disparity Fraction Calculation:

    • The correct calculation for the disparity as a fraction: ( \text{Fraction} = \frac{100}{\text{disparity percentage}} ).

Key Changes:

  • Corrected the slider range for distance and far distance to logarithmic values.

  • Updated the formula to correctly calculate the disparity fraction.

  • v12.

  • es, you're correct. The maximum values for the distance sliders should be set appropriately to correspond to 100 meters and 1000 meters, respectively, in a logarithmic scale. Additionally, the values should be displayed in a readable numeric format instead of exponential notation.

Let's update the code accordingly:

  • Ensure the logarithmic values correspond correctly to the desired ranges.
  • Display the values in a readable numeric format.

{ So now I made manual corrections on the values in gthe sliders since chat gpt was not getting there... I gave the code baCK TO CHATGPT TO CHECK. } V12 is manual corrected...

v13. Your code is mostly correct, but it appears there's an issue with the range values set for the distance sliders. The min and max values should represent the logarithmic scales correctly, and the conversion from logarithmic to linear values should reflect the correct range for both subject distance and far distance.

Let's make these adjustments:

  1. Correct the range values for the distance sliders to represent logarithmic values correctly.
  2. Display the values in a readable format, ensuring they don't show up as exponential values.

Here is the corrected version of the code:

On the websote : https://paulbourke.net/stereographics/stereorender/

I found this text and gave chatgpt this info :

A common measure is the parallax angle defined as theta = 2 atan(DX / 2D) where DX is the horizontal separation of a projected point between the two eyes and d is the distance of the eye from the projection plane. For easy fusing by the majority of people, the absolute value of theta should not exceed 1.5 degrees for all points in the scene. Note theta is positive for points behind the scene and negative for points in front of the screen. It is not uncommon to restrict the negative value of theta to some value closer to zero since negative parallax is more difficult to fuse especially when objects cut the boundary of the projection plane.

And I asked to add a slider for eyedistance 5.5-7.3cm and a new variable.


### Key Additions:
1. **Eye Separation Slider**:
   - Added a new slider for eye separation with a range of 5.5 to 7.3 cm.
   
2. **Parallax Angle Calculation**:
   - Calculated the parallax angle (\(\theta\)) using the formula: \(\theta = 2 \cdot \arctan \left(\frac{\text{DX}}{2D}\right)\), where DX is the horizontal separation of a projected point (disparityCm) and \(D\) is the eye separation.
   
3. **Results Display**:
   - Added the parallax angle (\(\theta\)) to the results display.

Please test the updated code and let me know if it meets your requirements.



v16

### Key Adjustments:
1. **Color Coding Conditions**:
   - Parallax angle (`theta`) should be red if it exceeds 1.5 degrees.
   - Disparity percentage should be orange if above 2% and red if above 3%.
   - Disparity on the screen should be orange if above eye separation and red if above both eye separation and disparity percentage conditions.
   - Disparity fraction should be orange if it exceeds 1/20.


v17.
{ Remark: Why does only the variable of ‘disparity on screen’ change when you change the tv screen size. The distance to the screen is variable D. Which is part of theta calculation. Please check the interaction between this slider and all calculations
}
You're correct; the distance to the screen (eyeToProjectionDistance) should vary with the TV screen size since the diagonal size changes. Let's ensure that changing the TV screen size affects all relevant calculations, including the parallax angle (theta).

Here's the updated code with this correction:

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Stereoscopic Photography Calculator</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        .slider-container {
            margin-bottom: 20px;
        }
        .slider-container label {
            display: block;
            margin-bottom: 5px;
        }
        .slider-container input {
            width: 100%;
        }
        .result {
            margin-top: 20px;
            font-weight: bold;
        }
    </style>
</head>
<body>

<h1>Stereoscopic Photography Calculator</h1>

<div class="slider-container">
    <label for="ia">Interaxial Base (IA) in cm: <span id="iaValue">19</span></label>
    <input type="range" id="ia" min="1" max="100" value="19" step="0.1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="distance">Distance to Subject in meters: <span id="distanceValue">3</span></label>
    <input type="range" id="distance" min="0.0001" max="2" value="0.477" step="0.0001" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="farDistance">Far Distance in meters: <span id="farDistanceValue">10</span></label>
    <input type="range" id="farDistance" min="0.001" max="3" value="1" step="0.0001" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="lens">Lens Focal Length in mm: <span id="lensValue">50</span></label>
    <input type="range" id="lens" min="10" max="800" value="50" step="1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="tvSize">TV Screen Size in inches: <span id="tvSizeValue">52</span></label>
    <input type="range" id="tvSize" min="10" max="100" value="52" step="1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="eyeSeparation">Eye Separation in cm: <span id="eyeSeparationValue">6.4</span></label>
    <input type="range" id="eyeSeparation" min="5.5" max="7.3" value="6.4" step="0.1" oninput="calculateDisparity()">
</div>

<div class="result" id="result"></div>

<script>
    function calculateDisparity() {
        // Get input values
        const ia = parseFloat(document.getElementById('ia').value);
        const distanceLog = parseFloat(document.getElementById('distance').value);
        const farDistanceLog = parseFloat(document.getElementById('farDistance').value);
        const lens = parseFloat(document.getElementById('lens').value);
        const tvSize = parseFloat(document.getElementById('tvSize').value);
        const eyeSeparation = parseFloat(document.getElementById('eyeSeparation').value);

        // Convert logarithmic values back to linear scale
        const distance = Math.pow(10, distanceLog);
        const farDistance = Math.pow(10, farDistanceLog);

        // Update displayed values
        document.getElementById('iaValue').innerText = ia;
        document.getElementById('distanceValue').innerText = distance.toFixed(2);
        document.getElementById('farDistanceValue').innerText = farDistance.toFixed(2);
        document.getElementById('lensValue').innerText = lens;
        document.getElementById('tvSizeValue').innerText = tvSize;
        document.getElementById('eyeSeparationValue').innerText = eyeSeparation;

        // Convert TV size to cm
        const diagonal = tvSize * 2.54;
        const screenWidth = Math.sqrt(16 * 16 / (16 * 16 + 9 * 9)) * diagonal;

        // Calculate disparity
        const disparity = (ia * (farDistance - distance)) / (farDistance * distance);

        // Calculate magnification factor based on focal length
        const magnification = lens / 36; // assuming a full-frame sensor with a width of 36 mm

        // Calculate the disparity in cm on the screen
        const disparityCm = disparity * magnification * screenWidth / 100;

        // Calculate disparity percentage
        const disparityPercent = (disparityCm / screenWidth) * 100;

        // Calculate disparity as a fraction
        const disparityFraction = 100 / disparityPercent;

        // Calculate the distance from the eye to the projection plane
        const eyeToProjectionDistance = 1.5 * diagonal;

        // Calculate parallax angle (theta)
        const theta = 2 * Math.atan((disparityCm / 2) / eyeToProjectionDistance) * (180 / Math.PI);

        // Determine colors based on conditions
        const thetaColor = Math.abs(theta) > 1.5 ? 'red' : 'black';
        const disparityPercentColor = disparityPercent > 3 ? 'red' : (disparityPercent > 2 ? 'orange' : 'black');
        const disparityCmColor = disparityCm > eyeSeparation && disparityPercentColor === 'red' ? 'red' : (disparityCm > eyeSeparation ? 'orange' : 'black');
        const disparityFractionColor = disparityFraction < 20 ? 'orange' : 'black';

        // Display the results with color coding
        document.getElementById('result').innerHTML = `
            <span style="color:${disparityCmColor}">Disparity on Screen: ${disparityCm.toFixed(2)} cm</span><br>
            <span style="color:${disparityPercentColor}">Disparity Percentage: ${disparityPercent.toFixed(2)}%</span><br>
            <span style="color:${disparityFractionColor}">Disparity as a Fraction: 1/${disparityFraction.toFixed(2)}</span><br>
            <span style="color:${thetaColor}">Parallax Angle (theta): ${theta.toFixed(2)} degrees</span>
        `;
    }

    // Initial calculation
    calculateDisparity();
</script>

</body>
</html>

Key Adjustments:

  1. eyeToProjectionDistance Calculation: Adjusted to be dynamically computed based on the TV screen size, which affects the parallax angle calculation.
  2. Correct Screen Size Interaction: Ensured the parallax angle calculation uses the updated eyeToProjectionDistance when the TV screen size changes.

This update should ensure that changing the TV screen size slider correctly impacts all relevant calculations, including the parallax angle. Test the updated code and let me know if it meets your requirements.

V18 {remark: no interaction yet. Are you sure you changed the code correctly.... -> new code } Let's ensure that all calculations are correctly updated when the TV screen size changes. Specifically, the eyeToProjectionDistance should be recalculated based on the screen size, which in turn should affect the parallax angle calculation. Here's the corrected code with proper interaction:

Key Adjustments:

  1. Convert TV Size to Distance to Screen (eyeToProjectionDistance): Correctly updated the distance based on the TV screen size, which impacts the parallax angle calculation.
  2. Interaction: Ensure that changing the TV screen size slider correctly impacts all relevant calculations.

This update should ensure the TV screen size affects the parallax angle and other calculations correctly. Please test the updated code and let me know if it meets your requirements.

v19 theta formula incorrect in code. asked chatgpt, wy you had it differently... new code

v20. Certainly! Let's add a slider for the viewer distance, initially set to 1.5 times the diagonal of the TV screen. The range for this slider will be from 0.5 to 5 times the diagonal distance in meters. We'll update the parallax angle calculation to use this viewer distance.

Here's the updated code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Stereoscopic Photography Calculator</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        .slider-container {
            margin-bottom: 20px;
        }
        .slider-container label {
            display: block;
            margin-bottom: 5px;
        }
        .slider-container input {
            width: 100%;
        }
        .result {
            margin-top: 20px;
            font-weight: bold;
        }
    </style>
</head>
<body>

<h1>Stereoscopic Photography Calculator</h1>

<div class="slider-container">
    <label for="ia">Interaxial Base (IA) in cm: <span id="iaValue">19</span></label>
    <input type="range" id="ia" min="1" max="100" value="19" step="0.1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="distance">Distance to Subject in meters: <span id="distanceValue">3</span></label>
    <input type="range" id="distance" min="0.0001" max="2" value="0.477" step="0.0001" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="farDistance">Far Distance in meters: <span id="farDistanceValue">10</span></label>
    <input type="range" id="farDistance" min="0.001" max="3" value="1" step="0.0001" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="lens">Lens Focal Length in mm: <span id="lensValue">50</span></label>
    <input type="range" id="lens" min="10" max="800" value="50" step="1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="tvSize">TV Screen Size in inches: <span id="tvSizeValue">52</span></label>
    <input type="range" id="tvSize" min="10" max="100" value="52" step="1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="eyeSeparation">Eye Separation in cm: <span id="eyeSeparationValue">6.4</span></label>
    <input type="range" id="eyeSeparation" min="5.5" max="7.3" value="6.4" step="0.1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="viewerDistance">Viewer Distance to Screen (multiples of diagonal): <span id="viewerDistanceValue">1.5</span></label>
    <input type="range" id="viewerDistance" min="0.5" max="5" value="1.5" step="0.1" oninput="calculateDisparity()">
</div>

<div class="result" id="result"></div>

<script>
    function calculateDisparity() {
        // Get input values
        const ia = parseFloat(document.getElementById('ia').value);
        const distanceLog = parseFloat(document.getElementById('distance').value);
        const farDistanceLog = parseFloat(document.getElementById('farDistance').value);
        const lens = parseFloat(document.getElementById('lens').value);
        const tvSize = parseFloat(document.getElementById('tvSize').value);
        const eyeSeparation = parseFloat(document.getElementById('eyeSeparation').value);
        const viewerDistanceMultiplier = parseFloat(document.getElementById('viewerDistance').value);

        // Convert logarithmic values back to linear scale
        const distance = Math.pow(10, distanceLog);
        const farDistance = Math.pow(10, farDistanceLog);

        // Update displayed values
        document.getElementById('iaValue').innerText = ia;
        document.getElementById('distanceValue').innerText = distance.toFixed(2);
        document.getElementById('farDistanceValue').innerText = farDistance.toFixed(2);
        document.getElementById('lensValue').innerText = lens;
        document.getElementById('tvSizeValue').innerText = tvSize;
        document.getElementById('eyeSeparationValue').innerText = eyeSeparation;
        document.getElementById('viewerDistanceValue').innerText = viewerDistanceMultiplier;

        // Convert TV size to cm
        const diagonal = tvSize * 2.54;
        const screenWidth = Math.sqrt(16 * 16 / (16 * 16 + 9 * 9)) * diagonal;

        // Calculate disparity
        const disparity = (ia * (farDistance - distance)) / (farDistance * distance);

        // Calculate magnification factor based on focal length
        const magnification = lens / 36; // assuming a full-frame sensor with a width of 36 mm

        // Calculate the disparity in cm on the screen
        const disparityCm = disparity * magnification * screenWidth / 100;

        // Calculate disparity percentage
        const disparityPercent = (disparityCm / screenWidth) * 100;

        // Calculate disparity as a fraction
        const disparityFraction = 100 / disparityPercent;

        // Calculate the viewer distance from the screen
        const viewerDistance = viewerDistanceMultiplier * diagonal / 100; // convert cm to meters

        // Calculate parallax angle (theta) using the correct formula
        const theta = 2 * Math.atan((disparityCm / 2) / viewerDistance) * (180 / Math.PI);

        // Determine colors based on conditions
        const thetaColor = Math.abs(theta) > 1.5 ? 'red' : 'black';
        const disparityPercentColor = disparityPercent > 3 ? 'red' : (disparityPercent > 2 ? 'orange' : 'black');
        const disparityCmColor = disparityCm > eyeSeparation && disparityPercentColor === 'red' ? 'red' : (disparityCm > eyeSeparation ? 'orange' : 'black');
        const disparityFractionColor = disparityFraction < 20 ? 'orange' : 'black';

        // Display the results with color coding
        document.getElementById('result').innerHTML = `
            <span style="color:${disparityCmColor}">Disparity on Screen: ${disparityCm.toFixed(2)} cm</span><br>
            <span style="color:${disparityPercentColor}">Disparity Percentage: ${disparityPercent.toFixed(2)}%</span><br>
            <span style="color:${disparityFractionColor}">Disparity as a Fraction: 1/${disparityFraction.toFixed(2)}</span><br>
            <span style="color:${thetaColor}">Parallax Angle (theta): ${theta.toFixed(2)} degrees</span>
        `;
    }

    // Initial calculation
    calculateDisparity();
</script>

</body>
</html>

This updated code includes a new slider for the viewer distance, initially set to 1.5 times the diagonal of the TV screen, and it allows you to adjust this distance between 0.5 and 5 times the diagonal. The theta calculation now correctly uses this viewer distance.

Please test this updated code to see if it meets your requirements.

Understood. Let's revert to the previous calculation for theta and only change the distance variable to be in meters from the input. Additionally, we'll display the viewer distance in meters and the ratio (multiplier) in the list.

Here's the corrected code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Stereoscopic Photography Calculator</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        .slider-container {
            margin-bottom: 20px;
        }
        .slider-container label {
            display: block;
            margin-bottom: 5px;
        }
        .slider-container input {
            width: 100%;
        }
        .result {
            margin-top: 20px;
            font-weight: bold;
        }
    </style>
</head>
<body>

<h1>Stereoscopic Photography Calculator</h1>

<div class="slider-container">
    <label for="ia">Interaxial Base (IA) in cm: <span id="iaValue">19</span></label>
    <input type="range" id="ia" min="1" max="100" value="19" step="0.1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="distance">Distance to Subject in meters: <span id="distanceValue">3</span></label>
    <input type="range" id="distance" min="0.0001" max="2" value="0.477" step="0.0001" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="farDistance">Far Distance in meters: <span id="farDistanceValue">10</span></label>
    <input type="range" id="farDistance" min="0.001" max="3" value="1" step="0.0001" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="lens">Lens Focal Length in mm: <span id="lensValue">50</span></label>
    <input type="range" id="lens" min="10" max="800" value="50" step="1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="tvSize">TV Screen Size in inches: <span id="tvSizeValue">52</span></label>
    <input type="range" id="tvSize" min="10" max="100" value="52" step="1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="eyeSeparation">Eye Separation in cm: <span id="eyeSeparationValue">6.4</span></label>
    <input type="range" id="eyeSeparation" min="5.5" max="7.3" value="6.4" step="0.1" oninput="calculateDisparity()">
</div>

<div class="slider-container">
    <label for="viewerDistance">Viewer Distance to Screen in meters: <span id="viewerDistanceValue">1.5</span> (Multiplier: <span id="viewerDistanceMultiplier">1.5</span>)</label>
    <input type="range" id="viewerDistance" min="0.5" max="5" value="1.5" step="0.1" oninput="calculateDisparity()">
</div>

<div class="result" id="result"></div>

<script>
    function calculateDisparity() {
        // Get input values
        const ia = parseFloat(document.getElementById('ia').value);
        const distanceLog = parseFloat(document.getElementById('distance').value);
        const farDistanceLog = parseFloat(document.getElementById('farDistance').value);
        const lens = parseFloat(document.getElementById('lens').value);
        const tvSize = parseFloat(document.getElementById('tvSize').value);
        const eyeSeparation = parseFloat(document.getElementById('eyeSeparation').value);
        const viewerDistanceMultiplier = parseFloat(document.getElementById('viewerDistance').value);

        // Convert logarithmic values back to linear scale
        const distance = Math.pow(10, distanceLog);
        const farDistance = Math.pow(10, farDistanceLog);

        // Convert TV size to cm
        const diagonal = tvSize * 2.54;
        const screenWidth = Math.sqrt(16 * 16 / (16 * 16 + 9 * 9)) * diagonal;

        // Calculate the viewer distance in meters
        const viewerDistance = viewerDistanceMultiplier * diagonal / 100; // convert cm to meters

        // Update displayed values
        document.getElementById('iaValue').innerText = ia;
        document.getElementById('distanceValue').innerText = distance.toFixed(2);
        document.getElementById('farDistanceValue').innerText = farDistance.toFixed(2);
        document.getElementById('lensValue').innerText = lens;
        document.getElementById('tvSizeValue').innerText = tvSize;
        document.getElementById('eyeSeparationValue').innerText = eyeSeparation;
        document.getElementById('viewerDistanceValue').innerText = viewerDistance.toFixed(2);
        document.getElementById('viewerDistanceMultiplier').innerText = viewerDistanceMultiplier;

        // Calculate disparity
        const disparity = (ia * (farDistance - distance)) / (farDistance * distance);

        // Calculate magnification factor based on focal length
        const magnification = lens / 36; // assuming a full-frame sensor with a width of 36 mm

        // Calculate the disparity in cm on the screen
        const disparityCm = disparity * magnification * screenWidth / 100;

        // Calculate disparity percentage
        const disparityPercent = (disparityCm / screenWidth) * 100;

        // Calculate disparity as a fraction
        const disparityFraction = 100 / disparityPercent;

        // Calculate parallax angle (theta) using the correct formula
        const theta = 2 * Math.atan((disparityCm / 2) / viewerDistance) * (180 / Math.PI);

        // Determine colors based on conditions
        const thetaColor = Math.abs(theta) > 1.5 ? 'red' : 'black';
        const disparityPercentColor = disparityPercent > 3 ? 'red' : (disparityPercent > 2 ? 'orange' : 'black');
        const disparityCmColor = disparityCm > eyeSeparation && disparityPercentColor === 'red' ? 'red' : (disparityCm > eyeSeparation ? 'orange' : 'black');
        const disparityFractionColor = disparityFraction < 20 ? 'orange' : 'black';

        // Display the results with color coding
        document.getElementById('result').innerHTML = `
            <span style="color:${disparityCmColor}">Disparity on Screen: ${disparityCm.toFixed(2)} cm</span><br>
            <span style="color:${disparityPercentColor}">Disparity Percentage: ${disparityPercent.toFixed(2)}%</span><br>
            <span style="color:${disparityFractionColor}">Disparity as a Fraction: 1/${disparityFraction.toFixed(2)}</span><br>
            <span style="color:${thetaColor}">Parallax Angle (theta): ${theta.toFixed(2)} degrees</span><br>
            Viewer Distance: ${viewerDistance.toFixed(2)} meters (Multiplier: ${viewerDistanceMultiplier})
        `;
    }

    // Initial calculation
    calculateDisparity();
</script>

</body>
</html>

This updated code includes:

  • A slider for viewer distance in meters, initially set to 1.5 times the diagonal of the TV screen.
  • The correct formula for theta using this viewer distance.
  • Display of viewer distance in meters and the ratio (multiplier).

Please test this code to see if it meets your requirements.

v22.

This version:

  • Correctly converts the viewer distance to centimeters before using it in calculations.
  • Includes the version number (22) and the current date and time in the metadata tags.
  • Calculates the viewer distance in centimeters and displays it in the results.

About

CHATGTP generator code for stereoscopic side by side rig stereo 3d photographu

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages