POV-Ray : Newsgroups : povray.advanced-users : Seeking complex prism advice : Re: Seeking complex prism advice Server Time28 May 2024 09:52:06 EDT (-0400)
 Re: Seeking complex prism advice
 From: Bald Eagle Date: 8 Oct 2019 14:45:00 Message:
William F Pokorny <ano### [at] anonymousorg> wrote:

> 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...)

Right, but how do I roll up all of the linear and curved sections into a single
PRISM declaration?
To my knowledge, that is not currently possible.
It may be possible to abruptly switch between a pseudo-linear segment and a
pseudo-semicircular segment within the same spline with some very clever math,
but that's akin to trying to apply Thistlethwaite's algorithm to solving the
Rubik's cube.

So what I was envisioning was a prism object where you could do something like:

#declare DrawnComplexPrism =
prism {
linear
<vector[s]>,
cubic
<vector[s]>,
linear
<vector[s]>,
circular // would be nice to have a way to do this, to get true circular arcs
<vector[s]>,
linear
<vector[s]>
}

I have a few more parts to model, and I'll probably use some other methods to
hammer them out so that I have the code examples, but I just wanted to clarify
the idea.

Clearly there would issues with determining where the segments intersected,
since the list of vectors wouldn't necessarily explicitly define those.
POV-Ray solves for roots, perhaps future [experimental] versions could have
intersection solvers.

For instance, let's draw a right triangle, with a circle centered at the vertex
of the 90 degree angle.  The perpendicular lines would represent - not absolute
line segments - but rays pointing toward the circular locus the user intends to
intersect.

The prism would then look like a triangle with a semi-circular bulge at one
corner.

I'm not sure what sorts of pathological cases might arise, but perhaps they can
be handled with error messages, allowing detached prism subsegments to coexist
(imagine if the circle and triangle did NOT overlap), and making use of of the
'inverse' keyword to switch between a default choice of one possible option vs
the remaining option (picture a circle overlapping TWO vertices of a narrow
triangle....

Again, just brainstorming and illustrating the idea for rapid construction of an
"extruded" type shape.