POV-Ray : Newsgroups : povray.bugreports : slope problem : Re: slope problem Server Time17 Apr 2024 06:02:22 EDT (-0400)
 Re: slope problem
 From: clipka Date: 31 Jan 2019 13:44:23 Message: <5c534207\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#5c534207%241%40news.povray.org",
"dateCreated": "2019-01-31T18:44:23+00:00",
"datePublished": "2019-01-31T18:44:23+00:00",
"author": {
"@type": "Person",
"name": "clipka"
}
}
Am 31.01.2019 um 19:21 schrieb jr:
> hi,
>
>> clipka <ano### [at] anonymousorg> wrote:
>>> Well, that's pretty much what I see them doing.
>>
>> given that the "end" is a sphere, I would have expected the cylinders to
>> terminate in a curved shape, equidistant.  but I see a right angle.
>
> ouch, sorry, I see now.  need to arrange the other spheres spherically to get
> the equidistant ends.
>
>
>>> Of course since the distance changes as the angle changes, so do the
>>> gaps (because you computed each of them to be 5% of the total distance,
>>> from sphere center to start of cylinder).
>
> so how can one "fudge" it, ie make the cylinders end a predictable distance from
> each sphere?

Preusuming you have the "central" sphere at P1, and a "remote" sphere at
P2, and you want a distance of D between sphere centers and the cylinder
ends, then

V = P2 - P1

is the vector describing direction _and_ distance of the cylinder you want;

Vn = vnormalize(Vn)

is the unit-length directionof that vector; and

Q1 = P1 + Vn*D
Q2 = P2 - Vn*D

are the points you want the cylinder ends to be at.
```