POV-Ray : Newsgroups : povray.advanced-users : Seeking complex prism advice : Re: Seeking complex prism advice Server Time28 May 2024 10:39:57 EDT (-0400)
 From: William F Pokorny Date: 6 Oct 2019 12:47:49 Message: <5d9a1ab5\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#5d9a1ab5%241%40news.povray.org",
"dateCreated": "2019-10-06T16:47:49+00:00",
"datePublished": "2019-10-06T16:47:49+00:00",
"author": {
"@type": "Person",
"name": "William F Pokorny"
}
}
On 10/5/19 4:33 PM, Bald Eagle wrote:
>
> Playing with creating some complex CSG parts in SDL, and wondering what the best
> approach is.
>
> My initial instinct is to use a prism - but I have a mixture of straight lines,
> right-angle or 180-degree circular arcs, and radiused bends.
> For simple splines, I could just concatenate them together, but I can't switch
> between bezier, cubic, and linear splines midway through a prism definition.
>
> But that would be a NICE feature.   ;)
>
> If I use a bezier or cubic spline for the prism, is there a trick to
> manipulating the control points to switch between curved and "linear" domains?

Perhaps not understanding all you want, but a significant benefit of
bezier curves is that the control points for each segment are in the
middle and the end points are what they are.

To get a 'linear' bezier segment(1) make the control points linear with
the end points and space them equidistantly to the end points and each
other. In other words, treat linear bezier segments as 3 equal length
linear segments. (I'm pretty sure somebody wrote a linear to bezier
spline macro - with optional corner rounding I think - but I don't
remember where to find it at the moment...)

---
Aside: Yep, more extensive and more centralized spline support would be
cool. Today each primitive has its own collection of supported types.
See too hgpovray38 for an extended set of spline{} types.

Aside 2: For my own tool box I've a thought maybe a B-Spline
(sphere_sweep's b_spline), or perhaps Natural?, to all our other spline
types converter would be useful. Dump a collection of points (perhaps
pre-tweaked) as a spline type to get a c2/g2 continuity curve. Then
convert from that curve back to spline types our primitives support with
a more 'refined' higher point density(2) curve. If you run across
something like this as a standalone macro or program, please let me
know(3).

- I've learned some about splines in the past years especially, but
three's no doubt I'm still a hack. :-)

Bill P.

(1) - Yep not perfect given there will be numerical fuzziness, but that
somewhat true with all the spline types.

(2) - Shorter internal curve segments often help with numerical issues -
but how to generally get to improved representations..?

(3) Inkscape has inbuilt smoothing, but I've never dug into the code to
see if it's something I can easily use in a stand alone function/tool.
```