|
|
"jr" <cre### [at] gmailcom> wrote:
> find attached the second update of the 'Bounder'.
>
> things have changed a little. now, if the object's BB is found to be "(near)
> optimal", the macro prints that and ends, otherwise, ie having some "slack", the
> macro prints the difference lines as before, plus the optimised extents and
> dimensions, as per Thomas's feedback.
>
> also new, if "slack" is reported, two variables with the differences from the
> BB's min/max extents are declared, to allow use of the info from in-scene.
> after 'Bounder' has run, one can for instance:
>
> #ifdef(Bounder_min_diff)
> // do something
> #end
>
> so. version 3. fingers crossed.
>
posting the 4th, and probably final, version of the 'Bounder', which ties up a
couple of loose ends.
an addition to the code removes existing 'Bounder_{min,max}_diff' variables,
whenever the macro is run. this means that if you call the macro multiple
times, you can be confident that existing variables were created by the most
recent call. this then allows automating the (re)bounding of objects, as
illustrated in the code below.
second, I added a thanks to TdG, whose input was (is) appreciated. kept
forgetting. :-(
enjoy, jr.
# ------------------------------------------------------------------------
jr@crow:5:bounder$ c### [at] bt1apov
#version 3.8;
global_settings {assumed_gamma 1}
background {color srgbt 0}
#ifndef (global.I)
#declare I = 0;
#end
#declare R = <20,20,20>;
#switch (I)
#case (0)
#debug concat("cylinder","\n")
#declare O = cylinder {
0, 1, .25
translate 5
};
#break
#case (1)
#debug concat("box","\n")
#declare O = box {
0, 1
};
#break
#case (2)
#debug concat("sphere","\n")
#declare O = sphere {
0, 1
};
#break
#case (3)
#debug concat("blob","\n")
#declare O = blob {
threshold .6
sphere {0, 1, 1}
scale 2
};
#declare R = <25,25,25>;
#break
#case (4)
#debug concat("superellipsoid","\n")
#declare O = superellipsoid {
<.5,3.5>
translate 5
};
#break
#case (5)
#debug concat("superellipsoid rotated","\n")
#declare O = superellipsoid {
<.5,3.5>
rotate 45
translate 5
};
#declare R = <25,25,25>;
#break
#else
#error concat("oops, no object for I=",str(I,0,0),".\n")
#end
#include "bounder.inc"
Bounder(O,R)
#ifdef (Bounder_min_diff)
#local nlb_ = min_extent(O) + Bounder_min_diff;
#local nub_ = max_extent(O) - Bounder_max_diff;
#declare O = object {
O
clipped_by {box {nlb_, nub_}}
bounded_by {clipped_by}
};
#end
Bounder(O,R)
jr@crow:6:bounder$ povparse bt1a.pov declare=I=5
Persistence of Vision(tm) Ray Tracer Version 3.8.0-alpha.10064268.unofficial
...
==== [Parsing...] ==========================================================
superellipsoid rotated
----------[Bounder info]------------------------------------------------
resolutions (per POV unit): <25, 25, 25>
min_extent "as is" BB: <3.499850, 3.499850, 3.292722>
max_extent "as is" BB: <6.500150, 6.500150, 6.707277>
BB aligned dimensions: <3.000300, 3.000300, 3.414555>
'X' axis scan resolution: 75
scans per face: 6375
scan axis increment: 0.04000400
face col increment: 0.04017124
face row increment: 0.04000400
-: ...scanning...
Parsing 5069K tokensParsing 10221K tokens
inside() calls: 280500
'Y' axis scan resolution: 75
scans per face: 6375
scan axis increment: 0.04000400
face col increment: 0.04000400
face row increment: 0.04017124
-: ...scanning...
Parsing 15363K tokensParsing 20530K tokens
inside() calls: 153000
'Z' axis scan resolution: 85
scans per face: 5625
scan axis increment: 0.04017124
face col increment: 0.04000400
face row increment: 0.04000400
-: ...scanning...
Parsing 25672K tokensParsing 30802K tokens
inside() calls: 225000
object bounding box has at least 5% "slack".
difference from BB min: <0.800080, 0.400040, 0.723082>
difference from BB max: <0.800080, 0.400040, 0.723082>
min_extent optimised BB: <4.299930, 3.899890, 4.015805>
max_extent optimised BB: <5.700070, 6.100110, 5.984195>
BB optimised dimensions: <1.400140, 2.200220, 1.968391>
------------------------------------------------------------------------
----------[Bounder info]------------------------------------------------
resolutions (per POV unit): <25, 25, 25>
min_extent "as is" BB: <4.299930, 3.899890, 4.015805>
max_extent "as is" BB: <5.700070, 6.100110, 5.984195>
BB aligned dimensions: <1.400140, 2.200220, 1.968391>
'X' axis scan resolution: 35
scans per face: 2695
scan axis increment: 0.04000400
face col increment: 0.04017124
face row increment: 0.04000400
-: ...scanning...
inside() calls: 10780
'Y' axis scan resolution: 55
scans per face: 1715
scan axis increment: 0.04000400
face col increment: 0.04000400
face row increment: 0.04017124
-: ...scanning...
inside() calls: 6860
'Z' axis scan resolution: 49
scans per face: 1925
scan axis increment: 0.04017124
face col increment: 0.04000400
face row increment: 0.04000400
-: ...scanning...
inside() calls: 7700
object bounding box is (near) optimal.
------------------------------------------------------------------------
File 'bt1a.pov' line 295: Parse Warning: No objects in scene.
==== [Rendering...] ========================================================
Rendered 1024 of 1024 pixels (100%)
POV-Ray finished
jr@crow:7:bounder$ povparse bt1a.pov declare=I=0
...
==== [Parsing...] ==========================================================
cylinder
----------[Bounder info]------------------------------------------------
resolutions (per POV unit): <20, 20, 20>
min_extent "as is" BB: <4.750000, 4.750000, 4.711325>
max_extent "as is" BB: <6.250000, 6.250000, 6.288675>
BB aligned dimensions: <1.500000, 1.500000, 1.577350>
'X' axis scan resolution: 30
scans per face: 960
scan axis increment: 0.05000000
face col increment: 0.04929219
face row increment: 0.05000000
-: ...scanning...
inside() calls: 3840
'Y' axis scan resolution: 30
scans per face: 960
scan axis increment: 0.05000000
face col increment: 0.05000000
face row increment: 0.04929219
-: ...scanning...
inside() calls: 3840
'Z' axis scan resolution: 32
scans per face: 900
scan axis increment: 0.04929219
face col increment: 0.05000000
face row increment: 0.05000000
-: ...scanning...
inside() calls: 5400
object bounding box is good, less than 5% "slack".
difference from BB min: <0.000000, 0.000000, 0.049292>
difference from BB max: <0.000000, 0.000000, 0.049292>
min_extent optimised BB: <4.750000, 4.750000, 4.760617>
max_extent optimised BB: <6.250000, 6.250000, 6.239383>
BB optimised dimensions: <1.500000, 1.500000, 1.478766>
------------------------------------------------------------------------
----------[Bounder info]------------------------------------------------
resolutions (per POV unit): <20, 20, 20>
min_extent "as is" BB: <4.750000, 4.750000, 4.760617>
max_extent "as is" BB: <6.250000, 6.250000, 6.239383>
BB aligned dimensions: <1.500000, 1.500000, 1.478766>
'X' axis scan resolution: 30
scans per face: 900
scan axis increment: 0.05000000
face col increment: 0.04929219
face row increment: 0.05000000
-: ...scanning...
inside() calls: 3600
'Y' axis scan resolution: 30
scans per face: 900
scan axis increment: 0.05000000
face col increment: 0.05000000
face row increment: 0.04929219
-: ...scanning...
inside() calls: 3600
'Z' axis scan resolution: 30
scans per face: 900
scan axis increment: 0.04929219
face col increment: 0.05000000
face row increment: 0.05000000
-: ...scanning...
inside() calls: 3600
object bounding box is (near) optimal.
------------------------------------------------------------------------
File 'bt1a.pov' line 295: Parse Warning: No objects in scene.
Post a reply to this message
Attachments:
Download 'bounder.inc.txt' (9 KB)
|
|