15 views (last 30 days)

Hello,

I found numerous similar questions to this one but none gave the answer I need.

As the title says, I am trying to find cct of LEDs using the algorithm presented here (slides 11-14). The problem I am having is finding the orthogonal projection onto the black-body line. I do not know how to program it. The graph with the LEDs(red) is shown below.

Is it even possible to find cct of every LED in these positions?

Thank you

John D'Errico
on 19 Mar 2020

Edited: John D'Errico
on 19 Mar 2020

I don't have the data you show for those curves. However, an orthogonal projection of a point onto a curve in space is not that difficult. Well, it is possible to do, at least. ;-)

The point is that an orthogonal projection for a point onto a curve merely requires finding the point on said curve that lies at a minimal distance. To project one curve onto another is merely the act of doing the above many times. In fact, I've posted a simple utility on the file exchange which does exactly that for you. It will take me more time to create some data for this, than it will to show how to use the utility though. Oh well.

So, first a couple of curves. Lets see, I'll just create two elliptical arcs in the plane.

t1 = linspace(-.5,2,30)';

xy1 = [cos(t1),sin(t1)]*[-1 2;-2 1] + [.3 .3];

plot(xy1(:,1),xy1(:,2),'ko-')

axis equal

hold on

t2 = linspace(0.75,2.75,100)';

xy2 = [cos(t2),sin(t2)]*.6 + [-1 1.6];

plot(xy2(:,1),xy2(:,2),'r.')

grid on

Yes, easier to hack up some data than it is to actually find that black body curve online, and I'm just too lazy to think today.

Now, for any point on the red line, I'll project it onto the curve in black. The orthogonal line of projection will be in blue here.

[xyproj,distance] = distance2curve(xy1,xy2,'spline');

plot([xy2(:,1),xyproj(:,1)]',[xy2(:,2),xyproj(:,2)]','b-')

As you can see, there can easily be a discontinuous jump for that projection, but what can you expect given two nonlinear arcs? I doubt you care to know what the distance for that projection was, but the second output argument tells you that information.

A spline interpolant was used for the black curve, so I solve the equations to find the actual minimal distance to a curved arc of a spline in the code. Not that difficult, but you need to understand splines.

Find distance2curve on the file exchange for free download, here:

John D'Errico
on 20 Mar 2020

Then you needed to be far more clear about what you wanted. In fact, your question is still not remotely clear.

The closest point to a curved line will have a projection that is ALWAYS orthognal to the curved line. If it was not, then there would be another point on the curved line that was closer. Do I need to prove this statement? As such, if that is your only requirement, then distance2curve does exactly what you want. The only time there is an issue is when the curve to be projected onto is limited in extent, so it ends at some point. Then the closest point on the curve may merely be an end point. And of course, if the curve itself is not differentiable, then if it has a cusp on it somewhere that will again be a problem. However, I explicitly told you to use the spline option for distance2curve.

Be VERY careful, because if you do not scale the axes properly to have equal units, then even two lines that intersect at right angles will not appear to do so. Do I need to prove that statement too? I hope not.

So what is your question? Be clear.

plot([0 0;1 1],[1 0;0 1],'-')

axis([0 1 -1 2])

Do those lines look orthogonal to you? I hope not, yet they are provably so. Differential axis scaling will cause this.

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.