POV-Ray : Newsgroups : povray.advanced-users : Seeking complex prism advice : Re: Seeking complex prism advice Server Time
1 Dec 2021 17:05:37 EST (-0500)
  Re: Seeking complex prism advice  
From: William F Pokorny
Date: 6 Oct 2019 12:47:49
Message: <5d9a1ab5$1@news.povray.org>
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.


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.