Project img on X-Y surface to a cylinder placed in center....

Click For Summary

Discussion Overview

The discussion revolves around the problem of projecting an image onto a cylindrical mirror and determining how the reflected image appears. Participants explore the mathematical and computational aspects of simulating this projection, including ray tracing and reflection calculations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant describes a problem involving an image (IMG_A) placed in the X-Y plane and a cylindrical mirror that produces a deformed image (IMG_B), seeking assistance with the necessary equations for accurate projection.
  • Another participant emphasizes the importance of considering the viewer's perspective and the direction of light when determining how the image is reflected in the mirror.
  • A participant suggests that the problem can be framed as a ray-tracing issue, proposing the use of parametric coordinates to model the interaction between rays, the cylinder, and the image plane.
  • Further elaboration includes defining the ray's starting point and direction, and the mathematical representation of the cylinder and the image plane for intersection calculations.
  • Another contribution highlights the pixel-by-pixel approach for determining the color of each pixel based on where the reflected ray hits the image plane, suggesting a method to account for light intensity based on distance.

Areas of Agreement / Disagreement

Participants generally agree on the need to consider the viewer's perspective and the mechanics of ray tracing, but there are multiple approaches and methods proposed for solving the problem, indicating that the discussion remains unresolved.

Contextual Notes

Participants have not reached consensus on the specific equations or methods to be used for the projection and reflection calculations, and there are unresolved assumptions regarding the viewing angle and light direction.

Amirps
Messages
2
Reaction score
0
Hi ,
I came across a problem ,I've search a lot but couldn't exactly find the solution.
here is my problem:
suppose there is an image ( I call it IMG_A),place IMG_A in the X-Y plane , put a mirror cylinder at the center of IMG_A. what we see in the cylinder mirror is a deform image (I call it IMG_B) . what I try to achieve by this program is IMG_B.
I've already write a piece of code in Matlab using this equation

for i=1:IMG_A_Width
for j=1:IMG_A_Height
cy(i,j,1)=cyradius*cos(i*(2*pi/IMG_A_Width)) ;%cylinder X
cy(i,j,2)=cyradius*(sin(i*(2*pi/IMG_A_Width)));%cylinder Y
cy(i,j,3)=j*(cyHeight/IMG_A_Height) ;%cylinder Z
cy(i,j,4)=IMG_A(i,j);%cylinder image
end
end
but this is not exactly what I want ,this program just wrap the IMG_A around the cylinder. in other words the warping is in the horizontal direction.would you please be kind enough helping me to understand the equation I need to write this program?
 
Physics news on Phys.org
Before you start writing code: how do you look into the mirror? That will influence the picture you see.
Try to solve the problem for some random viewing direction, by working against the direction of the light: where does your viewing direction hit the mirror? Where is the reflected viewing direction, and where does it hit the xy plane?
 
Fou
mfb said:
Before you start writing code: how do you look into the mirror? That will influence the picture you see.
Try to solve the problem for some random viewing direction, by working against the direction of the light: where does your viewing direction hit the mirror? Where is the reflected viewing direction, and where does it hit the xy plane?
fortunately the viewing angel is constant and it is 30 degrees.
[the light will travel at the angel of 30 degrees from XY plane and hit the mirror ]
 
That sounds like a ray-tracing problem in computer graphics.

You want to think in terms of eye-rays and parametric coordinates with planes (your image) and cylinders (the deformed image)
You have the starting point (Vs) for each ray (where the eye is) and the direction (unit vector Vd) where that ray goes.
The first place that rays hits anything gives a parametric coordinate u. Each point and vector is three components (x,y,z)

R = Vs + u.Vd

A plane is defined as P = A.x + B.y + C.z + D = 0

A cylinder is defined as C = A.x^2 + B.y^2

You want to intersect your ray R with the cylinder, calculate the reflection vector of that ray, and where the reflected vector hits the plane.

Here's some reference material:
http://www.cl.cam.ac.uk/teaching/1999/AGraphHCI/SMAG/node2.html
 
  • Like
Likes   Reactions: Amirps and mfb
I would just add to #4 that a natural way to do this is pixel by pixel. For each pixel, you want to know how to color it. Calculating where the ray from the eye through the center of the pixel, after being reflected by the cylinder, hits the plane — if it hits the plane at all — will determine what color the pixel should be. For more realism you might want to decrease the intensity of that color in proportion to the squared length of the entire light ray (i.e., from the eye to the cylinder to the plane).
 
  • Like
Likes   Reactions: Amirps

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
Replies
13
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
4
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K