[MATHS] Find equation for a surface between to lines.

Hi
This is a maths question, so let me know if I should have posted it somewhere else.
Since I've never really studied multi variable calculus myself I need some help with this problem.

I'm programming some LEDs and I want their colour to change depending on the LEDs position and the time of day. My problem is that I don't know exactly how to calculate these colours... I've generalised my problem below.

Is there an easy way to find the function z = F(x,y) for a surface in 3D-space, that spans between two know functions z = f1(x), f2(x) in 2D-space, with a set distance between f1 and f2?

If anyone is familiar with AutoCAD, I'm basically looking for the LOFT function.

Is there an easy way to find the function z = F(x,y) for a surface in 3D-space, that spans between two know functions z = f1(x), f2(x) in 2D-space, with a set distance between f1 and f2?

If you have just two curves, between a point x % along curve 1 and x % along curve 2 will be a line. No need to get too fancy imagining a curve between the points.

What are the two curves? Time of day isn't a curve. It's a line. It increases linearly.

LED position doesn't feel like a curve, either, unless the LEDs are not spaced evenly.

You can't have a surface in 2D space.

So, I'm really confused. Perhaps a picture is in order...

I attached two pictures. The first is the two functions f1,2(x) and the second shows the surface between these functions that I'm after.

You can't have a surface in 2D space.

Of course you can. But it would be flat. That's why I said in my OP that I'm after a surface in 3D space.

the second shows the surface between these functions that I'm after.

If you increase the density of the iso-parametric curves, you'll see that the "surface" is linear between the two curves.

If you evaluate one curve at 0.3, you get a 3D point. If you evaluate the other curve at the same parameter value, you get another 3D point. Define a line between the two points and it will lie on the surface at every point along the line.

Which curve represents time of day? Which represents LED position?

PaulS:
Which curve represents time of day? Which represents LED position?

x is LED position and y is time.

But that's thanks! That's the simple nudge in the right direction I needed.

So the surface F(x,y) is the set of lines between f1(x) and f2(x). ==> F(x,y) = (f1(x) - f2(x)) / D, where D is the distance between f1 and f2 in the direction of y.

Stack Exchange: how to find a surface from two lines

Your lines must intersect to determine a plane; skew lines don't define a plane. But if they do intersect, then produce 3 non-collinear points (x1,y1,z1)
, (x2,y2,z2), (x3,y3,z3). In general, you will have a planar equation of the form z=ax+by+c (except for the special case of a vertical plane). Your coefficients are the 3 unknowns, and you have three points. Using these 3 points, you can solve for your coefficients and get an equation for your plane.

Johandea:
Is there an easy way to find the function z = F(x,y) for a surface in 3D-space, that spans between two know functions z = f1(x), f2(x) in 2D-space, with a set distance 'd' between f1 and f2? [/b]

If you calculate the two functions f1(x) and f2(x) for a given x you then have two points z1,x and z2,x and you want 'em y apart.

At y=0, z = z1
at y= d, z = z2

and halfway between y= d/2 = (z1 - z2)/2 + z1

or something like that :slight_smile:

It's not determining the function, but you can iterate over x to find your LED 'heights'

Yours,
TonyWilk

PaulS:
You can't have a surface in 2D space.

Sure you can... (you can’t have a volume)

For example this describes the unit square: x >= 0 and x <= 1 And y >= 0 and y <= 1
or the inequation x[sup]2[/sup]+y[sup]2[/sup] <= 1 is the unit disc
(if XY axes are linear and Cartesian axes of a direct orthonormed system)

Here OP is in 3D space

There are an infinite number of surfaces in 3D space joining OP’s curves.

One way to describe the curves is to have a param t varying between 0 and 1. Say curve1 is defined by the F1 function, with an interval of definition [x1s, x1e], and say curve2 is defined by F2 in interval of definition [x2s, x2e] then you can “walk” along the curves by doing

f1(t) = F1(x1s + t.(x1e - x1s))
f2(t) = F2(x2s + t.(x2e - x2s))

Now you have one unique t param in a simple [0,1] interval defining Z1 through f1. (same for Z2)

As you know points for a given curve are all in a plane with Y being constant, points for the curve1 in 3D space are defined with t in [0,1]

X1 = x1s + t.(x1e - x1s)
Y1 = a constant (0 for example)
Z1 = f1(t)

Same for X2,Y2,Z2 where Y2 would be d+Y1 constant (so just d if you picked 0), d being the distance between your two curves’ planes

Now for a given t in [0,1] you have two points in 3D space: (X1,Y1,Z1) on Curve1 and (X2,Y2,Z2) on Curve2

You can link them with whatever curve function you want, easiest one being a straight line as you drew.

For that it’s easy you just need another param k varying between [0,1] and the line between (X1,Y1,Z1) and (X2,Y2,Z2) is the set of points (X3,Y3,Z3) (depending on k)
X3 = X1 + k(X2-X1)
Y3 = Y1 + k(Y2-Y1)
Z3 = Z1 + k(Z2-Z1)

So now you have Your surface as a function S(t,k) defined for each of the three axis, with t and k varying between 0 and 1

Note you could imagine other constructs like a Bézier curve between the two extremes points with control points being also calculated smartly (possibly based on the first or second derivative of your functions to take into account speed or acceleration along the curve for example).

There are an infinite number of surfaces in 3D space joining OP's curves.

There are in infinite number that could possibly pass through both curves. When there are only two curves, the simplest surface will be created. That connects each point on one curve with the corresponding point on the other curve with a straight line.

The surface exists in 3D space. It does not make sense to talk of surfaces in 2D.

PaulS:
The surface exists in 3D space. It does not make sense to talk of surfaces in 2D.

I mathematically disagree. A surface is a two-dimensional space by definition. A point on a surface may move in two directions (has two degrees of freedom).

more in Wikipedia

In 2D, a portion of a plane is a surface that you can mathematically represent. As mentioned above x[sup]2[/sup]+y[sup]2[/sup] <= 1 is the equation of a disk - which is a surface in a 2D space (or 3D / nD space if you set other coordinates to a constant)

In mathematics, a surface is a generalization of a plane which needs not be flat, that is, the curvature is not necessarily zero. This is analogous to a curve generalizing a straight line.

When there are only two curves, the simplest surface will be created

that's arbitrary - one of the many possibilities indeed including question around do you "close" the surface (ie it encompasses a defined volume) or leave it open ?

That connects each point on one curve with the corresponding point on the other curve with a straight line

Needs to define mathematically what "corresponding" means - hence the introduction of the t varying in [0,1] to map the intervals in my discussion above.

The OP case is specific given his "curves" are actually constrained to a plane and OP wants the 3D aspect by connecting the curves.