POV-Ray : Newsgroups : povray.advanced-users : Seeking complex prism advice : Re: Seeking complex prism advice Server Time30 May 2024 08:53:46 EDT (-0400)
 From: Alain Martel Date: 10 Oct 2019 14:42:18 Message: <5d9f7b8a\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#5d9f7b8a%241%40news.povray.org",
"dateCreated": "2019-10-10T18:42:18+00:00",
"datePublished": "2019-10-10T18:42:18+00:00",
"author": {
"@type": "Person",
"name": "Alain Martel"
}
}
Le 2019-10-09 à 13:57, William F Pokorny a écrit :
> On 10/8/19 2:42 PM, Bald Eagle wrote:
>>
>>
>> Right, but how do I roll up all of the linear and curved sections into
>> a single
>> PRISM declaration?
>
> The prism and lathe bezier spline can represent curved portions,
> discontinuities in slope between curved portions and linear segments in
> a single spline. Borrowing from the circle within a circle prism I
> posted in answer to someone question a month or two ago:
>
> #declare Cheese = srgb <1,0.65098,0>;
> #declare Prism00 = prism {
>      bezier_spline
>      linear_sweep
>      -0.2, 0.2, 28,
>      <1,0>,<1,0.552285>,<0.552285,1>,<0,1>
>      <0,1>,<-0.552285,1>,<-1,0.552285>,<-1,0>
>      <-1,0>,<-1,-0.552285>,<-0.552285,-1>,<0,-1>
>      <0,-1>,<0.552285,-1>,<1,-0.552285>,<1,0>
>      <0.5,0>,<0.5,0.276143>,<0.276143,0.5>,<0,0.5>
>      <0,0.5>,<0,0.5-(0.5*(1/3))>,<0,0.5-(0.5*(2/3))>,<0,0> // a macro?
>      <0,0>,<0+(0.5*(1/3)),0>,<0+(0.5*(2/3)),0>,<0.5,0>     // a macro?
>      pigment { color Cheese }
> }
>
> The last two bezier segments are linear; making the inner shape a slice
> of pie so to speak. While working with an overall bezier spline you
> could insert your linear parts with a macro where you'd specify only the
> end points for the segment.
>
> That said, I'm with you on your brainstorming in this direction(1) and
> spline support could be better.
>
> My belief is your particular proposal for supporting different stand
> alone spline segment types to represent an overall prism shape won't
> fly. In the POV-Ray code there would be too much context switching and
> fuzziness as to what segments together constitute an enclosed region /
> loop for it to be practical.
>
>>
>> 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.
>>
>
> The SDL trace() command was intended to be such a thing. Mostly, I see
> people using trace() to put things on terrain or to grow things with
> some avoidance of what objects are around. Attempting to create triangle
> meshes from POV-Ray primitives another common use.
>
> I see less use of trace() where people have created jig (tool) objects
> for use with trace in creating other surfaces, splines and objects. It's
> a different way of thinking about creating flexible models /
> representations(1) and one I don't reach for enough.
>
>>
>> Again, just brainstorming and illustrating the idea for rapid
>> construction of an
>> "extruded" type shape.
>>
>
> Mostly for others - as I think you know, Inkscape is one tool that has
> image -> POV-Ray prism(bezier) capability, but you have to bring it up
> and use an interface. Years back the image -> prism export worked, but
> was 'verbose' with respect to minimal bezier spline representations for
> any given input image.
>
> Bill P.
>
> (1) I saw your suggestions for point lists and point list manipulation.
> Good ideas I think which would help with 'trace() based jig methods'
> among other things.

When using a beszer spline and I want a straight segment, I often do this :

...,PointA, PointB, PointA, PointB,...

That is, I use the end points of that segment as control points.
Why ? Simply because the length of the vector from a point and it's
control point don't matter in this case.
```