|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In the scene below is spline is defined and then put into an array. When
it is pulled out of the array it always is a linear spline, instead of
the original 'curvy' spline. This used not to be the case as one of the
meshmaker macro's depends on doing this since 3.5.
I cannot trace back where this behaviour originated as I only have 3.8
alpha's and beta's here and all show this behaviour. (running win10)
---%<------%<------%<---
#version 3.8;
global_settings {assumed_gamma 1.0}
camera {location <0,3.5,-12> look_at <0,1.5,0> angle 40}
light_source {<500,500,-500> rgb <0.8,0.9,1>}
#declare A1=spline {
cubic_spline
-0.5, < 1,-1, 0>
0.0, < 1, 0, 0>
0.5, < 2, 1, 0>
1.0, < 1, 2, 0>
1.5, < 1, 3, 0>
}
#declare An=array[1]{
spline{A1},
}
#declare M=500;
union {
#declare Spl=spline{An[0]};
#for(I,0,50)
sphere {Spl(I/50), 0.04 no_shadow pigment {rgb 1}}
#end
}
---%<------%<------%<---
--
https://ingoogni.nl
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 7/15/21 5:54 AM, ingo wrote:
> In the scene below is spline is defined and then put into an array. When
> it is pulled out of the array it always is a linear spline, instead of
> the original 'curvy' spline. This used not to be the case as one of the
> meshmaker macro's depends on doing this since 3.5.
>
> I cannot trace back where this behaviour originated as I only have 3.8
> alpha's and beta's here and all show this behaviour. (running win10)
>
>
> ---%<------%<------%<---
> #version 3.8;
>
> global_settings {assumed_gamma 1.0}
> camera {location <0,3.5,-12> look_at <0,1.5,0> angle 40}
> light_source {<500,500,-500> rgb <0.8,0.9,1>}
>
> #declare A1=spline {
> cubic_spline
> -0.5, < 1,-1, 0>
> 0.0, < 1, 0, 0>
> 0.5, < 2, 1, 0>
> 1.0, < 1, 2, 0>
> 1.5, < 1, 3, 0>
> }
>
> #declare An=array[1]{
> spline{A1},
> }
>
> #declare M=500;
> union {
> #declare Spl=spline{An[0]};
> #for(I,0,50)
> sphere {Spl(I/50), 0.04 no_shadow pigment {rgb 1}}
> #end
> }
> ---%<------%<------%<---
>
>
Looks like a problem with spline{} block parsing when passing a spline
id. The current Parse_Spline() code expects the spline type token to
exist otherwise it assumes the intent was a linear spline.
A fix is to add some dynamic_cast 'type checking' to:
GenericSpline *Parser::Parse_Spline()
in parser_expressions.cpp so it looks something like:
if (!New)
{
if (Old)
{
if (dynamic_cast<LinearSpline *>(Old)!=nullptr)
New = new LinearSpline(*Old);
else if (dynamic_cast<QuadraticSpline *>(Old)!=nullptr)
New = new QuadraticSpline(*Old);
else if (dynamic_cast<CatmullRomSpline *>(Old)!=nullptr)
New = new CatmullRomSpline(*Old);
else if (dynamic_cast<NaturalSpline *>(Old)!=nullptr)
New = new NaturalSpline(*Old);
else
throw POV_EXCEPTION_STRING("Internal Error. Pointer to
existing spline not of a known type.");
// New = new LinearSpline(*Old); // <-- what is done currently.
}
else
New = new LinearSpline();
}
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 15.07.2021 um 13:29 schrieb William F Pokorny:
> Looks like a problem with spline{} block parsing when passing a spline
> id. The current Parse_Spline() code expects the spline type token to
> exist otherwise it assumes the intent was a linear spline.
>
> A fix is to add some dynamic_cast 'type checking' to:
>
> GenericSpline *Parser::Parse_Spline()
Fortunately, there's a more elegant solution: The `GenericSpline` class
has a virtual member function, `Clone()`, that is implemented by each
subclass to return a newly constructed copy of whatever the actual type
of the object is.
So the code in question can remain as simple as:
if (!New)
{
if (Old)
New = Old->Clone();
else
New = new LinearSpline();
}
Will you do the honors, or shall I?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 7/15/21 4:56 PM, clipka wrote:
> Am 15.07.2021 um 13:29 schrieb William F Pokorny:
>
>> Looks like a problem with spline{} block parsing when passing a spline
>> id. The current Parse_Spline() code expects the spline type token to
>> exist otherwise it assumes the intent was a linear spline.
>>
>> A fix is to add some dynamic_cast 'type checking' to:
>>
>> GenericSpline *Parser::Parse_Spline()
>
> Fortunately, there's a more elegant solution: The `GenericSpline` class
> has a virtual member function, `Clone()`, that is implemented by each
> subclass to return a newly constructed copy of whatever the actual type
> of the object is.
>
> So the code in question can remain as simple as:
>
> if (!New)
> {
> if (Old)
> New = Old->Clone();
> else
> New = new LinearSpline();
> }
>
> Will you do the honors, or shall I?
Please go ahead.
I'll be updating my own pile of code to your cleaner fix - thank you.
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>in news:60f1546d$1@news.povray.org William F Pokorny wrote:
>> On 7/15/21 4:56 PM, clipka wrote:
Thanks.
--
https://ingoogni.nl
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|