Thread Subject: Lighting help!

Subject: Lighting help!

From: Husam Aldahiyat

Date: 16 Aug, 2009 07:26:02

Message: 1 of 4

Hello,

I have a 2D patch (rectangle). I want to create a line of light that horizontally crosses it in the middle.

How can I do this!? I tried playing with the position property of light() but it's not working :(

Subject: Lighting help!

From: Husam Aldahiyat

Date: 16 Aug, 2009 08:05:20

Message: 2 of 4

I did something but it's half-baked. Any suggestions?

a = [ 0 0 0
0.75 0 0
0.75 0.2 0
0 0.2 0
0 0 0.15
0.75 0 0.15
0.75 0.2 0.15
0 0.2 0.15].*10;

b=[1 2 6 5;2 3 7 6;3 4 8 7;4 1 5 8;1 2 3 4;5 6 7 8];

lp=patch('vertices',a,'faces',b,'edgecolor','k','facecolor',[.24 .24 .24]+.1,'linewidth',2);

hold on

for k=-.5:.1/2:.5

r = [.75/2+k .1 .195].*10;
light('Position',r,'style','local')

end
axis([-1 1 -1 1 -.5 .5].*10)

lighting phong

Subject: Lighting help!

From: Husam Aldahiyat

Date: 16 Aug, 2009 10:04:02

Message: 3 of 4

I'll rephrase my question.

I need to create one ray of light to cross a rectangular object.

Subject: Lighting help!

From: Husam Aldahiyat

Date: 18 Aug, 2009 06:25:20

Message: 4 of 4

Here is my newest effort.

close gcf
[X,Y,Z] = cylinder([5,5],140);
s = surf(X,Y,Z.*1);

shading interp

axis off

set(gcf,'color','w')
rotate(s,[1,0,0],90)
rotate(s,[0,1,0],90)

a=zeros(255,3);
a(:,2)=transpose(linspace(.5,.7,255));

colormap(a);

r = [7,-.5,1];

light('position',r,'style','loc')

r = [7,.5,1];

light('position',r,'style','loc')

rotate3d

view(90,0)
axis square

Anything better?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
light Husam Aldahiyat 16 Aug, 2009 03:29:03
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com