|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi All,
while trying to track down a bug I found that negative scaling can
make objects disappear and was wondering (not being too well-versed in
POV) whether this is legal or not:
default { pigment { color rgb <1,1,0> }}
union {
sphere {
<-1,0,0>,1
}
sphere { // Sphere101
<1,0,0>,1
}
cylinder { // Cylndr034
<-1,0,0>, <1,0,0>, 0.7
}
scale 1 // <- Change to -1 and see the spheres disappear
}
light_source
{
0*x // light's position (translated below)
color red 1.0 green 1.0 blue 1.0 // light's color
translate <20, 40, 50>
}
camera { location <0,0,6> look_at 0 }
The docs do not say anything about negative scaling. It is
inconsistent in that the cylinder does not disappear, though.
Thoughts?
- Lutz
email : lut### [at] stmuccom
Web : http://www.stmuc.com/moray
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Pretty strange. Negative scaling is perhaps the most useful undocumented
feature of pov.
Could be an epsilon problem + float-to-vector promotion problem ????
scale -1*<1,1.0001,1> works all right
Gilles
Lutz Kretzschmar wrote:
> Hi All,
>
> while trying to track down a bug I found that negative scaling can
> make objects disappear and was wondering (not being too well-versed in
> POV) whether this is legal or not:
>
> default { pigment { color rgb <1,1,0> }}
>
> union {
> sphere {
> <-1,0,0>,1
> }
> sphere { // Sphere101
> <1,0,0>,1
> }
> cylinder { // Cylndr034
> <-1,0,0>, <1,0,0>, 0.7
> }
> scale 1 // <- Change to -1 and see the spheres disappear
> }
>
>
> light_source
> {
> 0*x // light's position (translated below)
> color red 1.0 green 1.0 blue 1.0 // light's color
> translate <20, 40, 50>
> }
>
> camera { location <0,0,6> look_at 0 }
>
> The docs do not say anything about negative scaling. It is
> inconsistent in that the cylinder does not disappear, though.
>
> Thoughts?
>
> - Lutz
> email : lut### [at] stmuccom
> Web : http://www.stmuc.com/moray
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The code itself is OK. The problem seems to be with automatic bounding. Add
manual bounding to the union and the spheres reappear.
Also, if you replace the central cylinder with a sphere, this sphere also
disappears upon scaling. So I don't think the problem is with bounding boxes not
getting transformed (you can also check this by placing the camera along the X
axis - the spheres still won't appear).
Anyway I'm pretty confident it's a bug.
Margus
Lutz Kretzschmar wrote:
>
> Hi All,
>
> while trying to track down a bug I found that negative scaling can
> make objects disappear and was wondering (not being too well-versed in
> POV) whether this is legal or not:
>
> default { pigment { color rgb <1,1,0> }}
>
> union {
> sphere {
> <-1,0,0>,1
> }
> sphere { // Sphere101
> <1,0,0>,1
> }
> cylinder { // Cylndr034
> <-1,0,0>, <1,0,0>, 0.7
> }
> scale 1 // <- Change to -1 and see the spheres disappear
> }
>
>
> light_source
> {
> 0*x // light's position (translated below)
> color red 1.0 green 1.0 blue 1.0 // light's color
> translate <20, 40, 50>
> }
>
> camera { location <0,0,6> look_at 0 }
>
> The docs do not say anything about negative scaling. It is
> inconsistent in that the cylinder does not disappear, though.
>
> Thoughts?
>
> - Lutz
> email : lut### [at] stmuccom
> Web : http://www.stmuc.com/moray
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Margus Ramst wrote:
>
> The code itself is OK. The problem seems to be with automatic bounding. Add
> manual bounding to the union and the spheres reappear.
Turning the vista display on (+UD) shows that the bounding is present,
tough it doesn't work as expected...
Fabien.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The 'sphere' is definately a volitle primitive from what I have seen. The
bug notion sounds very plausible, at least in the sense that maybe it could
be hardened against such defects maybe. Possibly not a true bug in the
sense of what is normally expected in everyday use.
Bob
Margus Ramst <mar### [at] peakeduee> wrote in message
news:37F9F793.C93F696C@peak.edu.ee...
> The code itself is OK. The problem seems to be with automatic bounding.
Add
> manual bounding to the union and the spheres reappear.
> Also, if you replace the central cylinder with a sphere, this sphere also
> disappears upon scaling. So I don't think the problem is with bounding
boxes not
> getting transformed (you can also check this by placing the camera along
the X
> axis - the spheres still won't appear).
> Anyway I'm pretty confident it's a bug.
>
> Margus
>
> Lutz Kretzschmar wrote:
> >
> > Hi All,
> >
> > while trying to track down a bug I found that negative scaling can
> > make objects disappear and was wondering (not being too well-versed in
> > POV) whether this is legal or not:
> >
> > default { pigment { color rgb <1,1,0> }}
> >
> > union {
> > sphere {
> > <-1,0,0>,1
> > }
> > sphere { // Sphere101
> > <1,0,0>,1
> > }
> > cylinder { // Cylndr034
> > <-1,0,0>, <1,0,0>, 0.7
> > }
> > scale 1 // <- Change to -1 and see the spheres disappear
> > }
> >
> >
> > light_source
> > {
> > 0*x // light's position (translated below)
> > color red 1.0 green 1.0 blue 1.0 // light's color
> > translate <20, 40, 50>
> > }
> >
> > camera { location <0,0,6> look_at 0 }
> >
> > The docs do not say anything about negative scaling. It is
> > inconsistent in that the cylinder does not disappear, though.
> >
> > Thoughts?
> >
> > - Lutz
> > email : lut### [at] stmuccom
> > Web : http://www.stmuc.com/moray
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Lutz Kretzschmar wrote in message <37f9d4e7.14580615@194.174.214.110>...
>Hi All,
>
>while trying to track down a bug I found that negative scaling can
>make objects disappear and was wondering (not being too well-versed in
>POV) whether this is legal or not:
>
>
>default { pigment { color rgb <1,1,0> }}
>
>union
> sphere {
> <-1,0,0>,1
> }
> sphere { // Sphere101
> <1,0,0>,1
> }
> cylinder { // Cylndr034
> <-1,0,0>, <1,0,0>, 0.7
> }
> scale 1 // <- Change to -1 and see the spheres disappear
>}
>
>
>light_source
>{
> 0*x // light's position (translated below)
> color red 1.0 green 1.0 blue 1.0 // light's color
> translate <20, 40, 50>
>}
>
>camera { location <0,0,6> look_at 0 }
The problem only occurs when scaling by <-1,-1,-1>. Scaling by <-1,1,1>,
<1,-1,1>, <1,1,-1>, or anything else doesn't cause problems.
Mark
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 6 Oct 1999 01:17:27 -0400, Mark Wagner wrote:
>The problem only occurs when scaling by <-1,-1,-1>. Scaling by <-1,1,1>,
><1,-1,1>, <1,1,-1>, or anything else doesn't cause problems.
(Crossposted to bugreports)
Ah, now it begins to make sense. See, when you scale a sphere it
multiplies the radius and the center by the scale factor unless it
either already has a nonuniform transform in its list or the scale
factor itself is nonuniform; in those two cases it uses the usual,
more sophisticated methods.
Obviously, making the radius negative is a bad thing. Here's the
fix, in the function Scale_Sphere in spheres.c:
if (Sphere->Trans == NULL)
{
VScaleEq(Sphere->Center, Vector[X]);
- Sphere->Radius *= Vector[X];
+ Sphere->Radius *= fabs(Vector[X]);
Compute_Sphere_BBox(Sphere);
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
So why does manual bounding fix the problem?
What happens to the bounding boxes?
Margus
Ron Parker wrote:
>
>
> Ah, now it begins to make sense. See, when you scale a sphere it
> multiplies the radius and the center by the scale factor unless it
> either already has a nonuniform transform in its list or the scale
> factor itself is nonuniform; in those two cases it uses the usual,
> more sophisticated methods.
>
> Obviously, making the radius negative is a bad thing. Here's the
> fix, in the function Scale_Sphere in spheres.c:
>
> if (Sphere->Trans == NULL)
> {
> VScaleEq(Sphere->Center, Vector[X]);
>
> - Sphere->Radius *= Vector[X];
> + Sphere->Radius *= fabs(Vector[X]);
>
> Compute_Sphere_BBox(Sphere);
> }
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 07 Oct 1999 13:29:08 +0300, Margus Ramst wrote:
>So why does manual bounding fix the problem?
>What happens to the bounding boxes?
I think the negative radius is just fine in the sphere intersection
code, probably because it uses radius squared for its computations
so as to avoid taking square roots. The problem must happen because
the bounding box ends up being "backwards" - i.e. having a minimum
corner of <1,1,1> and a size of <-2,-2,-2>. The bounding code must
not be able to handle that. Setting a manual bounding volume makes
POV-Ray ignore the automatically calculated bounds.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|