POV-Ray : Newsgroups : povray.advanced-users : Stumped by desk lamp trig equation : Re: Stumped by desk lamp trig equation Server Time28 Jan 2023 14:40:31 EST (-0500)
 Re: Stumped by desk lamp trig equation
 From: Cousin Ricky Date: 15 Aug 2022 23:33:44 Message: <62fb1018\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#62fb1018%241%40news.povray.org",
"headline": "Re: Stumped by desk lamp trig equation",
"dateCreated": "2022-08-16T03:33:44+00:00",
"datePublished": "2022-08-16T03:33:44+00:00",
"author": {
"@type": "Person",
"name": "Cousin Ricky"
}
}
On 2022-08-15 11:04 (-4), Le_Forgeron wrote:
> Le 07/08/2022 à 19:54, Cousin Ricky a écrit :
>> On 2022-08-07 10:59 (-4), kurtz le pirate wrote:
>>>
>>> Let sin(x) = T and cos(x) = U, the equation becomes :
>>> (g - c/x)T + hU - a = 0
>>>
>>> [snip]
>>
>> I'll take a look at it.  Thanks!
>
> If you like complexity, remember that T²+U² = 1,
> so U is actually sqrt(1 - T²), reducing the number of variables.

Actually, I already went through that identity on the way to getting the
equation in the OP.  The equation I started with was much more
complicated.  I found that reapplying this identity seemed to take the
equation in a direction that I didn't see as productive, and per Kurtz's
reply above, would have been futile anyway.

> (of course for your setting T & U > 0)

Only for this example.  I had broken down the flexing problem into three
different scenarios depending on how much the lamp was flexed or
extended, but when I worked through the cases separately, they all came
to the exact same equation.  So for my generalized problem, this
restriction no longer applies.

> Back to original problem, why is the c part a circle ?
>
> If it is some flexible part, we are back to the evaluation of the length
> of a sphere sweep/spline for which there is no formulae, even when it's
> just a part of an ellipse.

That is precisely why I am keeping the curve circular.  If you want an
arbitrarily curved neck, I believe Bald Eagle was working on that.  ;-)

> Do you really need a fixed length c part ?

Yes, that is part of how I'm defining the lamp.

> Can the right angle of the picture (base of light bulb or so) be on the
> y axis, with the c segment describing some S-like shape (or
> interrogation dot shape )

The inputs to my macro are simply the position of the lamp and where it
is pointing.  The shape of the neck is not an input I am planning to
include at this time, so I'm just using the most obvious curve to get
the job done.

> Why do I want that point on y axis ? Because it is probably better for
> the weight of the lamp to be correctly held.

I was just concerned with simplifying the math.  Locating the origin at
the bottom of the curve made it easy for me to develop an equation
describing the problem.  Whatever translations need to be made will be
trivial *after* I figure out the angle and radius of curvature.

> Which make me wonder why there is a straight part after c, but not below
> it.

There is a straight part above c because the hood of the lamp is rigid.
The lamp does have a straight part below c, but I have not shown it
because it can be implemented with a simple translation.  There is no
need to involve it in the flexing equation.

Anyhow, as I showed in p.b.i, I did solve the problem.  Taking Kurtz's
word that there is no analytic solution, I wrote a solver, and it works
beautifully.
```